Home   Help Search Login Register  

Author Topic: Civilian Deathtoll  (Read 1131 times)

0 Members and 1 Guest are viewing this topic.

Offline Evan Scown

  • Members
  • *
Civilian Deathtoll
« 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?

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re: Civilian Deathtoll
« Reply #1 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

« Last Edit: 18 Jun 2006, 15:39:14 by THobson »

Offline Evan Scown

  • Members
  • *
Re: Civilian Deathtoll
« Reply #2 on: 18 Jun 2006, 20:23:03 »
And if I was doing this multiplayer style, could I change the player to a group?

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re: Civilian Deathtoll
« Reply #3 on: 18 Jun 2006, 21:01:57 »
No


Planck
I know a little about a lot, and a lot about a little.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re: Civilian Deathtoll
« Reply #4 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.
« Last Edit: 18 Jun 2006, 22:05:00 by THobson »

Offline Evan Scown

  • Members
  • *
Re: Civilian Deathtoll
« Reply #5 on: 19 Jun 2006, 02:46:47 »
Sweet, thankyou muchly