• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Add money to the enemy when he kills you (not from yourself) ?

Level 5
Joined
May 8, 2020
Messages
78
I have a command to kill my own hero or if they use it to kill their hero.
I use : -kill (to kill my own champion) and they can do the same
So
How to when enemy general (or their mirror iimage) kills me will receive money Or vice versa, so am I ?
I will be deducted about 5000 gold when killed by an enemy.
Or -7000 gold when killed by Neutral Hostile
Allies will get -1000 gold when trying to kill me.
To avoid them using the spam kill command to increase their own money
 
Level 14
Joined
Jan 24, 2017
Messages
246
If you check if the unit was killed by a unit you know it was not done by your command.
After that you can check if the killing unit is an enemy of the dying unit. And give gold according to that. I did not completly understand who should lose how much gold exactly.
  • Unit Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Killing unit) Not equal to No unit
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Killing unit)) Equal to Neutral Hostile
        • Then - Actions
          • Player - Add -7000 to (Owner of (Dying unit)).Current gold
          • Skip remaining actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Killing unit) belongs to an enemy of (Owner of (Dying unit)).) Equal to True
        • Then - Actions
          • Player - Add -5000 to (Owner of (Dying unit)).Current gold
          • Skip remaining actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Killing unit) belongs to an ally of (Owner of (Dying unit)).) Equal to True
        • Then - Actions
          • Player - Add -1000 to (Owner of (Killing unit)).Current gold
        • Else - Actions
 
Last edited:
Level 25
Joined
Sep 26, 2009
Messages
2,381
I think it could work by adding this to the trigger that fires when you write the '-kill' command:
  • Set VariableSet KilledByCommand = True
  • Unit - Kill <selected_hero>
  • Set VariableSet KilledByCommand = False
and in the second trigger just validate the boolean variable's value:
  • Unit Dies
    • Events
      • Unit - A unit Dies
    • Conditions
      • KilledByCommand Equal to False
    • Actions
      • //your actions
 
Top