• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Editing the Charm Spell with triggers? {killing the last charmed unit}

Not open for further replies.
Level 4
Jul 18, 2008
Hey, ive been trying to edit the charm spell with triggers but without succes.. Can you help me?

I want it to only be possible to charm one creep, meaning if another creep is charmed, the previous dies.

I didnt think it would be that hard to create, i just didnt succeed.. Any ideas?

Level 18
Jan 21, 2006
Well you'll need a variable to store the unit that is currently charmed.

Then, when a unit starts the effect of the ability Charm, you'll check whether the "stored" unit is equal to "No unit" or is dead. If either of these conditions are true, then the new unit can be stored in that variable without any other work.

If there is a unit currently "occupying" the variable, then you'll need to kill it (or kill the new one, whichever).
Level 8
Jan 8, 2010
with Berbanog's idea, here's a trigger.
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Charm
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Or - Any (Conditions) are true
          • Conditions
            • CharmUnit Equal to No unit
            • (CharmUnit is dead) Equal to True
      • Then - Actions
        • Set CharmUnit = (Target unit of ability being cast)
      • Else - Actions
        • Unit - Kill CharmUnit
        • Set CharmUnit = (Target unit of ability being cast)
CharmUnit is the charmed unit.
Not open for further replies.