Jump to content
Sign in to follow this  
VanhA-ICON

Who shot him?

Recommended Posts

Hi.

I was wondering is there a way of using eventhandlers or such in a way that one can display a message which player shot a target?

Just to let know who failed/succeeded in a task

Share this post


Link to post
Share on other sites

I think that should be possible.

Share this post


Link to post
Share on other sites

the "Hit" eventhandler does that, but currently might be broken. There's a fix coming for that.

Share this post


Link to post
Share on other sites
the "Hit" eventhandler does that, but currently might be broken. There's a fix coming for that.

cond: !(alive target)
onact: player addEventHandler ["killed",target,(name player)];

?

something like this?

(I suck at scripting, sorry)

Share this post


Link to post
Share on other sites

In the target's init:

this addEventHandler ["killed", "hint format['Killed by %1',_this select 1]"]

Share this post


Link to post
Share on other sites

Search Armaholic for Mr Murray's editing guide.

A further great example is the textmessage which displays the information who killed

who. This option is a special feature espacially for the Multiplayer games. The

Eventhandler needs to be given to all units which are dedicated to. The Syntax looks as

follows:

{_x addEventHandler ["Killed", {hint format["%1 killed by%2",

_this select 0, _this select 1]}]} foreach [s1, S2, S3, S4]

Which should be good enough for a base for whatever you need doing.

Share this post


Link to post
Share on other sites

Cool Kylania,

If I named the enemy say "Boss", how would I get a hint to say, "Boss was killed by <playername>"?

Please.

Share this post


Link to post
Share on other sites

this addEventHandler ["killed", "hint format['%1 killed by %2',_this select 0, _this select 1]"]

I'd use that since it's more generic.

Basically put that in some unit's init and it will say "Unitname killed by Killername" when it's killed. That way you don't need to hardcode it.

Now, you will want to give it a human readable name, like "Boss" rather than "b1" or something. :)

Share this post


Link to post
Share on other sites

Hey VanhA,

I tried to steal your idea and implemented the above code in a CWR mod mission I made. It worked fine as long as you were squad leader. When a non squad leader you don't see the messages for some reason

I used this code

this addEventHandler ["killed", "hint format['%1 killed by %2',_this select 0, _this select 1]"]

It was entertaining as I used silly names for all the AI that were shot, like I say worked well. I tried several different things but just couldn't get it working for all squad members, only the squad leader seen who shot who. It worked also on buildings I set as objectives to destroy, agin though only seen by the squad leader. Cheers all to posted on this it is a nice thing to use.

As per am I dong something wrong?

Edited by JTF-2 Psycho

Share this post


Link to post
Share on other sites

Might be some locality thing maybe, was this on a server or local on your PC?

Share this post


Link to post
Share on other sites

Although it's local command, maybe using this could solve it:?

"publicThis" addPublicVariableEventHandler

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  

×