OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: GavinP on 19 Sep 2006, 11:53:54
-
IS there a way of changeing all resistance unit's "hostile to" setting during a game?
I'm hoping that there's a simple switch that can be thrown. And yes, i know about grouping with new leaders, etc, but its going to be a monumental ache as i've got about 15 resistance groups, and i'd like them all to go hostile to west at the same time.
-
There's no other way than joining them into an east group.
Now that shouldn't be a big problem if you use a well thought loop'ed script.
Let's say you have 15 resistance groups, and each groupleader is named: r1 - r15
Now you put all those guys into an array: res_array = [r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15]
Now you need one east guy, let's name him: e1
The script should then look like this:
_i=0
#loop
_rleader = res_array select _i
[units _rleader] join e1
e1 join grpnull
_i = _i + 1
?(_i<15): goto "loop"
exit
Only thing you need to consider is that each of your resistance groups must not consist of more than 11 men.
:edit - btw - nitpicker could now answer that there's indeed another way than joining them into an east group, but
that would be e.g: let them start as west and join them into resistance group by setting resistance enemy to west from start
but it would be basically the same.
Or you could also use setCaptive but not really handy in your case.
~S~ CD
-
Depending on exactly what you are doing, a setCaptive command may help. Make Resistance not friendly, but make everybody setCaptive true at the start of the mission so they won't shoot at each other. Then, at the appropraite moment, make everybody setCaptive false.
Trigger:-
Area: whole map
Activation Box: Resistance present
Condition: Whatever you want to make everybody start shooting
On Activation: "_x setCaptive false" forEach thislist
Syntax not guaranteed.
-
Hmm, the first reply (thanks Chris Death) is pretty much the way I thought of doing it, but didn't think of doing it via a script and array.
@Macguba, what sort of effect does the setcaptive have, does it make the enemy AI crawl around all the time, as that will pretty much ruin the effect. Basically I want the resistance to be moving around as normal, ie stood up, weapons slung etc, and then at a given moment spring into action
-
Lol no they won't crawl. Make a test missionette and experiment.
If Resistance is not Friendly to East, and Resistance is setCaptive true, then East will not fire on Resistance. If East is setCaptive true as well, then Resistance will not fire on them. Other that that there isn't much effect on behaviour IIRC.