Aller au contenu

Photo

GetDistanceBetween onExit possible?


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

#1
GIANTSWORD

GIANTSWORD
  • Members
  • 88 messages

I'm trying to discourage players from outrunning their pack animals and would like to do a GetDistanceBetween check when the PC exits an area.  If they are > 30.0 then it drops their henchman (pack animal) and floats text that they have lost their animal.

 

They can then go back to the previous area and tame it again.

 

Problem is when I add this onExit

 

object oExiting = GetExitingObject();

object oHench = GetHenchman(oExiting);
 
    if (GetDistanceBetween(oHench, oExiting) > 30.0)//Checks distance, if too far, will not follow
    {
        AssignCommand(oHench, ClearAllActions());
        RemoveHenchman(oExiting, oHench);
        DelayCommand(4.5, FloatingTextStringOnCreature("<cÍÍ >You have lost your pack animal</c>", oExiting));
    }

 

my conditions always fire as if I am always 30.0 distance away even if the animal is right behind me, so I lose the animal.  I fear the check isn't going off until I transition and it's true regardless of distance.

 

Any suggestions would be great!

 

 



#2
Shadooow

Shadooow
  • Members
  • 4 470 messages

no not possible OnExit

 

but you can code this in OnAreaTransition script (default area transition script thats fired when there is no custom script is nw_g0_transition)



#3
GIANTSWORD

GIANTSWORD
  • Members
  • 88 messages

I'll be alright with doing that if it's going to apply to every standard transition.

 

I was trying to avoid having to have a custom script on every single area transition.  Instead just a blanket check.

 

Thanks Shadooow



#4
GIANTSWORD

GIANTSWORD
  • Members
  • 88 messages

I would like to restrict my henchmen (pack animals) just like horses and have a hitching post in town that they jump to when you enter the 3_NO_HORSES areas.  

 

How would I go about assuring this?  My pack animals have the henchmen script sets on them, how do I define them as a horse so they are picked up by that variable?

 

EDIT: ended up finding my solution in the OnAreaTransition