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

Lightning shield

Status
Not open for further replies.
Level 10
Joined
Nov 5, 2008
Messages
536
The Caster casts Lightning Shield on A.
A stands next to B.
B gets damaged every second.

How do I do so A gets damage from the spell?

(Without casting the spell on B, of course^^)

Ps. I have ticked the box "Self" in targets allowed, but that does no difference
 
Level 7
Joined
Aug 30, 2008
Messages
347
make a trigger to check buffs every like .50 seconds or the intervals of the lightning shield ability then damage it in this manner, worked for me
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
  • Trigger
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
      • (YourUnit has buff *your buff*) Equal to True
    • Actions
      • Set TempLoc1 = (Position of (your unit))
      • Set TempGroup = (Units within 512.00 of TempLoc1 matching (((Owner of (Matching unit)) is an enemy of (Owner of your unit)) Equal to True))
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 10.00)
      • Custom script: call DestroyGroup(udg_TempGroup)
      • Custom script: call RemoveLocation(udg_TempLoc1)
Something like this. Make another trigger that turns this one on when you activate the spell, and a trigger that turns this one off when the buff is deactivated.
 
Last edited:
Level 10
Joined
Nov 5, 2008
Messages
536
  • Hellfire
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
      • ((Triggering unit) has buff Hellfire ) Equal to True
    • Actions
      • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) - 15.00)
I made the trigger like this, cause I thought it would be easier since the Lightning Shield already deals damage to units nearby. This trigger makes the unit that has the Lightning Shield on it to take damage.

But it does not work. What am I doing wrong?
 
Level 10
Joined
Nov 5, 2008
Messages
536
  • Trigger
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
      • (YourUnit has buff *your buff*) Equal to True
    • Actions
      • Set TempLoc1 = (Position of (your unit))
      • Set TempGroup = (Units within 512.00 of TempLoc1 matching (((Owner of (Matching unit)) is an enemy of (Owner of your unit)) Equal to True))
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 10.00)
      • Custom script: call DestroyGroup(udg_TempGroup)
      • Custom script: call RemoveLocation(udg_TempLoc1)
Something like this. Make another trigger that turns this one on when you activate the spell, and a trigger that turns this one off when the buff is deactivated.

How can I change your trigger so it only damages the unit that "wears" the lightning shield? (The shield does via the object editor damage to units nearby, so that does not need to be triggered)
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
  • Check
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set TempGroup = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Footman))
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Animate Dead for (Picked unit)) Greater than 0
            • Then - Actions
              • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 10.00)
            • Else - Actions
      • Custom script: call DestroyGroup(udg_TempGroup)
Set the unit type to the type of unit that can have the buff. Set the ability type to the type of your ability. You can set the damage to x*(level of ability for (picked unit)) for example.
 
Level 10
Joined
Nov 5, 2008
Messages
536
just remove shadowstrike buff when you want damage to be done. >_<

How do you mean?

  • Check
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set TempGroup = (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Equal to Footman))
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Animate Dead for (Picked unit)) Greater than 0
            • Then - Actions
              • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 10.00)
            • Else - Actions
      • Custom script: call DestroyGroup(udg_TempGroup)
Set the unit type to the type of unit that can have the buff. Set the ability type to the type of your ability. You can set the damage to x*(level of ability for (picked unit)) for example.

I want all units to be able to be effected by the spell, not just a certain unit-type. How do I do so all units can be targeted by the spell and will via the trigger get damaged?
 
Last edited:
Level 10
Joined
Nov 5, 2008
Messages
536
The Caster casts Lightning Shield on A.
A stands next to B.
B gets damaged every second.

How do I do so A gets damage from the spell?

(Without casting the spell on B, of course^^)

Ps. I have ticked the box "Self" in targets allowed, but that does no difference

I have tried some of your solutions but nothing works the way as I want.

The spell will be a hero-spell with 3 levels. The damage is the same (15 damage/second) the only thing that changes is the duration of the spell.

Any effective and simple way to do this?
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
  • LS
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to ...
    • Actions
      • Set Temp_Unit_1 = (Target unit of ability being cast)
      • Unit Group - Add Temp_Unit_1 to ..._Group
      • Set Temp_Real_1 = damage equation
      • Set Temp_Real_2 = buff duration
      • Hashtable - Save Temp_Real_1 as (Key dmg) of (Key (Target unit of ability being cast)) in ..._Hash
      • Hashtable - Save Temp_Real_2 as (Key timer) of (Key (Target unit of ability being cast)) in ..._Hash
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (LS Loop <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on LS Loop <gen>
        • Else - Actions
  • LS Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in ..._Group and do (Actions)
        • Loop - Actions
          • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - (Load (Key dmg) of (Key (Picked unit)) from ..._Hash))
          • Set Temp_Real_1 = ((Load (Key timer) of (Key (Picked unit)) from (..._Hash)) - 1.00)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Temp_Real_1 Less than or equal to 0.00
            • Then - Actions
              • Unit Group - Remove (Picked unit) from roup
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in (..._Hash)
            • Else - Actions
              • Hashtable - Save Temp_Real_1 as (Key timer) of (Key (Picked unit)) in (..._Hash)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (..._Group is empty) Equal to True
    • Then - Actions
      • Trigger - Turn off (This trigger)
    • Else - Actions
I believe this will do the job. LS loop is initially off.
 
Level 11
Joined
May 31, 2008
Messages
698
Im pretty sure this should work fine:

  • Lightning Shield
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set TempGrooup = Units in (Playable map area) matching (((Matching unit) has buff Lightning Shield) Equal to (==) True)
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Unit - Set mana of (Picked unit) to ((Life of (Picked unit)) - 10.00)
      • Custom script: call DestroyGroup(udgTempGroup)
 
Level 10
Joined
Nov 5, 2008
Messages
536

  • Lightning Shield
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set TempGrooup = Units in (Playable map area) matching (((Matching unit) has buff Lightning Shield) Equal to (==) True)
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Unit - Set mana of (Picked unit) to ((Life of (Picked unit)) - 10.00)
      • Custom script: call DestroyGroup(udgTempGroup)

  • LS
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to ...
    • Actions
      • Set Temp_Unit_1 = (Target unit of ability being cast)
      • Unit Group - Add Temp_Unit_1 to ..._Group
      • Set Temp_Real_1 = damage equation
      • Set Temp_Real_2 = buff duration
      • Hashtable - Save Temp_Real_1 as (Key dmg) of (Key (Target unit of ability being cast)) in ..._Hash
      • Hashtable - Save Temp_Real_2 as (Key timer) of (Key (Target unit of ability being cast)) in ..._Hash
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (LS Loop <gen> is on) Equal to False
        • Then - Actions
          • Trigger - Turn on LS Loop <gen>
        • Else - Actions
  • LS Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in ..._Group and do (Actions)
        • Loop - Actions
          • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - (Load (Key dmg) of (Key (Picked unit)) from ..._Hash))
          • Set Temp_Real_1 = ((Load (Key timer) of (Key (Picked unit)) from (..._Hash)) - 1.00)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Temp_Real_1 Less than or equal to 0.00
            • Then - Actions
              • Unit Group - Remove (Picked unit) from roup
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in (..._Hash)
            • Else - Actions
              • Hashtable - Save Temp_Real_1 as (Key timer) of (Key (Picked unit)) in (..._Hash)
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (..._Group is empty) Equal to True
    • Then - Actions
      • Trigger - Turn off (This trigger)
    • Else - Actions
I believe this will do the job. LS loop is initially off.





There are two very good triggers here, but which one is the "best" one?
Both friendly and enemy heroes can cast this spell at the same time, so that does not mess something up.
 
Status
Not open for further replies.
Top