Follow then Flee if too close Package

Post » Thu Jun 21, 2012 9:55 am

Ok I'm trying to work out what settings I need to make a package that will have a summon Follow the player but then if it comes within a certain distance (like on top of) of the player will Flee back away from the player so that the player doesnt need to worry about getting blocked in tight spaces by his summoned creatures.

I have tried using one Follow package and a separate Flee package and both of them work on their own but when I try to use both of them together then only the package that is on the top of the stack runs. I have also tried making a combined package that is something like this

Stacked.
Procedure Follow
Stacked Get Actor Value Waiting for player == 1
Find Player If distance < 200
Flee player If distance < 200

I also tried a simultaneous
Follow player
Find Player Distance < 200 " From my understanding if you have simultaneous packages that part will end if one meets its criteria"

So Once the player is Less that 200 Units then I would think the Find part should end the Follow procedure and move to the Flee player part of the script.

Sequenced
Flee from player

But it didn't work that way for me.. The Skeleton just keeps following and never Flees.


Does anyone know exactly how I need to set this up? Ive tried several different ways and nothings working.. Does it even work to have conditions like GetDistance from PlayerRef > or < So and so?
User avatar
jeremey wisor
 
Posts: 3458
Joined: Mon Oct 22, 2007 5:30 pm

Post » Thu Jun 21, 2012 6:44 am

Yes, GetDistance Works. But you have to Cast from an Alias to an ObjectReference first (if you are using Aliases).

It isn't perfect, there is a tiny bit of lag, but I have an OnUpdate Script that looks continually for the distance between player and NPC (on the player alias) and it works fine

I have not tried to combine it with a follow package and it may be that combination causing you problems - Does follow have a radius?
User avatar
Naomi Ward
 
Posts: 3450
Joined: Fri Jul 14, 2006 8:37 pm

Post » Thu Jun 21, 2012 1:49 pm

Follow has a Min distance and a max distance. in the package
User avatar
Samantha Pattison
 
Posts: 3407
Joined: Sat Oct 28, 2006 8:19 pm


Return to V - Skyrim