Home   Help Search Login Register  

Author Topic: [solved]Text when player kills a civi  (Read 1069 times)

0 Members and 1 Guest are viewing this topic.

Offline schuler

  • Contributing Member
  • **
[solved]Text when player kills a civi
« on: 05 Jul 2008, 10:28:20 »
Hello,
How can I get text to show when any civilian in the mission is killed by the player?
Text would be "Sir I think we just killed a civilian!"
Cheers schuler

edit thanks spooner
« Last Edit: 08 Jul 2008, 12:05:40 by schuler »
Semper Fi

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Text when player kills a civi
« Reply #1 on: 05 Jul 2008, 18:24:44 »
The simplest way is this, by editing each civilian's init. This doesn't care who killed the civilian, so it would pick up the civilian being run over, for example (when the killer is objNull):
Code: (each civilian init) [Select]
this addEventHandler ["KILLED", { player sideChat "Sir, I think we just killed a civilian!" }];

If you have many civilians in the mission, then you might be better using a large trigger to add that code to every civilian (this doesn't add the handler to vehicles, but does add it to all passengers):
Activation: CIVILIAN PRESENT ONCE
Condition: this
Code: (On Act) [Select]
{ { _x addEventHandler ["KILLED", { player sideChat "Sir, I think we just killed a civilian!" }]; } forEach (crew _x) } forEach thisList;
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)