Page 1 of 1

Prevent Squad from Leaving Map

Posted: 16 Jan 2018, 10:40
by DoctorX
Looking for a way to "trap" a spawned squad on the current map.

Basically, I spawn the squad at a smart, and they are free to move from smart to smart on the map they are on, but they are forbidden from travelling to another map.

I have a few ideas for some convoluted hacky ways to achieve this, just wondering if there is a more elegant solution.

Re: Prevent Squad from Leaving Map

Posted: 18 Jan 2018, 00:20
by luppolo
can only think of these

-make a squad_on_update callback that checks if the assigned_target_id is a smart in the same map and if not picks a random one
-edit alun_utils.assign_squad_to_smart to do the same as above, this may be better since it seems most of the assigned_target_id changes are done through this function and won't do the check each tick but only when the squad actually decides/gets told the new smart