OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: SoldierEPilot on 24 Mar 2018, 10:53:18

Title: Resistance political opinion
Post by: SoldierEPilot on 24 Mar 2018, 10:53:18
A simple script to check out if resistance units are friendly to east, west, all or none of conflicting sides.
Title: Re: Resistance political opinion
Post by: Alex_Mercer_1479 on 14 May 2018, 15:14:41
Here is the way I did it which is addon free

TC_Guer is an array with all the resistance groups in it rest of the arrays are self explanatory

By the way what the hell is that topic name XD

Code: [Select]
_i = 0
_gg = "<None>"
_t = _time + 10

#loop1
~0.001
? _t * acctime < _time : _i = 0 ; _gg = "<None>" ; _t = _time + 5
? count TC_Guer > _i : if (count units (TC_Guer select _i) < 12) then {_gg = TC_Guer select _i} ; _t = _time + 5 ; goto "unloop1"
goto "loop1"

#unloop1
? format ["%1" , _gg] == "<None>" : _i = _i + 1 ; goto "loop1"
_j = 0
_k = 0
_wg = "<None>"
_eg = "<None>"

#loop2
~0.001
? _j == -1 and _k == -1 : TC_GD = true ; exit
? _t * acctime < _time : _i = 0 ; _gg = "<None>" ; _t = _time + 5 ; goto "loop1"
? count TC_West > _j and _j != -1 and !_gw : if (count units (TC_West select _j) < 12) then {_wg = TC_West select _j} else {_j = _j + 1}
? count TC_East > _k and _k != -1 and !_ge : if (count units (TC_East select _k) < 12) then {_eg = TC_East select _k} else {_k = _k + 1}
? format ["%1" , _wg] != "<None>" and _j != -1 and !_gw : goto "west1"
? format ["%1" , _eg] != "<None>" and _k != -1 and !_ge : goto "east1"
goto "loop2"

#west1
"SoldierGB" createunit [[1 , 1] , _gg , "TC_S1 = this ; this setpos [1 , 1 , 2500] ; removeallweapons this"]
"SoldierWB" createunit [[1 , 1] , _wg , "TC_S2 = this ; this setpos [1 , 1 , 1500] ; removeallweapons this"]
? format ["%1" , TC_S1 in units _gg] == "bool" or !(TC_S1 in units _gg) : _i = _i + 1 ; deletevehicle TC_S2 ; goto "loop1"
? format ["%1" , TC_S2 in units _wg] == "bool" or !(TC_S1 in units _gg) : _j = _j + 1 ; deletevehicle TC_S1 ; goto "loop2"
TC_S1 reveal TC_S2
TC_S2 reveal TC_S1

#west2
~0.001
? _t * acctime < _time : _i = 0 ; _gg = "<None>" ; _t = _time + 5 ; goto "loop1"
TC_S1 setpos [1 , 1 , 2500]
TC_S2 setpos [1 , 1 , 2500]
? TC_S1 countfriendly [TC_S2] == 1 or TC_S2 countfriendly [TC_S1] == 1 : TC_WvsG = 0 ; _gw = true ; publicvariable "TC_WvsG" ; _j = -1 ; deletevehicle TC_S1 ; deletevehicle TC_S2 ; goto "loop2"
? TC_S1 countenemy [TC_S2] == 1 or TC_S2 countenemy [TC_S1] == 1 : TC_WvsG = 1 ; _gw = true ; publicvariable "TC_WvsG" ; _j = -1 ; deletevehicle TC_S1 ; deletevehicle TC_S2 ; goto "loop2"
goto "west2"

#east1
"SoldierGB" createunit [[1 , 1] , _gg , "TC_S1 = this ; this setpos [1 , 1 , 2500] ; removeallweapons this"]
"SoldierEB" createunit [[1 , 1] , _eg , "TC_S2 = this ; this setpos [1 , 1 , 1500] ; removeallweapons this"]
? format ["%1" , TC_S1 in units _gg] == "bool" or !(TC_S1 in units _gg) : _i = _i + 1 ; deletevehicle TC_S2 ; goto "loop1"
? format ["%1" , TC_S2 in units _eg] == "bool" or !(TC_S1 in units _gg) : _k = _k + 1 ; deletevehicle TC_S1 ; goto "loop2"
TC_S1 reveal TC_S2
TC_S2 reveal TC_S1

#east2
~0.001
? _t * acctime < _time : _i = 0 ; _gg = "<None>" ; _t = _time + 5 ; goto "loop1"
TC_S1 setpos [1 , 1 , 2500]
TC_S2 setpos [1 , 1 , 2500]
? TC_S1 countfriendly [TC_S2] == 1 or TC_S2 countfriendly [TC_S1] == 1 : TC_EvsG = 0 ; _ge = true  ; publicvariable "TC_EvsG" ; _k = -1 ; deletevehicle TC_S1 ; deletevehicle TC_S2 ; goto "loop2"
? TC_S1 countenemy [TC_S2] == 1 or TC_S2 countenemy [TC_S1] == 1 : TC_EvsG = 1 ; _ge = true  ; publicvariable "TC_EvsG" ; _k = -1 ; deletevehicle TC_S1 ; deletevehicle TC_S2 ; goto "loop2"
goto "east2"