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

[Solved] Maintaining spells on upgraded units

Status
Not open for further replies.
Level 5
Joined
Jan 23, 2020
Messages
86
Issue: I have a TD map with a trigger that adds a total of 24 spells to targeted units. However once a unit is upgraded it looses the spell.

Workaround: I linked the spell to a custom unit number, and classify the spell with spell priority numbers, so that it "saves" the spell and the upgrading unit, keeping the spell on it.
However, this is not foolproof and sometimes the spell is still lost during/after an upgrade.

I could probably do it with hashables or something but I am not too familiar with them, and could use some help!

Triggers:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Ability being cast) Equal to Phased Frenzy
    • Then - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering player) Current lumber) Greater than or equal to 100
        • Then - Actions
          • Player - Set (Owner of (Triggering unit)).Current lumber to (((Owner of (Triggering unit)) Current lumber) - 100)
          • -------- --------
          • Unit - Add Phased Frenzy (Icon) to (Target unit of ability being cast)
          • -------- --------
          • Set VariableSet AN = (Custom value of (Target unit of ability being cast))
          • Set VariableSet AbilityInt[AN] = (Ability: (Unit: (Target unit of ability being cast)'s Ability with Ability Code: Phased Frenzy (Icon))'s Integer Field: Priority for Spell Steal ('apri'))
          • Set VariableSet ShardUnit[AbilityInt[AN]] = (Target unit of ability being cast)
          • Set VariableSet ShardAbility[AbilityInt[AN]] = Phased Frenzy (Icon)
        • Else - Actions
    • Else - Actions

  • UpgradeSpell
    • Events
      • Unit - A unit Finishes an upgrade
    • Conditions
    • Actions
      • Set VariableSet AN = (Custom value of (Triggering unit))
      • For each (Integer AbilityInt[AN]) from 1 to 24, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering unit) Equal to ShardUnit[AbilityInt[AN]]
            • Then - Actions
              • Unit - Add ShardAbility[AbilityInt[AN]] to (Triggering unit)
            • Else - Actions
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,576
Have you tried making the abilities permanent?

See Pyrogasm's post:
 
Status
Not open for further replies.
Top