View Full Version : NPC heading..
deaddraqear
04-21-2011, 06:17 PM
I've browsed forums here for a couple days, not finding any answers, looking for something that's been bugging me, but not "make or break" so haven't stressed on finding a solution.
My problem is with quest npc headings.. I place mobs, and when hailed they work as intended, but they do not return to their set heading.. I've tried adding a waypoint, but that didn't seem to do anything as the npc wasn't moving..
Only thing I can think of, is to set a timer on hail, and maybe have a quest::moveto with #loc values?
If there is another (or easier) way, would really appreciate assistance =) Thx in advance!
trevius
04-22-2011, 03:45 AM
I am not exactly sure what you are trying to do here, but maybe posting your script would help us to figure out what your issue is. If you want an NPC's heading, you can just do this (2 example of how to get the heading):
sub EVENT_SAY {
my $Heading = $npc->GetHeading();
quest::say("My exported heading is $h and my GetHeading is $Heading.");
}
joligario
04-22-2011, 04:17 AM
I think he wants the npc to face back to spawn heading after quest interaction.
trevius
04-22-2011, 05:14 AM
Ahh, yeah then you just want to set a timer directly from EVENT_SAY. Just set the timer, then I think moveto should work if you use it like this in your timer:
my $SpawnHeading = $npc->GetSpawnPointH();
$npc->MoveTo($x, $y, $z, $SpawnHeading);
Or, you might try this:
my $SpawnHeading = $npc->GetSpawnPointH();
$npc->SetHeading($SpawnHeading);
One of those will probably work.
joligario
04-22-2011, 05:44 AM
I'm thinking this might not be a bad emu code modification if it was like that on live. It's been a while, but I think I remember them facing back away after the 30 sec or whatever for quest engagement.
trevius
04-22-2011, 09:13 AM
I imagine that wouldn't be too hard to add at some point. Can anyone confirm for sure that is how it happens on Live and about how long the timer is for it? Not saying I will add it myself soon (or ever), but it is a possibility if I have the time and if it can be confirmed.
ChaosSlayerZ
04-22-2011, 11:11 AM
I vaguely remember that SOME npcs, even those without any pathing would turn back the default direction they were facing... (maybe they did had no move pathing direction adjustment just for this)
I think they were mostly guards....
But I certainly also remember that some would remained turn the wrong way for hours... Most merchants for one...
I remember approaching a merchant/quest npc from behind, hailing him.. and going AFK for like 30 min - when I got back he was still looking at me ;)
deaddraqear
04-22-2011, 11:27 AM
Thx for input guys.. =) The quest::moveto does work, I was just wondering if there was a way to do it without going back into .pl and add it in (glad I really looked into it when I did, only had 30ish npc's to edit)
Using 30 seconds myself, but on Live it may have varied per npc but dont quote me on that.. Tried to find any quest npc's on zones that I havent touched yet, and no quest npc that I found, would return to original heading after hailed... Mobs with pathing would obviously return to path tho
Still playing with perl and "learning" so I wasnt aware of the methods you posted Trev.. mine are a bit sloppier and tedious to setup.. #loc of mob (with no interaction of course) then..
Portion of code.. With any possible dialogue outcome resulting in the quest::starttimer
sub EVENT_TIMER
{
if($timer eq "heading")
{
quest::moveto(-142.9,104.7,105.3,102.1);
}
}
sub EVENT_SAY
{
if($text=~/hail/i)
{
if($class eq 'Warrior' || $class eq 'Cleric' || $class eq 'Paladin' || $class eq 'Shadowknight' || $class eq 'Ranger')
{
if(quest::istaskactive(26))
{
$client->Message(7, "$NPCName whispers, 'I am sorry $name, but I cannot help you any further.'");
quest::settimer("heading", 30);
}
else
{
$client->Message(7, "$NPCName whispers, 'Hello $name. I can craft you a set of $plate identical to the ones some of us wear, if you gather the materials.'");
quest::settimer("heading", 30);
}
}
}
}
Heres another question.. Is there a way to start timer easier then what I have done? Possibly a...
sub EVENT_SAY
{
quest::settimer("heading", 30);
{
if($text=~/hail/i)
}
}
robinreg
04-22-2011, 12:26 PM
I know vendor npc without hailing does not change heading at all from what I can tell. On peq, all vendors changed heading regardless of hailing or not and they don't change back to their original heading. I often wondered if I can fix that for all vendor npc for my server without having to do a perl script for every vendor npc. I have not gotten around to fooling with it yet.
deaddraqear
04-22-2011, 12:53 PM
From what I gather robin, it has to be done with perl.. =( was originally hoping it could be done somehow without perl myself..
Maybe a coding wiz could throw something into the npc_type tables or something? I wouldn't be able to even guess at how to do it or where to put it in... =P
robinreg
04-22-2011, 01:28 PM
yeah I went on live and check the vendors to see if they change heading and I confirm that they don't change heading at all.
ChaosSlayerZ
04-22-2011, 01:48 PM
on Hail or on Opening their wares?
need to check both
robinreg
04-22-2011, 02:34 PM
I did both. They didn't say anything on hails at least most of the vendor don't. only time they say something is when I open up the vendor window.
trevius
04-23-2011, 08:46 AM
Thx for input guys.. =) The quest::moveto does work, I was just wondering if there was a way to do it without going back into .pl and add it in (glad I really looked into it when I did, only had 30ish npc's to edit)
Using 30 seconds myself, but on Live it may have varied per npc but dont quote me on that.. Tried to find any quest npc's on zones that I havent touched yet, and no quest npc that I found, would return to original heading after hailed... Mobs with pathing would obviously return to path tho
Still playing with perl and "learning" so I wasnt aware of the methods you posted Trev.. mine are a bit sloppier and tedious to setup.. #loc of mob (with no interaction of course) then..
Portion of code.. With any possible dialogue outcome resulting in the quest::starttimer
sub EVENT_TIMER
{
if($timer eq "heading")
{
quest::moveto(-142.9,104.7,105.3,102.1);
}
}
sub EVENT_SAY
{
if($text=~/hail/i)
{
if($class eq 'Warrior' || $class eq 'Cleric' || $class eq 'Paladin' || $class eq 'Shadowknight' || $class eq 'Ranger')
{
if(quest::istaskactive(26))
{
$client->Message(7, "$NPCName whispers, 'I am sorry $name, but I cannot help you any further.'");
quest::settimer("heading", 30);
}
else
{
$client->Message(7, "$NPCName whispers, 'Hello $name. I can craft you a set of $plate identical to the ones some of us wear, if you gather the materials.'");
quest::settimer("heading", 30);
}
}
}
}
Heres another question.. Is there a way to start timer easier then what I have done? Possibly a...
sub EVENT_SAY
{
quest::settimer("heading", 30);
{
if($text=~/hail/i)
}
}
Yeah, you can simplify it a bit by doing this:
sub EVENT_TIMER
{
if($timer eq "heading")
{
my $SpawnHeading = $npc->GetSpawnPointH();
quest::moveto($x, $y, $z, $SpawnHeading);
}
}
sub EVENT_SAY
{
if($text=~/hail/i)
{
if($class eq 'Warrior' || $class eq 'Cleric' || $class eq 'Paladin' || $class eq 'Shadowknight' || $class eq 'Ranger')
{
if(quest::istaskactive(26))
{
$client->Message(7, "$NPCName whispers, 'I am sorry $name, but I cannot help you any further.'");
}
else
{
$client->Message(7, "$NPCName whispers, 'Hello $name. I can craft you a set of $plate identical to the ones some of us wear, if you gather the materials.'");
}
}
}
quest::settimer("heading", 30);
}
That way, you don't need to get the exact loc of each NPC, this timer should work for all without needing to adjust it. Then, you just add in the the settimer once at the end (or beginning) of EVENT_SAY and you are all set.
deaddraqear
04-23-2011, 11:32 AM
Many thanks Trev, will try this out on next quest npcs =D
ChaosSlayerZ
04-23-2011, 12:10 PM
ok tell me if I am reading the code right:
when timers runs out, the npc will check for - which which way he should be facing WHEN HE WAS SPAWNED, and set himself that way?
I am just curious if 'moveto' command would cause him to "jump in place", since he would not be "turning" technically but "teleported" which usually causes "bumping up" like effect...
Thought I guess its a minor issue.
Very cool solution otherwise ;)
deaddraqear
04-23-2011, 05:12 PM
Works like a charm Trevius =)
You guys figure out how to keep vendors from turning on inspect? Or at least a script to have them turn back quickly?
Btw Chaos, they dont seem to teleport at all... if i #summon the npc, he will walk back to his spawn position.. (not sure if this is what ya meant tho)
ChaosSlayerZ
04-23-2011, 07:24 PM
basically what I meant that it could cause them to 'warp'
but I am happy if they don't ;)
robinreg
04-23-2011, 08:03 PM
I also noticed on Live that the npc changed heading facing toward you if you stand near them for a certain amount of time. whether it be a guard or vendor or quest. They all seems to do that after a few minutes of standing close to them. Otherwise they would go back to their original heading if you are not close to them. Not sure if it's all the npc that does that.
joligario
04-23-2011, 09:01 PM
That's interesting. That must be new (post DoDH I guess).
robinreg
04-23-2011, 09:34 PM
it appeared that it was always like that because they do that on eqmac also. I never really paid attention to it until just recently when it comes to seeing how npc reacts with headings. It may be certain npc or most. I'll have to investigate it more.
robinreg
04-24-2011, 01:54 AM
went on eqmac, the inn npc in north freeport changed heading to face me when I got close to it. I can see the innkeeper kinda flipped back to her original heading then back to me. I moved out and then back in and this time she did not changed heading. Seems to be random I guess. I went to find another npc "Linda Rains". She did not changed heading until I hail, face me the whole time i was close by. I finally moved out and about 5 mins later she changed back to her original heading. I guess They all go to their original heading if there is no one close by for a set amount of time or so it seem.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.