Aller au contenu

Photo

Silly little facing problem


  • Veuillez vous connecter pour répondre
6 réponses à ce sujet

#1
Tarot Redhand

Tarot Redhand
  • Members
  • 2 700 messages
I am building a sp module and I have some guards that I have a tiny little script into their onpercieve events that works fine as it is. What it does is to make the guard turn around and face the pc, then say a one-liner. What I would like the script to be able to do is when the PC is no longer detected by the guard, for the guard to resume their original facing. The problem is that according to the lexicon the built in function GetLastPerceptionVanished(), only works when the PC leaves the game. Any suggestions please?

TR

#2
meaglyn

meaglyn
  • Members
  • 817 messages
You can't rely on an event for vanished so maybe a userdef heartbeat handler, with something like this in it:

object oPC = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_PC, OBJECT_SELF,CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN, 1);

if(!GetIsObjectValid(oPC)) {
           // do the return facing
}


Or some such...


Cheers,
meaglyn

#3
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
Throw down an event (AoE) for them to respond to.

#4
Tarot Redhand

Tarot Redhand
  • Members
  • 2 700 messages
Having now tested GetLastPerceptionVanished(), I can say with some certainty that the lexicon got this one wrong. It actually works when the NPC can no longer detect the PC in sp mods. It doesn't mean that I have a perfectly working script, but I have a sneaky idea of a way around that problem that is more roleplay anyway. Thanks for the suggestions guys. Well, I have learned not to take *everything* that the lexicon says as gospel only 99.9% :).

TR

Modifié par Tarot Redhand, 02 avril 2013 - 10:59 .


#5
Knight_Shield

Knight_Shield
  • Members
  • 444 messages
Can also do with a waypoint variable.
create waypoint for guard then in varaibles WAYPOINT_SETFACING_L int 1

#6
Tarot Redhand

Tarot Redhand
  • Members
  • 2 700 messages
Found another error with the downloadable version of the lexicon. The numbers that it claims match NwNs built-in constants for animations are wrong. This is only of consequence if you are using something like Axe Murderer's Killer Walk Waypoints, where you need the actual numbers. If you are coding in the script editor, use the constant names and you'll be fine. Also, the numbers in the readme that comes with KWW are correct, its just those in the downloadable lexicon.

TR

Modifié par Tarot Redhand, 09 avril 2013 - 12:23 .


#7
WhiZard

WhiZard
  • Members
  • 1 204 messages

Tarot Redhand wrote...
Well, I have learned not to take *everything* that the lexicon says as gospel only 99.9% :).

TR


There is a large volume of core functions with inaccuracies here and there.  The most developed articles tend to be the cleanest, but I have found quite a few with errors especially amongst the lesser used functions.