Jump to content
Sign in to follow this  
carlostex

How to know if an object was destroyed by a unit?

Recommended Posts

I kinda need a code that returns the name of the player that destroyed a particular object or other unit. This is for MP and it would be to know the name of the player that killed or destroyed that unit or object. It could be by a hint text. I think this can be done with eventhandler but i don't know how to write this code. My scripting abilities are null.

Share this post


Link to post
Share on other sites
My scripting abilities are null.

That can make things difficult. Try to learn scripting, it's fun and not as hard as hard as you may think!

Anyway, this should work without any external scripting if you add it to each units initialization:

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

EDIT: oh wait you said you needed it in MP. Getting the message to transmit over multiplayer is a different matter, but I'm sure it's possible. It'll run on the same basic principle of using "killed" eventhandlers.

Edited by RKDmitriyev
oops

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  

×