• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

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

Status
Not open for further replies.
Level 4
Joined
Jul 18, 2008
Messages
76
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?

Thanks
 
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).
 
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.
 
Status
Not open for further replies.
Back
Top