PDA

View Full Version : Laying down npc moves when talked to.


Shadow-Wolf
09-13-2010, 01:49 AM
Got an npc that I want players to be able to talk to while he's laying down, problem is the npc still moves while laying down so he puts his head through the wall. Any ideas?

joligario
09-13-2010, 07:56 AM
That always bugged me, but I kept forgetting to look at the code. Grab the fix in r1661

Hmm
09-13-2010, 04:00 PM
This fixes same problem with sitting npcs?

Akkadius
09-13-2010, 04:38 PM
This fixes same problem with sitting npcs?

Most likely not, but I have a Dragon Statue that my players will heavily navigate through here with the next content expansion coming up soon here. And it stores its heading for each time a client talks to the NPC, so it never moves an inch. You can achieve this by doing the following:



sub EVENT_SPAWN{
quest::settimer("GetVars", 1);
}

sub EVENT_TIMER{
if ($timer eq "GetVars"){
my $HEADING = $npc->GetHeading();
my $NX = $npc->GetX();
my $NY = $npc->GetY();
my $NZ = $npc->GetZ();
$npc->SetEntityVariable(70, $NX);
$npc->SetEntityVariable(71, $NY);
$npc->SetEntityVariable(72, $NZ);
$npc->SetEntityVariable(73, $HEADING);
quest::stoptimer("GetVars");
}
if($timer eq "moveback"){
my $NX = $npc->GetEntityVariable(70);
my $NY = $npc->GetEntityVariable(71);
my $NZ = $npc->GetEntityVariable(72);
my $HEADING = $npc->GetEntityVariable(73);
$npc->GMMove($NX, $NY, $NZ, $HEADING);
quest::stoptimer("moveback");
}
}

sub EVENT_SAY{
my $NX = $npc->GetEntityVariable(70);
my $NY = $npc->GetEntityVariable(71);
my $NZ = $npc->GetEntityVariable(72);
my $HEADING = $npc->GetEntityVariable(73);
$npc->GMMove($NX, $NY, $NZ, $HEADING);
quest::settimer("moveback", 1);

}

joligario
09-13-2010, 08:09 PM
I debated that when fixing this in the morning. So I went with the lying only. I think you could turn when crouched. Sitting was kinda flaky, but I thought, what the heck. Up to the community, we could do it either way.

Shadow-Wolf
09-13-2010, 11:49 PM
Thanks Akkadius, I was thinking of something along that line but wasn't sure how to implement it.

Akkadius
09-13-2010, 11:51 PM
Thanks Akkadius, I was thinking of something along that line but wasn't sure how to implement it.

No problem.