• 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] Lightning Effect Problem

Status
Not open for further replies.
Level 10
Joined
May 28, 2009
Messages
223
  • Discharge Values
    • Events
      • Time - Elapsed game time is 0.33 seconds
    • Conditions
    • Actions
      • -------- Discharge Area of Effect --------
      • Set DC_AoE[1] = 200.00
      • Set DC_AoE[2] = 200.00
      • Set DC_AoE[3] = 200.00
      • -------- Discharge Damage --------
      • Set DC_DMG[1] = 80.00
      • Set DC_DMG[2] = 110.00
      • Set DC_DMG[3] = 140.00
      • -------- Discharge hashTable --------
      • Hashtable - Create a hashtable
      • Set DC_table = (Last created hashtable)
  • Discharge Init
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Discharge
    • Actions
      • Set DC_LVL = (Level of (Ability being cast) for (Triggering unit))
      • Set S_Charge = (Load (Key CHARGE) of (Key (Triggering unit)) from S_table)
      • Set DC_Loc = (Target point of ability being cast)
      • Set DC_GRP = (Random S_Charge units from (Units within DC_AoE[DC_LVL] of DC_Loc matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True))))
      • Set DC_GRPCount = (Number of units in DC_GRP)
      • Unit Group - Pick every unit in DC_GRP and do (Actions)
        • Loop - Actions
          • Set Temp_Loc = (Position of (Picked unit))
          • Set Temp_Loc2 = (Position of (Triggering unit))
          • Unit - Cause (Triggering unit) to damage (Picked unit), dealing DC_DMG[DC_LVL] damage of attack type Spells and damage type Normal
          • Lightning - Create a Finger of Death lightning effect from source Temp_Loc2 to target Temp_Loc
          • Set DC_Time = 0.00
          • Set DC_SFX = (Last created lightning effect)
          • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Spells\Demon\DemonBoltImpact\DemonBoltImpact.mdl
          • Special Effect - Destroy (Last created special effect)
          • Sound - Play LightningBolt <gen> at 100.00% volume, located at Temp_Loc with Z offset 0.00
          • Hashtable - Save DC_Time as (Key TIME) of (Key (Picked unit)) in DC_table
          • Hashtable - Save Handle OfDC_SFX as (Key SFX) of (Key (Picked unit)) in DC_table
          • Unit Group - Add (Picked unit) to DC_GRPCast
      • Set S_Charge = (S_Charge - DC_GRPCount)
      • Set S_TXT = (Load (Key TXT) of (Key (Triggering unit)) in S_tableIf the label is not found, this function returns NULL.)
      • Hashtable - Save S_Charge as (Key CHARGE) of (Key (Triggering unit)) in S_table
      • Floating Text - Change text of S_TXT to (String(S_Charge)) using font size 10.00
      • Custom script: call RemoveLocation (udg_DC_Loc)
      • Custom script: call RemoveLocation (udg_Temp_Loc)
      • Custom script: call RemoveLocation (udg_Temp_Loc2)
  • Discharge Spell
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in DC_GRPCast and do (Actions)
        • Loop - Actions
          • Set DC_SFX = (Load (Key SFX) of (Key (Picked unit)) in DC_table)
          • Set DC_Time = (Load (Key TIME) of (Key (Picked unit)) from DC_table)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • DC_Time Greater than or equal to 1.00
            • Then - Actions
              • Lightning - Destroy DC_SFX
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in DC_table
              • Unit Group - Remove (Picked unit) from DC_GRPCast
            • Else - Actions
              • Hashtable - Save (DC_Time + 0.04) as (Key TIME) of (Key (Picked unit)) in DC_table
              • Game - Display to (All players) the text: (String((Load (Key TIME) of (Key (Picked unit)) from DC_table)))
The spell is intertwined with another spell, Siphon, which stacks up the integer <S_Charge>. When Discharge is cast, it's supposed to fire Finger of Death at <S_Charge> amount of enemy units, randomly selected within an area of the targeted casting point.

The problem:
All the other effects of the spell (Damage, the SFX) is properly executed and shown, the Lightning effect however isn't showing, or only shows for an extremely short while (way shorter than half a second, which is the intended time).
 
Last edited:
Level 10
Joined
May 28, 2009
Messages
223
Use Game - display text message for debugging. You can convert the count and time to strings and display them.

By the way, you don't need this line, delete it: Unit Group - Remove (Picked unit) from DC_GRP

The method you suggested returned expected numbers. DC_Time is clocked correctly (tried with higher numbers on both the "Time - Every x.xx seconds of game time" and
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • DC_Time Greater than or equal to 1.00
    • Then - Actions
      • Lightning - Destroy DC_SFX[DC_Count]
      • Game - Display to (All players) the text: (String((Load (Key COUNT) of (Key (Picked unit)) from (Last created hashtable))))
      • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in DC_table
      • Unit Group - Remove (Picked unit) from DC_GRPCast
    • Else - Actions
      • Hashtable - Save (DC_Time + 0.01) as (Key TIME) of (Key (Picked unit)) in DC_table
Meanwhile, I swapped the Lightning Array to a regular variable and instead saved the lightning handle in the Hashtable (who knows, maybe lightning effect arrays are broken), but it gave me the same result: At random, the lightning shows for a brief moment only to disappear, even if the <DC_Time> has not reached the decided value.

I deleted the "Unit Group - Remove (Picked unit) from DC_GRP" line.
 
Last edited:
Status
Not open for further replies.
Top