Welcome to the Builder Academy

Question Ask Triggers for multiple mobs in one room

More
29 Jan 2020 20:31 #8523 by Nero
Is it possible to create ask triggers for multiple mobs in one room?

For example:
I have three mobs, fred, delnar, and negrak in one room who I want to each have their own ask triggers

Right now it only seems that fred's ask trigger overrides delnars and negraks since he is the first in the room
Code:
Name: 'Fredrick: Ask Trigger', VNum: [23007], RNum: [ 1245] Trigger Intended Assignment: Mobiles Trigger Type: Command , Numeric Arg: 100, Arg list: ask Commands: if %cmd% == ask && (!%arg%) return 0 * elseif (%cmd% == ask && ((%arg% /= fredrick) && (%arg% /= delnar)) tell %actor.name% Delnar and his brother both volunteered to serve me in my time of need after Mistaavi tried to kill me. Delnar does not seem to get along too well with my guards or their captain. I wish he would temper that mean streak of his a little.

Please Log in or Create an account to join the conversation.

More
30 Jan 2020 03:37 #8524 by krell
I'm not sure what you're trying to do. Are you trying to get each mob to say the same lines when asked?

Also
Code:
((%arg% /= fredrick) && (%arg% /= delnar))

Means that the string has to contain both "frederick" and "delnar" or it won't fire. Is that intentional?
Do all three mobs share the same script?

Please Log in or Create an account to join the conversation.

More
30 Jan 2020 05:55 #8525 by krell
Did some testing with this script
Code:
if %cmd.mudcommand% == ask && %self.name% /= %arg.car% say %actor.name% is the greatest! say My name is %self.name%! elseif %cmd% == ask && !%arg% return 0 end

The two mobs I was testing on wandered between two rooms. The latest mob to join the room was the mob that replied, unless it was the only mob. Mobs by themselves in the room replied.

So there seems to be something that determines which mob replies to the command based when it arrived in the room.

Please Log in or Create an account to join the conversation.

More
30 Jan 2020 06:01 - 30 Jan 2020 06:16 #8526 by Papaya Pete
It is possible to have them have their own ask chains, but you are going to have to McGuyver it.
If you are going to have these mobs wander about, they each are going to need their own scripts. Having all three in one room, with them not being able to be killed/moved, you can apply a script on one and have it handle topics being asked by all three.

[strike]I don't have an example on hand, give me a bit and I will pull one up and edit this post.[/strike]

Here's an example I have on hand; it's a blacksmith in a small village, and you can ask him about different topics. I apologize ahead of time for the length and any weird spacing; I ripped this straight out of notepad with color codes in, and just tried to quickly remove them to make it more readable.
Code:
%echoaround% %actor% %actor.name% asks %self.name% a few questions... switch %arg% case metalsmith name case durgen name emote pants a little, wiping sweat off of his brow. "The name's Durgen. Village metalsmith. Pleased to meet you." break case metalsmith job case durgen job emote gestures with a hammer at his little shop. "It doesn't look like much, but this is it; finest goods in all of Hammerfell!" He smiles in satisfaction. "It gets a bit chilly wearing some of this, but when you're delving in caves the cold isn't that much of a problem. Usually it's some other kind of danger." break case metalsmith help case durgen help say Ah there is something that you could do to earn some coin. say Over in the mines, there's plenty of iron for me to work with. However, I can't really go over there and get it myself; I have plenty of work here to do! say Mine out as much as you can for me and bring it back, and I'll pay you for your hard work! break case metalsmith village case durgen village say It's small and out of the way, but that makes it easy to keep up with demand. Not too many folk around here don't have a huge need for armor. However, there's plenty of adventuring youths wanting a bit more protection before going to the mines or cavern. break case metalsmith hammerfell case durgen hammerfell emote shrugs, slamming his hammer down a few times. "It's cold here, especially at night, but beyond the ocavern lies Frostfall Mountains and a lot more cold." break case metalsmith dangers case durgen dangers case metalsmith danger case durgen danger emote chuckles dryly as he continues to work on a blade. "Yes, there are some to be found in the forest. Even more if you head underground; browse my wares, friend! I'll even repair something for you if you'd like." %send% %actor% If you'd like more information on repairing, type help repair. break case metalsmith cavern case durgen cavern say The cavern's the only way out of Hammerfell, and can be quite dangerous. Some of the other youths around here have gone in and found quite a few cave bugs; they like warm places and settle in where there's food. n emote chuckles, "Don't worry yourself too much... they're not meat eaters; mostly they just scavenge for plants and mushrooms. The problems arise when you're too close to their nest." break case metalsmith twiglings case durgen twiglings emote laughs a little, "I think a spry youth like yourself can handle them." break case metalsmith wolves case durgen wolves emote nods rather grimly, "We've lost quite a few to those beasts. The small packs are extremely dangerous; if I were you, I'd just run away from them if I was ambushed." break case metalsmith mine case durgen mine case metalsmith mines case durgen mines say They used to be easy to work in, but cave bugs have infested the place and make it a royal pain to get anything out of. Others have managed to get some ore, but it took a lot of work! emote thinks for a moment, "Ah, one of them told me something... yes, that's right; the deeper you go, the closer you'll get to their nest. Keep that in mind." break case metalsmith ruins case durgen ruins say Ruins, you say? That's a dangerous place, I'm sure... best equip yourself with the best you've got if you plan on going there. break case metalsmith black hand case durgen black hand emote scowls, "It might be peaceful here, but those foul fiends will probably find a way to try and ruin that in Hammerfell. By the time they get here, I'll make a blade so fine that its wielder will easily split any Black Hand brigand in two!" break case metalsmith phoenix case durgen phoenix case metalsmith phoenixes case durgen phoenixes emote sighs, "Been a while since I've gone in and heard Rucks talk about the good ol' days... well, good except for the being in a hopeless war part! Hah!" say rSome of them are quite good; you'd probably get a kick out of it! n break case metalsmith falwynd case durgen falwynd emote shrugs his shoulders, "Eh, I've thought about leaving here and trying to get to there... but I just don't have the heart to try. I'd have to start over completely; it's not like I can ALL of my tools of the trade with me..." say No, no... I'm quite pleased to be in this little village. break default %send% %actor% Either the person you are questioning isn't here, or that person doesn't know anything about that subject. break end

So, if you had your three different mobs in the same room, you can add in case statements tying in the keywords that would point to that mob and a topic that he has something to say about. "case ben skywalker" if you want to ask Ben about someone named Skywalker, for example.
However, if mobs wander about and you don't know if said person will be in the room... you could have the script check to see if your target mob is in the same room, and react accordingly. If you have three different mobs who all wander around, you could just slap the same script into all three if it checks to see who is present when a question is asked.
Last edit: 30 Jan 2020 06:16 by Papaya Pete.

Please Log in or Create an account to join the conversation.

More
31 Jan 2020 01:49 - 31 Jan 2020 01:49 #8527 by Nero
Thanks this may be what I need. It will be 3 mobs that are all in one room, they do not wander. I have three separate scripts on each but only the mob that is first in the room seems to override when trying to ask anything.

Also, yes the above script is intentional

I want the player to ask fredrick delnar and he will respond with information about Delnar.
Last edit: 31 Jan 2020 01:49 by Nero.

Please Log in or Create an account to join the conversation.

More
31 Jan 2020 21:18 #8528 by Fizban
The scripts don't need to be combined, the if checks just need to be selective enough to only trigger for things meant to trigger their speech, and they need return 0 for everything else to allow other triggers in the room to interact with any command that doesn't trigger the first script, etc.

Please Log in or Create an account to join the conversation.

Time to create page: 0.251 seconds