OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Evan Scown on 18 Jun 2006, 14:34:50

Title: Civilian Deathtoll
Post 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?
Title: Re: Civilian Deathtoll
Post by: THobson on 18 Jun 2006, 15:24:17
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

Title: Re: Civilian Deathtoll
Post by: Evan Scown on 18 Jun 2006, 20:23:03
And if I was doing this multiplayer style, could I change the player to a group?
Title: Re: Civilian Deathtoll
Post by: Planck on 18 Jun 2006, 21:01:57
No


Planck
Title: Re: Civilian Deathtoll
Post by: THobson on 18 Jun 2006, 21:09:29
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.
Title: Re: Civilian Deathtoll
Post by: Evan Scown on 19 Jun 2006, 02:46:47
Sweet, thankyou muchly