OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: prodetar2 on 15 Jun 2007, 20:58:11
-
Hey people, ive been busy lately trying to get the hang of ofp scripting but im stuck atm.
im now trying to let a group of soldiers surrender to you when you kill one of them (as a test)
now what i need to know is: what command do i use (even when the soldiers are not in the same group)
i now have a trigger with (anyuthing in () is not working from what i know... error reports flood in then):
condition: (eachunit = thislist) ;not alive east1
onactivation: (foreachunit east switchmove "FXStandSur")
now what did i do wrong? probably everything but hey, i aint learning for nothing ;)
i tried searching the forum but i only got hits from stuff i could not understand very well.. so can anyone assist? thnx ahead ;)
(if this has been asked before could someone add a link to that thread? thnx)
-
the idea is sound, it's just the syntax that's a bit skee-wiff. first you need to know how many units are in the surrendering group. then you can use the trigger:
condition: (({alive _x} count units enemy_group) < number_of_units)
on activation: {_x switchmove "FXStandSur"} foreach units enemy_group
naturally, you replace enemy_group with the name of the surrendering group, and number_of_units with the original number in the group (before one is killed). you might also want to put a pause in the trigger (put something like 3 in each of the three 'countdown' boxes - it may be that the loon you kill tries to surrender too if the trigger fires immediately.
experiment a little - you're on the right track :good:
-
ok thnx for reply. now a small question about group id.
how do i name a group?
something like group1 = thisgroup??
thnx ahead :)
-
in the init box of the group leader type
group_name = group this
-
hey thx it all works :) but now another thing.. they all surrender when 1 unit of the group is dead. do i need to change the < number_of_units) in order to make sure they surrender after like... 4 dead team mates??
thnx again ;) :D
-
looking at the condition line -
(({alive _x} count units enemy_group) < number_of_units)
the first bit - ({alive _x} count units enemy_group) gives the number of units in the group who are still alive. number_of_units is the original size of the group before anyone is killed. so if you only want the trigger to fire after 4 (or more) units have been killed, the condition would read
(({alive _x} count units enemy_group) <= (number_of_units - 4))