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

Timed Lightning in custom script

Status
Not open for further replies.
Level 7
Joined
Apr 12, 2011
Messages
124
Got a trigger which i do not know how to make the Lightning effects get a lifespan(duration). I want them to last for 0.7 seconds but it doesn't seem to exist a premade option to do so.

I was wondering if anyone knew if you could do it in custom script and how.
(I got a feeling it can only be done in jass.)

Trigger:
Cast and Lightning
  • Spell Effect
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Thunderstorm
    • Actions
      • Set LightningCount = 0
      • Set WS_Caster = (Casting unit)
      • Set WS_Point[1] = (Position of WS_Caster)
      • Set WS_Real = 0.00
      • For each (Integer WS_Integer) from 1 to 15, do (Actions)
        • Loop - Actions
          • Set WS_Point[3] = (WS_Point[1] offset by 500.00 towards WS_Real degrees)
          • Lightning - Create a Chain Lightning - Primary lightning effect from source WS_Point[1] to target WS_Point[3]
          • Set LightningCount = (LightningCount + 1)
          • Set WS_Lightning[LightningCount] = (Last created lightning effect)
          • Set WS_Point[2] = (WS_Point[1] offset by 300.00 towards WS_Real degrees)
          • Unit - Create 1 Dummy for (Owner of WS_Caster) at WS_Point[1] facing Default building facing degrees
          • Unit - Add Thunderstorm Dummy to (Last created unit)
          • Unit - Set level of Thunderstorm Dummy for (Last created unit) to (Level of Thunderstorm for WS_Caster)
          • Unit - Order (Last created unit) to Undead Dreadlord - Carrion Swarm WS_Point[2]
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
          • Set WS_Real = (WS_Real + (360.00 / 15.00))
          • Custom script: call RemoveLocation(udg_WS_Point[2])
          • Custom script: call RemoveLocation(udg_WS_Point[3])
      • Set WS_Unitgroup = (Units within 500.00 of WS_Point[1] matching (((Matching unit) belongs to an enemy of (Owner of WS_Caster)) Equal to True))
      • Unit Group - Pick every unit in WS_Unitgroup and do (Actions)
        • Loop - Actions
          • Unit - Create 1 Dummy for (Owner of WS_Caster) at WS_Point[1] facing Default building facing degrees
          • Unit - Add Purge to (Last created unit)
          • Unit - Set level of Purge for (Last created unit) to (Level of Thunderstorm for WS_Caster)
          • Special Effect - Create a special effect attached to the origin of (Last created unit) using Abilities\Spells\Other\Monsoon\MonsoonBoltTarget.mdl
          • Unit - Order (Last created unit) to Orc Shaman - Purge (Picked unit)
          • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Countdown Timer - Start Lightning as a One-shot timer that will expire in 0.70 seconds
      • Custom script: call DestroyGroup(udg_WS_Unitgroup)
      • Custom script: call RemoveLocation(udg_WS_Point[1])
Current Lightning Removal

  • Destroy Lightning
    • Events
      • Time - Lightning expires
    • Conditions
    • Actions
      • -------- im pretty sure this will leak if they cast with less than 0.7 sec in between --------
        • Lightning - Destroy WS_Lightning[LightningCount]
      • Custom script: call DestroyLightning(udg_WS_Lightning[1])
      • Custom script: call DestroyLightning(udg_WS_Lightning[2])
      • Custom script: call DestroyLightning(udg_WS_Lightning[3])
      • Custom script: call DestroyLightning(udg_WS_Lightning[4])
      • Custom script: call DestroyLightning(udg_WS_Lightning[5])
      • Custom script: call DestroyLightning(udg_WS_Lightning[6])
      • Custom script: call DestroyLightning(udg_WS_Lightning[7])
      • Custom script: call DestroyLightning(udg_WS_Lightning[8])
      • Custom script: call DestroyLightning(udg_WS_Lightning[9])
      • Custom script: call DestroyLightning(udg_WS_Lightning[10])
      • Custom script: call DestroyLightning(udg_WS_Lightning[11])
      • Custom script: call DestroyLightning(udg_WS_Lightning[12])
      • Custom script: call DestroyLightning(udg_WS_Lightning[13])
      • Custom script: call DestroyLightning(udg_WS_Lightning[14])
      • Custom script: call DestroyLightning(udg_WS_Lightning[15])
Damage over time
  • Damage Ticks
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Thunderstorm for WS_Caster) Equal to 1
        • Then - Actions
          • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) has buff Shock) Equal to True)) and do (Unit - Cause WS_Caster to damage (Picked unit), dealing 10.00 damage of attack type Spells and damage type Normal)
          • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) has buff Shock) Equal to True)) and do (Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Orc\LightningShield\LightningShieldBuff.mdl)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Thunderstorm for WS_Caster) Equal to 2
        • Then - Actions
          • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) has buff Shock) Equal to True)) and do (Unit - Cause WS_Caster to damage (Picked unit), dealing 15.00 damage of attack type Spells and damage type Normal)
          • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) has buff Shock) Equal to True)) and do (Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Orc\LightningShield\LightningShieldBuff.mdl)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Thunderstorm for WS_Caster) Equal to 3
        • Then - Actions
          • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) has buff Shock) Equal to True)) and do (Unit - Cause WS_Caster to damage (Picked unit), dealing 20.00 damage of attack type Spells and damage type Normal)
          • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching unit) has buff Shock) Equal to True)) and do (Special Effect - Create a special effect attached to the chest of (Picked unit) using Abilities\Spells\Orc\LightningShield\LightningShieldBuff.mdl)
        • Else - Actions

im new and have no experience what so ever, trial and error, that's how i learn. Tell me if i made anything fataly wrong (except Lightning, i know they will bug)

:goblin_jawdrop:
 
Last edited:
Level 20
Joined
Jul 6, 2009
Messages
1,885
The easiest way in GUI to set duration for lightning effects is using dummy units, in my opinion.
When you create a lightning, create a dummy unit anywhere and attach lightning to dummy. Then add an expiration timer to dummy and destroy lightning upon dummy's death.
  • Set Loc1 = Lightning source location
  • Set Loc2 = Lightning target location
  • Lightning - Create a Chain Lightning - Primary lightning effect from source Loc1 to target Loc2
  • Unit - Create 1 DummyUnit for Player 1 (Red) at Loc1 facing Default building facing degrees
  • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
  • Hashtable - Save Handle Of(Last created lightning effect) as 0 of (Key (Last created unit)) in YourHashtable
  • Custom script: call RemoveLocation(udg_Loc1)
  • Custom script: call RemoveLocation(udg_Loc2)
  • Untitled Trigger 002
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to DummyUnit
    • Actions
      • Lightning - Destroy (Load 0 of (Key (Triggering unit)) in YourHashtable)
 
Status
Not open for further replies.
Top