Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
Carpaazi

Trigger to check if civilian in area has died ?

Recommended Posts

Hey all!

I have been making missions since OFP but im so noob making my own trigger conditions and scripts...

I need a trigger or a list or a script or whatever, to check if civilian got killed in a certain area and make players rating drop.

I am using the "ambient civilian module" and like you know, it creates the civilians from buildings in towns, and i need a trigger etc that somehow check them, and maybe another trigger to determine if some of those civilians died, and even better if u can tell me how the trigger can see if the civilian got killed by a player (or some of the players in MP) or certain side =)

I tried to google it many times but didnt find anything that works, so all examples are welcome and appreciated!

Share this post


Link to post
Share on other sites

Hi,

i'm not familiar with MP questions (such as locality of EH), but i would add a killed eventhandler to the civilians, with a trigger covering the whole area (and a delay waiting for the civilians being spawned by the ACM). If the trigger is activated by civilians, present, once, add this in the on activation line of it :

{_x addeventhandler [{killed},{_this select 0 addrating -10000}]} foreach thislist

Share this post


Link to post
Share on other sites

Thank you for your reply.

This code kicks in as soon as the delay time has passed, and it seems to add the eventhandler to the civilians. Now i need to know how i can detect the fact that civilian died and leader player/HQ uses groupchat/sidechat to say something?

Nutshell: Civilian dies, players get a yell from "leader players" or HQ, and rating drops

Edited by Carpaazi

Share this post


Link to post
Share on other sites
Thank you for your reply.

This code kicks in as soon as the delay time has passed, and it seems to add the eventhandler to the civilians, but i still need something to detect if some of those civilians listen by this code got killed =).

I was thinking if i make a trigger that makes a list of the civilians in the area and give that list its own name, like civies1, and change this code of yours a bit, like this:

{_x addeventhandler [{killed},{_this select 1 addrating -10000}]} foreach list civies1

Could i now somehow detect in a trigger that a "member" of the list civies1 has died?

Hi,

first of all i made a mistake, _this select 0 returns the object that died, and _this select 1 the killer. So you should use _this select 1 addrating -10000.

second, yes you can :bounce3:, just use a variable that is set to true once a civilian is killed.

For example :

{_x addeventhandler [{killed},{_this select 0 addrating -10000;civilian_killed=true}]} foreach list civies1

Then, make a trigger, repeatable, with

civilian_killed

as condition (instead of "this".)

Finally, set the variable to false once the trigger is fired to be able to check it again, so in the "on activation line", put :

civilian_killed=false

Share this post


Link to post
Share on other sites

I made a trigger that covers the (town area -> civilian -> present -> once -> named it civies1) and added the "{_x addeventhandler [{killed},{_this select 0 addrating -10000;civilian_killed=true}]} foreach list civies1" line on the activation. Then i made another trigger (none -> present -> repeatedly -> condition = civilian_killed -> activation = civilian_killed=false) and put a (;hint "died") on the end of the activation

i waited until the 1st trigger kicks in, then i killed a civilian, but my hint won't say anything... seems that nothing happens when i kill a civilian listen in civies1.

Don't give up on me here mate xD

Btw the way, you said:

first of all i made a mistake, _this select 0 returns the object that died, and _this select 1 the killer. So you should use _this select 1 addrating -10000.

...should the 0/1 to be changed at the

...this select 0 addrating -10000...

part or something?

Edited by Carpaazi

Share this post


Link to post
Share on other sites

Ok ok, seems that some syntax has changed so :

the code you must put in the first trigger is (copy and paste it) :

{_x addeventhandler ["killed","_this select 1 addrating -10000;civilian_killed=true"]} foreach list civies1

And it should work (it works for me, just tested it).

Share this post


Link to post
Share on other sites

Seems to work just fine =)

Thank you very much for this!

Share this post


Link to post
Share on other sites
Sign in to follow this  

×