• 🏆 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!

[Solved] How to trigger this

Status
Not open for further replies.
Level 7
Joined
May 28, 2011
Messages
101
I want to make it so whenever the player kills a unit, all nearby player units will get mana. For now i can make it so if the player or its allies kills any unit, it will give mana to all nearby units. Here is my problem: I want it to only give mana, if the killed unit is an enemy of the player. He may not get mana by killing his allies or his own units. Here is my try:
  • Mana Consumption
    • Events
      • Unit - A unit Dies
    • Conditions
      • Kael_Thas Equal to 1
    • Actions
      • Player Group - Pick every player in (All enemies of (Owner of (Killing unit)).) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Dying unit)) Equal to (Picked player)
            • Then - Actions
              • Unit - Move Mana Caster 0287 <gen> instantly to (Position of (Dying unit))
              • Unit - Order Mana Caster 0287 <gen> to Undead Obsidian Statue - Spirit Touch.
            • Else - Actions
I don't know how to make the game understand that it has to be an enemy of the player. This pick player thing doesn't work.
 
You can check "if (Killing unit) Not Equals (No unit)" to ensure there's a killer.
You can make a Boolean Comparison to check "if (Owner of (Killing unit ))" is an enemy of "(Owner of (Dying unit))".

"PickUnitsInRangeAndDoActions" of position of dyning unit, and make actions with "(Picked Unit)".
A PlayerComparison can be done here, inside the "PickUnitAndDoActions", to ensure "(Owner of (Picked unit))" Equals "(Owner of (Dying unit))".
 
Status
Not open for further replies.
Top