Author Topic: Force Follow through door  (Read 311 times)

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Force Follow through door
« on: November 25, 2011, 11:41:10 pm »


                How does one make a PC ForceFollow an NPC through a door?

The ForceFollow command does not seem to follow across a transition.
               
               

               
            

Legacy_wyldhunt1

  • Sr. Member
  • ****
  • Posts: 443
  • Karma: +0/-0
Force Follow through door
« Reply #1 on: November 26, 2011, 04:52:42 am »


               I've not experimented a great deal with PC control across areas.
However, I think my first idea would be to have a hb script checking to see if they are in the same area. If not, force the PC to walk to the door. It should grab them and send them through when they touch it. Then you can force follow the NPC again.

If you need it to work on multiple doors in some universal way, you could have a hb track the NPC's location so that you could grab the nearest door to the NPC's previous location as soon as they are no longer in the same area.

Or, the easy rout would be to just jump the PC to the NPC when they are no longer in the same area. Assuming the PC has been following the NPC, they may be close enough to not notice.
void Jump(object oPC, object oNPC)
{
int tries;
if(GetArea(oPC) != GetArea(oNPC))
{
if(GetArea(oNPC == OBJECT_INVALID) &&  tries <  20)
{
tries++
DelayCommand(0.1, Jump());
}
else if (tries < 20)
{
JumpToLocation(oPC, GetLocation(oNPC));
}
}
}

Or something like that... I don't have the toolset with me, so the function names may be off.
The small delay in the check is to wait until the NPC has an actual area in case the HB checks as they are transitioning in a lag spike or some such.
               
               

               


                     Modifié par wyldhunt1, 26 novembre 2011 - 05:04 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Force Follow through door
« Reply #2 on: November 26, 2011, 05:07:33 am »


               I think the first thing I would try is to make sure that the cross area switch was set for the NPC.   I have never tryed having a PC follow a NPC though.  I do know that I have had no problem following a PC accross areas before.
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Force Follow through door
« Reply #3 on: November 26, 2011, 06:07:30 am »


               I am using Fallen's lycanthrope scripts. So what I am trying to do is to keep the Player close to their Beast Form lycanthrope. Fallen's scripts do check if the player is in a different area than the beast. But the heartbeat is only once every 6 seconds. So transitions are awkward.

The X2_SWITCH_CROSSAREA_WAYPOINTS is set. Doesn't make a difference. I think that switch is only for NPCs.

So what I think I am going to do is rewrite the AI for the lycanthrope. When it uses a door, the PC will be immediately jumped to that destination. It should work smoothly.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Force Follow through door
« Reply #4 on: November 26, 2011, 06:20:37 am »


               Modifying the AI seems like it can get a little complex.   Perhaps it would be simpler to just modify your transistion scripts for the doors.    If you do not have custom scripts in place they by default are going to fire either NW_G0_Transition.nss or x3_G0_Transition when the door is used.
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Force Follow through door
« Reply #5 on: November 27, 2011, 12:38:52 am »


               I modified the NW_G0_TRANSITION to jump associates (those within 10m of the door/trigger) but could not find a way to jump a PC force following an NPC. So changing the AI worked best. Fallen has a function that specifically directs the werewolf at a transition. once that is decided in the ai, i created a function that piggybacks and does the same to the PC. it has worked well so far.