Author Topic: Silly little facing problem  (Read 357 times)

Legacy_Tarot Redhand

  • Hero Member
  • *****
  • Posts: 4165
  • Karma: +0/-0
Silly little facing problem
« on: April 02, 2013, 02:07:15 pm »


               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
               
               

               
            

Legacy_meaglyn

  • Hero Member
  • *****
  • Posts: 1451
  • Karma: +0/-0
Silly little facing problem
« Reply #1 on: April 02, 2013, 03:39:49 pm »


               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
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Silly little facing problem
« Reply #2 on: April 02, 2013, 05:36:19 pm »


               Throw down an event (AoE)  for them to respond to.
               
               

               
            

Legacy_Tarot Redhand

  • Hero Member
  • *****
  • Posts: 4165
  • Karma: +0/-0
Silly little facing problem
« Reply #3 on: April 02, 2013, 11:58:33 pm »


               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% '<img'>.

TR
               
               

               


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


            

Legacy_Knight_Shield

  • Hero Member
  • *****
  • Posts: 812
  • Karma: +0/-0
Silly little facing problem
« Reply #4 on: April 08, 2013, 07:26:38 pm »


               Can also do with a waypoint variable.
create waypoint for guard then in varaibles       WAYPOINT_SETFACING_L      int     1
               
               

               
            

Legacy_Tarot Redhand

  • Hero Member
  • *****
  • Posts: 4165
  • Karma: +0/-0
Silly little facing problem
« Reply #5 on: April 09, 2013, 01:22:14 am »


               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 .
                     
                  


            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Silly little facing problem
« Reply #6 on: April 09, 2013, 02:21:01 am »


               

Tarot Redhand wrote...
Well, I have learned not to take *everything* that the lexicon says as gospel only 99.9% '<img'>.

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.