• 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.
  • It's time for the first HD Modeling Contest of 2025. Join the theme discussion for Hive's HD Modeling Contest #7! Click here to post your idea!

God damn SFX leak

Status
Not open for further replies.
Level 1
Joined
Mar 2, 2010
Messages
3


The spell is meant to create a shock effect for picked units, but if you cast the spell again even after the units died the SFX`s are still created. Here's the trigger:

  • Electrokinesis
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Electrokinesis
    • Actions
      • Special Effect - Create a special effect attached to the chest of Caster using Abilities\Weapons\Bolt\BoltImpact.mdl
      • Set ElectroCaster = (Last created special effect)
      • Special Effect - Create a special effect attached to the hand,left of Caster using Abilities\Weapons\FarseerMissile\FarseerMissile.mdl
      • Set ElectroCaster2 = (Last created special effect)
      • Special Effect - Create a special effect attached to the hand,left of Caster using Abilities\Weapons\Bolt\BoltImpact.mdl
      • Set ElectroCaster3 = (Last created special effect)
      • Hashtable - Create a hashtable
      • Set ElectroTable = (Last created hashtable)
      • Set Caster = (Triggering unit)
      • Set CasLoc = (Position of (Triggering unit))
      • Set Sptarget = (Target point of ability being cast)
      • Set Real = ((Facing of Caster) - 90.00)
      • Set CasDist = (Distance between CasLoc and Sptarget)
      • Set CasAng = (Angle from CasLoc to Sptarget)
      • Set ElectroTableVar = 0
      • Set ElectroAoE = (CasLoc offset by (CasDist / 2.00) towards CasAng degrees)
      • Unit - Create 1 Dummy for (Owner of Caster) at CasLoc facing Default building facing degrees
      • Unit - Turn collision for (Last created unit) Off
      • Unit - Add Electrokinesis Dummy to (Last created unit)
      • Unit - Set level of Electrokinesis Dummy for (Last created unit) to (Level of Electrokinesis for Caster)
      • Unit - Order (Last created unit) to Undead Dreadlord - Carrion Swarm Sptarget
      • Unit - Add a 3.50 second Generic expiration timer to (Last created unit)
      • Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units within (CasDist / 2.00) of ElectroAoE matching (((((Matching unit) is A structure) Not equal to True) and (((Matching unit) belongs to an enemy of (Owner of Caster)) Equal to True)) and (((Matching unit) is Magic Immune) Not equal to True))) and do (Actions)
        • Loop - Actions
          • Set ElectroPicked = (Position of (Picked unit))
          • Special Effect - Create a special effect at ElectroPicked using Abilities\Weapons\Bolt\BoltImpact.mdl
          • Set ElectroEffect = (Last created special effect)
          • Special Effect - Destroy ElectroEffect
          • Custom script: call RemoveLocation(udg_ElectroPicked)
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Set LocOffset = (CasLoc offset by 200.00 towards Real degrees)
          • Set AngOffset = (LocOffset offset by CasDist towards CasAng degrees)
          • Lightning - Create a Chain Lightning - Primary lightning effect from source CasLoc to target LocOffset
          • Hashtable - Save Handle Of(Last created lightning effect) as (ElectroTableVar + 1) of 1 in ElectroTable
          • Lightning - Create a Chain Lightning - Secondary lightning effect from source LocOffset to target AngOffset
          • Hashtable - Save Handle Of(Last created lightning effect) as (ElectroTableVar + 1) of 2 in ElectroTable
          • Set Real = (Real + (180.00 / 5.00))
          • Set ElectroTableVar = (ElectroTableVar + 1)
      • Custom script: call RemoveLocation(udg_CasLoc)
      • Custom script: call RemoveLocation(udg_Sptarget)
      • Custom script: call RemoveLocation(udg_ElectroAoE)
      • Wait 0.75 seconds
      • Special Effect - Destroy ElectroCaster
      • Special Effect - Destroy ElectroCaster2
      • Special Effect - Destroy ElectroCaster3
      • Lightning - Destroy (Load 1 of 1 in ElectroTable)
      • Lightning - Destroy (Load 1 of 2 in ElectroTable)
      • Lightning - Destroy (Load 2 of 1 in ElectroTable)
      • Lightning - Destroy (Load 2 of 2 in ElectroTable)
      • Lightning - Destroy (Load 3 of 1 in ElectroTable)
      • Lightning - Destroy (Load 3 of 2 in ElectroTable)
      • Lightning - Destroy (Load 4 of 1 in ElectroTable)
      • Lightning - Destroy (Load 4 of 2 in ElectroTable)
      • Lightning - Destroy (Load 5 of 1 in ElectroTable)
      • Lightning - Destroy (Load 5 of 2 in ElectroTable)
      • Lightning - Destroy (Load 6 of 1 in ElectroTable)
      • Lightning - Destroy (Load 6 of 2 in ElectroTable)
      • Hashtable - Clear all child hashtables of child ElectroTableVar in ElectroTable
Thanks in advance
 
It loses its MUI with the wait, and thus it causes the leak if it is cast simultaneously.

Instead of saving the handles to "1" and "2" of the hashtable, use Key (Handle Id of Caster) or whatever the function is. This will allow it to be saved to a unique id rather than being saved to an index easily replaceable such as 1 or 2.

When retrieving them though, use Key (Triggering Unit) rather than "Caster" in case "Caster" gets overwritten. Triggering Unit is local to the function. Save the effects to a hashtable as well. Then load them and destroy them again.

Sorry for this non-exampled very broad answer. =(
 
Status
Not open for further replies.
Top