Jump to content
Sign in to follow this  
-Snafu-

Random allowFleeing

Recommended Posts

I'm making a small COOP mission where a couple of civs have been taken hostage by a low level group of insurgents. Since they're low level I don't want them to fight to the death but want the possibility of some them surrendering so we can make use of ACE handcuffs. I've added the surrender module and I know it kicks in when units flee which is controlled by allowFleeing. Simple enough to change that value, however, I want this value to be randomised between two values such as 0.3-1 and for that value to be the same for everyone.

How would I go about doing this? I'm new to scripting but I would like to learn a bit by doing this and it would be great if someone could point me in the right direction.

Share this post


Link to post
Share on other sites

Not tested, this would random it for every unit in the group, init line of any unit in the group.

{_x allowFleeing (0.3 + (random 0.7))} forEach units (group this);

Otherwise you'd have to define a variable for the random value, maybe a trigger with condition true and in the on act:

TAG_randFlee = (0.3 + (random 0.7)); (group myUnit) allowFleeing TAG_randFlee; (group myUnit2) allowFleeing TAG_randFlee; 

The closer allowFleeing is to zero, the more courage the units have.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×