OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Ace on 15 Jan 2006, 14:58:36
-
OK, I have only just started scripting again after several years out of the game... So rusty as hell, and I probaly need you to hold my hand through some of the explanations. ;)
Basically a quick synopsis of what I want to happen:
West side, Resistance, and East are all fighting each other (You are lone east soldier) at the end of a battle between the 3 sides if West and Resistance are all dead, and you are close to any surviving East soldiers - you join and lead them.
So far I have developed the following script, which isn't quite working:
;alldead.sqs script PROBLEMS WITH CHECKING IF GROUPS ARE ALIVE!!!! MSUT FIX
#start
;check to see if there's any east guys left alive, otherwise exit the script
? (alive eastgr1 or alive E1_2 or alive E1_3 or alive E1_4 or alive E1_5 or alive E1_6 or alive E1_7 or alive E1_8 or alive E1_9) : goto "Check"
exit
#check
;check the area triggers to see whether any west or res soldiers still alive in area
? (westdead == 1) and (resistancedead == 1) : hint "All enemies here are dead", goto "alldead"
? (westdead == 0) and (resistancedead == 1) or (westdead == 1) and (resistancedead == 0) : goto "Start"
#alldead
;find the position of the player, and his comrades, and if he is close enough he will join them
getpos player = PlayerPos
"getpos" ForEach (units group eastgr1) = EastGr1Pos
? (player distance "EastGr1Pos" < 30) : Player join eastgr1
exit
Much obliged to anyone who could help me out, If I wasn't so in love with myself I'd start tearing my beutiful sexy hair out. :D
-
Create three triggers that cover the map
1. East Present call it trig_AllEast
2. West Present call it trig_AllWest
3. Resistance present call it trig_AllRes
A few seconds after the start of the mission run a script that does the following:
East_loons = []
{{if (alive _x) then {East_loons = East_loons + [_x]}} forEach crew _x} forEach (list trig_AllEast) - [player]
West_loons = []
{{if (alive _x) then {West_loons = West_loons + [_x]}} forEach crew _x} forEach list trig_AllWest
Res_loons = []
{{if (alive _x) then {Res_loons = Res_loons + [_x]}} forEach crew _x} forEach list trig_AllRes
I presume the player is East as he is going to lead them.
The arrays
XXX_loons contain a list of all the two legged units (not vehicles) on side XXX that start the mission (except the player)
The condition for all west and all resistance dead is:
{alive _x} count (West_loons + Res_loons) < 1
The condition for the player being near (< 50) at least one living east units is:
{(alive _x) and (player distance _x < 50)} count East_loons > 0
To get these loons to join the player:
{if ((alive _x) and (player distance _x < 50)) then {[_x] join player}} forEach East_loons
So you could have a trigger that has the following condition field:
{alive _x} count (West_loons + Res_loons) < 1
and has the following activation field:
{if ((alive _x) and (player distance _x < 50)) then {[_x] join player}} forEach East_loons
Or you could do it with a script that loops getting east units to join the player as he moves close to them and stops when he has a group of 12.
-
ah OK I see how you did it. Thank you very much.
I'm at work right now so I can't test and see, but I'll try it tonight, cheers.
-
hey i found one mistake
alldead.sqs script PROBLEMS WITH CHECKING IF GROUPS ARE ALIVE!!!! MSUT FIX
Msut = must ;D