NPC Conversation
I am trying to make two NPCs respond to each other in a script. The scenario should play out like this:
Code:
Player: "Hail NPC1" Code:
if($text=~/hail/i){ So ultimately my question is this: Can you get one NPC to respond to another NPC? Thanks, -Codemephit |
look at the part of the Cleric Epic 1.0 quest in lakerathe where there is a conversation between two npc's using quest::signalwith()
Natasha_Whitewater.pl Shmendrik_Lavawalker.pl |
Pure genius Congdar!! Thanks for the uber-fast reply.
Here is my take on how to do it. (Posting in case someone else may need to know how it's done.) Code:
quest::signalwith(NPC_ID, SIGNAL_NUMBER, PAUSE); Code:
sub EVENT_SAY{ Code:
sub EVENT_SIGNAL{ |
any way to pass on the client name data to NPC2? because this way the 2nd npc wont know who hailed NPC1. $name basically works for NPC1 only.
|
Here is how I do that:
NPC1 (the NPC that the client is currently dealing with) Code:
sub EVENT_SAY { NPC2 (the NPC that we are sending the client info to) Code:
my $ClientName; #Only setting this here so the name can be used in other sub events if needed. BTW, I haven't tested the exact script as I posted it here, because I modified an existing one I use to simplify it. But, I think this should work for you. If not, it should be easy enough to get the idea of what you need to be doing. If you have any issues, just put some say messages in there to debug it, so you can see where it might be failing. Here is an example of what I mean by that: Code:
if ($text=~/Hail/i) |
Thanks Trev! So if I understand it correctly, the trick is to transfer client id with signal, and to use signal ranges for separate responses based on the fact that Entity IDs are always lower than ~1500.
|
Yeah, you basically send the signal by adding 1000 or whatever to your client's entity ID. So, if your client's entity ID was 264, the signal would be 1264. Then, the NPC that gets that signal knows that anything from 1000-3000 is a client ID and a signal to do something particular. It then subtracts 1000 from the signal ID and then has 264, which is the client's entity ID that it can no do just about anything with. If you wanted to have different responses, you could just add 1000 to the first signal, then something like 3000 to the second, 5000 to the 3rd and so on. And then you just check for ranges in EVENT_SIGNAL instead of an exact signal ID number, like I show in the example.
Lemme know if you have any problems or questions on it. |
All clear, tested, and works like magic. Thanks! :)
|
Nice sig :) I really love what you did with your hub zone there. It gets my vote for best hub zone in EQEmu :D
|
Thanks Trev! Nice words from someone having an amazing custom server as yours.. :)
(sorry for the offtopic) |
All times are GMT -4. The time now is 01:12 AM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.