Random wander script?
#1
Posté 21 mai 2015 - 11:22
#2
Posté 21 mai 2015 - 11:47
There's a function, ActionRandomWalk(), that can be given to a creature and it will wander with no need for waypoints. It can be assigned automatically to a creature if you use the script x2_spn_rndwalk for its On Spawn In script.
It says it never ends and requires a ClearAllActions for the creature to do anything else, but I've used it on hostile creatures, and it doesn't prevent them from attacking. Not sure what happens if you try to converse with one. Would it start walking again afterward or not? Or not allow you to converse?
#3
Posté 22 mai 2015 - 01:49
Setting the following local string variable on a creature will cause it to wander randomly, although it will only begin to wander when a player comes within range.
Variable name: SpawnScript
String value: gb_wanderer_sp
Creatures spawned from an encounter trigger will wander by default, and will do so as soon as they spawn (regardless of whether there are any players nearby).
#4
Posté 22 mai 2015 - 10:56
#5
Posté 25 mai 2015 - 11:06
Regards
- GCoyote aime ceci
#6
Posté 25 mai 2015 - 11:39
Things like this and the invisible fencing trigger thread scripts would be great to have in the scripts section of the Toolset Notes.
#7
Posté 26 mai 2015 - 12:47
I created my own wandering animal scripts as well. They include a check for a home waypoint and a range value, so if they wander too far from home they turn and walk back. That keeps them within a certain radius of a specified point.
If they're within their specified home range (or they don't have a home waypoint), they wander randomly. I also have them randomly utter one of three animal cries, set on them as local string variables. That way pigs will occasionally grunt, horses will whinny, and chickens will cluck (or crow in the case of roosters).
I have an additional 'timid animal' system that gives them a custom aura, so that they run from anyone not of their own faction if the intruder gets too close. It's handy for flocks of chickens. Players can walk through them and watch them scatter in panic in all directions. Once the timid animal gets a certain distance from the intruder, they go back to their normal wandering (or head back to their home waypoint if they've run too far).
Here's the wander HB script. It requires the creature to be using the gb_wanderer_sp script as an OnSpawn script (either hardcoded, or via a local 'SpawnScript' string variable):
- 4760 aime ceci
#8
Posté 27 mai 2015 - 09:54





Retour en haut






