Bahger 10 Posted March 29, 2013 I'm using this wonderful script in the unit's init field to randomise the placement of a hostage: if isserver then { private ["_pos","_arr"]; _arr = [[3460.97,3589.02,19.0014],[3449.96,3595.83,19.0014],[3445.34,3612.19,19.0014]]; _pos = _arr select floor random count _arr; this setposasl _pos; }; The array being a list of precise positions in buildings on the map. It works beautifully to randomise the location of my civilian hostage, but only when there are no OPFOR guards in close proximity. Once I placed OPFOR men who are guarding the hostage, when previewing the mission (playing as an OPFOR unit), the hostage starts in the right, randomized, location but after about half a minute, possibly in reaction to my entering the room he's in, flees to the location I placed him in before I added the above script to his init field. I have tried the following commands in his init field to get him to stay put: dostop this disableAI "MOVE" unit allowfleeing 0 but none of them stop the fleeing behavior. In desperation, I used DisableAI, which worked BUT it meant that the script I'm using to enable the player (rescuer) to take command of the hostage and have him follow, is also disabled; the hostage is prevented from all movement. Maybe there's a way to re-enable the hostage's AI when, say, all the guards are dead, or the player is within a certain proximity? I'm out of ideas, gents. This is a promising mission but this glitch has set it back enormously and I'd really appreciate your guidance. Thanks. Share this post Link to post Share on other sites
nikiller 18 Posted March 29, 2013 hi, You could try enableAI to enable the move part of the AI when the the guard is dead. example: hostage1 enableAI "Move" Or you could try to set the hostage side the same as the player and use the setCaptive in its init field. example: this setCaptive true cya. Nikiller. Share this post Link to post Share on other sites
Messiah 2 Posted March 29, 2013 Just to rule it out, you are replacing 'unit' with 'this' or the unit's name for allowfleeing? Share this post Link to post Share on other sites
Bahger 10 Posted March 29, 2013 (edited) Thanks for your help, guys. After thinking this allowFleeing 0 would work, it didn't; the hostage's courage broke when in proximity to a loud firefight and off he fled, never to be found again, or at least involving the player in a tedious wild goose chase. The only way I could jury-rig the hostage not to flee was with the lobotomising this disableAI "Move", re-enabling AI movement again for the unit by trigger once all OPFOR units in the trigger zone were dead. A bit of a kludge, but it's more than made up for by the fantastic random placement process I found. Now he stays put but when the player finds him, despite the disable AI "Move", he needs to take control of the hostage (another script) and issue a "Stop" order because if he leaves the hostage and is elsewhere when OPFOR is eliminated, the hostage will take off again like a jackrabbit and will need to be chased so that he can be put under the player's command (3m radius per script). Thanks for your help, guys. I wish this allowFleeing 0 meant just that, but it does not. Edited March 29, 2013 by Bahger Share this post Link to post Share on other sites
madrussian 347 Posted March 6, 2015 One way to immediately stop units from fleeing (then optionally allow the units to flee again straight away or not, as desired) is detailed over here. It works great in my missions. Share this post Link to post Share on other sites