• 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.

[Trigger] I need help with my flaming shield!

Status
Not open for further replies.
Level 4
Joined
Jun 22, 2009
Messages
63
it's a spell that creates a dummy around the caster, attacking all attacking units of caster

Flaming Shield
Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to Flaming Shield
Actions
Set Flamingcaster = (Casting unit)
Set Flaming_Shield_Level = (Level of Flaming Shield for Flamingcaster)
Unit - Create 1 Flaming Shield for (Owner of Flamingcaster) at (Position of Flamingcaster) facing Default building facing degrees
Set FlamingShield = (Last created unit)
Unit - Pause Flamingcaster
Animation - Play Flamingcaster's spell animation
Wait 2.00 seconds
Unit - Unpause Flamingcaster
Trigger - Turn on Flaming Shield attack <gen>
Trigger - Turn on Flame Shield follow caster <gen>
Wait (10.00 x (Real(Flaming_Shield_Level))) seconds
Trigger - Turn off Flaming Shield attack <gen>
Trigger - Turn off Flame Shield follow caster <gen>
Unit - Remove FlamingShield from the game


Flaming Shield attack
Events
Unit - A unit Is attacked
Conditions
(Attacked unit) Equal to Flamingcaster
Actions
Unit - Cause FlamingShield to damage (Attacking unit), dealing (20.00 x (Real(Flaming_Shield_Level))) damage of attack type Magic and damage type Fire
Sound - Play Incinerate1 <gen> at 100.00% volume, located at (Position of FlamingShield) with Z offset 0.00
Trigger - Turn off (This trigger)


Flame Shield follow caster
Events
Time - Every 0.10 seconds of game time
Conditions
Actions
Trigger - Turn on Flaming Shield attack <gen>
Unit - Move FlamingShield instantly to (Position of Flamingcaster)

Spell is based on Avatar
 
Level 3
Joined
Apr 29, 2009
Messages
32
Please try to use the
  • tag. This makes it easier for us to see your trigger(s).
  • A problem with your trigger is that this way it only works for 1 Unit. Since if somebody else casts the same ability before the first ability's durations wear off some of the variables will recieve new data.
  • I'd use three triggers to do this spell (didn't mention the initial trigger):
  • [TRIGGER]Flaming Shield Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Flaming Shield
    • Actions
      • Unit Group - Add (Triggering unit) to FlamingShieldUG
      • Set AbilityLevel = (Level of Animate Dead for (Triggering unit))
      • Hashtable - Save (10 x AbilityLevel) as (Key FlamingShieldDuration) of (Key (Triggering unit)) in Hashtable
      • Hashtable - Save (20.00 x (Real(AbilityLevel))) as (Key FlamingShieldDamage) of (Key (Triggering unit)) in Hashtable
Registers the damage that should be done, and the duration of the ability.
  • Flaming Shield Continue or End
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
      • (Number of units in FlamingShieldUG) Greater than 0
    • Actions
      • Unit Group - Pick every unit in FlamingShieldUG and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Load (Key FlamingShieldDuration) of (Key (Picked unit)) from Hashtable) Equal to 0
            • Then - Actions
              • Unit Group - Remove (Picked unit) from FlamingShieldUG
            • Else - Actions
              • Hashtable - Save ((Load (Key FlamingShieldDuration) of (Key (Picked unit)) from Hashtable) - 1) as (Key FlamingShieldDuration) of (Key (Picked unit)) in Hashtable
Incase the duration has ended the unit gets removed from the Unit-Group making sure the ability no longer effect the unit otherwise the duration just goes down by 1 second.

The last trigger makes the damage:
  • Flaming Shield Damage
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Triggering unit) Equal to (Random unit from FlamingShieldUG)
    • Actions
      • Unit - Set life of (Attacking unit) to ((Life of (Attacking unit)) - (Load (Key FlamingShieldDamage) of (Key (Triggering unit)) from Hashtable))
And please try not forget the initial trigger that creates the hashtable.
  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Hashtable = (Last created hashtable)
Used variables:
Hashtable - Hashtable Variable
AbilityLevel - Integer Variable
FlamingShieldUG - Unit-Group Variable

Hope this helped!
 
Last edited:
Level 3
Joined
Apr 29, 2009
Messages
32
The set life has worked fine for me, though. And I never created a dummy unit either.
 
Status
Not open for further replies.
Top