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 .