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

[Trigger] Absorb Mana Ability

Status
Not open for further replies.
hi, I have a problem with some triggers.
When a tower's mana reaches below the mana costs of the ability the tower has, then it should use the ability of the undead destroyer: Absorb mana.
The Tower should cast it on a manatower near it. Now when the tower's mana reaches below the mana costs of the ability, it seems that the tower uses the ability, but it doesn't. Just the ability icon is shown with a green border (as always, if a unit casts an ability), but the tower doesn't get the mana of the manatower.

Here is my trigger:
  • Fireball Ac
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Attacking unit)) Equal to Fireball
          • (Unit-type of (Attacking unit)) Equal to Fireball Lvl 2
          • (Unit-type of (Attacking unit)) Equal to Fireball Lvl 3
          • (Unit-type of (Attacking unit)) Equal to Fireball Lvl 4
          • (Unit-type of (Attacking unit)) Equal to Fireball Lvl 5
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Mana of (Attacking unit)) Greater than or equal to 5.00
        • Then - Actions
          • Unit - Order (Attacking unit) to Neutral - Firebolt (Attacked unit)
        • Else - Actions
          • Set temppoint[1] = (Position of (Attacking unit))
          • Set tempgroup[1] = (Units within 1000.00 of temppoint[1] matching ((Owner of (Matching unit)) Equal to (Owner of (Attacking unit))))
          • Set tempreal[1] = 0.00
          • Unit Group - Pick every unit in tempgroup[1] and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • (Unit-type of (Picked unit)) Equal to Lesser Manacrystal
                      • (Unit-type of (Picked unit)) Equal to Manacrystal
                      • (Unit-type of (Picked unit)) Equal to Stronger Manacrystal
                  • (Mana of (Picked unit)) Greater than tempreal[1]
                • Then - Actions
                  • Set tempreal[1] = (Mana of (Picked unit))
                  • Set tempunit[1] = (Picked unit)
                • Else - Actions
          • Unit - Order (Attacking unit) to Undead Destroyer - Absorb Mana tempunit[1]
          • Custom script: call RemoveLocation(udg_temppoint[1])
          • Custom script: call DestroyGroup(udg_tempgroup[1])
attachment.php


But if I cast it manually, it works.
And the tempreal[1] should search the manatower with the most mana. (I tried it with 1 random unit in tempgroup[1] but it doesn't work, too)
Hope someone can help me.
 

Attachments

  • Mana Absorb.jpg
    Mana Absorb.jpg
    62 KB · Views: 306
Level 37
Joined
Mar 6, 2006
Messages
9,240
The order might be overridden by the tower's normal AI. I mean, the trigger orders it to cast the mana absorption spell, but the game code tells it to normally attack the unit after it gets the mana absorption order.

I suggest you try to troubleshoot it with the following trigger:
  • Events
  • Unit is issued an order targeting a unit
  • Conditions
  • Triggering unit equal to your unit
  • Actions
  • Create floating text overhead of triggering unit <convert order to string>
  • Set velocity...
  • Set life span...
  • Disable permanence
With this you can see what orders it gets.
 
Last edited:
Status
Not open for further replies.
Top