Results 1 to 3 of 3

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

  1. #1

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

    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.

  2. #2
    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:

    Code:
    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.
    Last edited by RKDmitriyev; Mar 5 2011 at 19:26. Reason: oops

  3. #3
    Master Sergeant CarlosTex's Avatar
    Join Date
    Aug 23 2010
    Location
    Portugal
    Posts
    667
    Author of the Thread
    Tried it with MPEventhandler. Works great thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •