OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: schuler on 05 Jul 2008, 10:28:20

Title: [solved]Text when player kills a civi
Post by: schuler 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
Title: Re: Text when player kills a civi
Post by: Spooner 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;