Jump to content
Sign in to follow this  
Javito1986

Group members being killed

Recommended Posts

Well, here's the deal. Creating an SP/MP mission that'll involve some infantry action. As we all know infantry actions generally result in casualties. The protagonist in my mission happens to have a friend working in his squad... say the machine gunner, soldier #2. What I want is, in case #2 is killed, some kind of acknowledgement in the form of the white text on screen saying for example "Johnson was killed!".

I tried naming him to soldier1 and setting a getdammage trigger, but after running a test (I shot him in the head) it didn't seem to work. Anyone know how to do this?

Share this post


Link to post
Share on other sites

You could add an eventhandler to each member of the group, in the groupleaders init field put:

"_x addEventHandler [""Killed"", {(leader playergroup) sidechat format [{%1 was killed},name (_this select 0)]}]" forEach units group this; playergroup = group this

Edit: Tested and fixed mistake

RED

Share this post


Link to post
Share on other sites

Thank you, that works fine. Only trouble is that it does it for every member of the squad when they're killed. Forgive my scripting ignorance, but how can I change that to make it so it only acknowledges ONE of their deaths? Say for instance I name my Machine Gunner, number 2 in my squad, Beavis. Can I change that script so that it says "Beavis was killed!" when my MG gunner is killed only?

Share this post


Link to post
Share on other sites

make a trigger:

Condition: NOT alive beavis

Activation: Mydude sidechat "Oh no, Johnson is down!"

Share this post


Link to post
Share on other sites

Put this in the machine gunner's init field:

this addEventHandler ["Killed", {player sidechat "INSERT MESSAGE HERE"}]

That is basically what Red gave you, but his line of code applied that to everybody in the group, but you just want it on the one guy.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×