OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Evan Scown on 18 Jun 2006, 14:34:50
-
Ok I want to set an objective to fail if a certain group kills too many civilians...is this doable?
-
Yes. Give each of the civilians a killed event handler that increments a counter then check the counter.
Create a file called init.sqs
in it put
CiviDead = 0
then if you don't have too many civis put the following in the init field of each
this AddEventHandler [{killed},{if ((_this select 0) == player) then {CiviDead = CiviDead + 1}}]
Create a trigger that has the following condition line:
CiviDead >= 15
and the following activation line:
hint format["You fool you have killed %1 civilians",CiviDead];"0" objStatus"FAILED"
Assuming object 0 is the one you are dealing with.
If you have a lot of civials then set up a trigger that covers the map and detects civis - bear in mind that empty vehicles as seen as civilians so you need to ensure you only detect civis of the two legged variety. Then use the trigger to give each the event handler
-
And if I was doing this multiplayer style, could I change the player to a group?
-
No
Planck
-
I have re-read your question. It is not the player you are concerned about but a 'certain group'.
Try this instead:
this AddEventHandler [{killed},{if ((_this select 0) in units groupname) then {CiviDead = CiviDead + 1}}]
Where groupname is the name given to the particular group.
-
Sweet, thankyou muchly