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

[Trigger] Massively Leaking Spell SFX

Status
Not open for further replies.
Level 1
Joined
Jul 26, 2009
Messages
5
I am trying to make the special effects for one of my spells in my upcoming map, but it seems to be leaking incredibly badly and I'm not quite sure what I can try next. Thanks in advance for any help guys :grin:
  • Rune SFX
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Rune of Annihilation
    • Actions
      • Set RoA_TargetPos = (Target point of ability being cast)
      • For each (Integer A) from 1 to 3, do (Actions)
        • Loop - Actions
          • Set RoA_SFX_RunesPosArray[(Integer A)] = (RoA_TargetPos offset by 250.00 towards ((Real((Integer A))) x 120.00) degrees)
          • Special Effect - Create a special effect at RoA_SFX_RunesPosArray[(Integer A)] using Objects\InventoryItems\runicobject\runicobject.mdl
          • Set RoA_SFX_RunesArray[(Integer A)] = (Last created special effect)
          • Lightning - Create a Finger of Death lightning effect from source RoA_SFX_RunesPosArray[(Integer A)] to target RoA_TargetPos
          • Set RoA_LightningArray[(Integer A)] = (Last created lightning effect)
      • Wait 2.00 seconds
      • For each (Integer A) from 1 to 3, do (Actions)
        • Loop - Actions
          • Special Effect - Destroy RoA_SFX_RunesArray[(Integer A)]
          • Lightning - Destroy RoA_LightningArray[(Integer A)]
          • Custom script: call RemoveLocation(udg_RoA_SFX_RunesPosArray[GetForLoopIndexA()] )
      • For each (Integer B) from 1 to 10, do (Actions)
        • Loop - Actions
          • Wait 0.50 seconds
          • Set RoA_10ExplosionsPosArray[(Integer B)] = (RoA_TargetPos offset by 250.00 towards ((Real((Integer B))) x 36.00) degrees)
          • Special Effect - Create a special effect at RoA_10ExplosionsPosArray[(Integer B)] using war3mapImported\NewGroundEX.mdx
          • Set RoA_SFX_ExplosionArray[(Integer B)] = (Last created special effect)
      • Wait 2.00 seconds
      • Special Effect - Create a special effect at RoA_TargetPos using war3mapImported\NewGroundEX.mdx
      • Set RoA_SFX_Explosion = (Last created special effect)
      • Special Effect - Destroy RoA_SFX_Explosion
      • For each (Integer B) from 1 to 10, do (Actions)
        • Loop - Actions
          • Special Effect - Destroy RoA_SFX_ExplosionArray[(Integer B)]
          • Custom script: call RemoveLocation(udg_RoA_10ExplosionsPosArray[GetForLoopIndexB()] )
      • Custom script: call RemoveLocation(udg_RoA_TargetPos)
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Here you go:

  • Rune of Annihilation
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Flame Strike
    • Actions
      • Set Temp_Loc_1 = (Target point of ability being cast)
      • Set Temp_Loc_4 = Temp_Loc_1
      • For each (Integer loopA) from 1 to 3, do (Actions)
        • Loop - Actions
          • Set Temp_Loc_2 = (Temp_Loc_1 offset by 256.00 towards ((Real(loopA)) x 120.00) degrees)
          • Special Effect - Create a special effect at Temp_Loc_2 using Objects\InventoryItems\runicobject\runicobject.mdl
          • Lightning - Create a Finger of Death lightning effect from source Temp_Loc_2 to target Temp_Loc_1
          • Hashtable - Save Handle Of(Last created special effect) as loopA of (Key (Triggering unit)) in Annihilation_Hash
          • Hashtable - Save Handle Of(Last created lightning effect) as (loopA + 4) of (Key (Triggering unit)) in Annihilation_Hash
          • Custom script: call RemoveLocation(udg_Temp_Loc_2)
      • Wait 2.00 seconds
      • For each (Integer loopB) from 1 to 3, do (Actions)
        • Loop - Actions
          • Set Temp_Effect = (Load loopB of (Key (Triggering unit)) in Annihilation_Hash)
          • Set Temp_Lightning = (Load (loopB + 4) of (Key (Triggering unit)) in Annihilation_Hash)
          • Special Effect - Destroy Temp_Effect
          • Lightning - Destroy Temp_Lightning
      • For each (Integer loopC) from 1 to 10, do (Actions)
        • Loop - Actions
          • Wait 0.50 seconds
          • Set Temp_Loc_2 = (Temp_Loc_4 offset by 256.00 towards ((Real(loopC)) x 36.00) degrees)
          • Special Effect - Create a special effect at Temp_Loc_2 using Objects\InventoryItems\runicobject\runicobject.mdl
          • Hashtable - Save Handle Of(Last created special effect) as loopC of (Key (Triggering unit)) in Annihilation_Hash
          • Custom script: call RemoveLocation(udg_Temp_Loc_2)
      • Wait 2.00 seconds
      • Special Effect - Create a special effect at Temp_Loc_1 using Objects\Spawnmodels\Undead\UDeathSmall\UDeathSmall.mdl
      • Special Effect - Destroy (Last created special effect)
      • For each (Integer loopD) from 1 to 10, do (Actions)
        • Loop - Actions
          • Set Temp_Effect = (Load loopD of (Key (Triggering unit)) in Annihilation_Hash)
          • Special Effect - Destroy Temp_Effect
      • Hashtable - Clear all child hashtables of child (Key (Triggering unit)) in Annihilation_Hash
      • Custom script: call RemoveLocation(udg_Temp_Loc_1)
      • Custom script: call RemoveLocation(udg_Temp_Loc_4)
It's not MUI, however it's easier to make this MUI than your trigger.

EDIT: How do you know your trigger leaks? It doesn't seem to now that I look at it.
 
Level 1
Joined
Jul 26, 2009
Messages
5
i know, thats what i thought. But it became evident to me that it leaked when the first wave of mobs spawned for my map (a castle defence) and i got 1 frame per second :S and thanks a lot, this will work great :D didnt need it to be MUI anyway
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Here's the MUI anyway :D

JASS:
function Trig_Rune_of_Annihilation_Conditions takes nothing returns boolean

if ( not ( GetSpellAbilityId() == 'AHfs' ) ) then
        return false
    endif
    return true
endfunction

function Trig_Rune_of_Annihilation_Actions takes nothing returns nothing

local integer loopA = 0
local integer loopB = 0
local integer loopC = 0
local integer loopD = 0
local location Temp_Loc_B


local location Temp_Loc_A = GetSpellTargetLoc()
local location Temp_Loc_D = Temp_Loc_A
    set loopA = 1
    loop
        exitwhen loopA > 3
        set Temp_Loc_B = PolarProjectionBJ(Temp_Loc_A, 256, ( I2R(loopA) * 120.00 ))
        call AddSpecialEffectLocBJ( Temp_Loc_B, "Objects\\InventoryItems\\runicobject\\runicobject.mdl" )
        call AddLightningLoc( "AFOD", Temp_Loc_B, Temp_Loc_A )
        call SaveEffectHandleBJ( GetLastCreatedEffectBJ(), loopA, GetHandleIdBJ(GetTriggerUnit()), udg_Annihilation_Hash )
        call SaveLightningHandleBJ( GetLastCreatedLightningBJ(), ( loopA + 4 ), GetHandleIdBJ(GetTriggerUnit()), udg_Annihilation_Hash )
        call RemoveLocation(Temp_Loc_B)
        set loopA = loopA + 1
    endloop
    call TriggerSleepAction( 2 )
    set loopB = 1
    loop
        exitwhen loopB > 3
        set udg_Temp_Effect = LoadEffectHandleBJ(loopB, GetHandleIdBJ(GetTriggerUnit()), udg_Annihilation_Hash)
        set udg_Temp_Lightning = LoadLightningHandleBJ(( loopB + 4 ), GetHandleIdBJ(GetTriggerUnit()), udg_Annihilation_Hash)
        call DestroyEffectBJ( udg_Temp_Effect )
        call DestroyLightningBJ( udg_Temp_Lightning )
        set loopB = loopB + 1
    endloop
    set loopC = 1
    loop
        exitwhen loopC > 10
        call TriggerSleepAction( 0.50 )
        set Temp_Loc_B = PolarProjectionBJ(Temp_Loc_D, 256.00, ( I2R(loopC) * 36.00 ))
        call AddSpecialEffectLocBJ( Temp_Loc_B, "Objects\\InventoryItems\\runicobject\\runicobject.mdl" )
        call SaveEffectHandleBJ( GetLastCreatedEffectBJ(), loopC, GetHandleIdBJ(GetTriggerUnit()), udg_Annihilation_Hash )
        call RemoveLocation(Temp_Loc_B)
        set loopC = loopC + 1
    endloop
    call TriggerSleepAction( 2 )
    call AddSpecialEffectLocBJ( Temp_Loc_A, "Objects\\Spawnmodels\\Undead\\UDeathSmall\\UDeathSmall.mdl" )
    call DestroyEffectBJ( GetLastCreatedEffectBJ() )
    set loopD = 1
    loop
        exitwhen loopD > 10
        set udg_Temp_Effect = LoadEffectHandleBJ(loopD, GetHandleIdBJ(GetTriggerUnit()), udg_Annihilation_Hash)
        call DestroyEffectBJ( udg_Temp_Effect )
        set loopD = loopD + 1
    endloop
    call FlushChildHashtableBJ( GetHandleIdBJ(GetTriggerUnit()), udg_Annihilation_Hash )
    call RemoveLocation(Temp_Loc_A)
    call RemoveLocation(Temp_Loc_D)
endfunction

//===========================================================================
function InitTrig_Rune_of_Annihilation takes nothing returns nothing
    set gg_trg_Rune_of_Annihilation = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Rune_of_Annihilation, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Rune_of_Annihilation, Condition( function Trig_Rune_of_Annihilation_Conditions ) )
    call TriggerAddAction( gg_trg_Rune_of_Annihilation, function Trig_Rune_of_Annihilation_Actions )
endfunction
 
Level 1
Joined
Jul 26, 2009
Messages
5
also, im a little embarassed to ask this, but since im a bit of a nub to this site, is there any easier way of copying over that trigger?
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
I accidentally deleted the GUI trigger I think...:D

Anyway, create these variables:

Name - Type

Annihilation Hash - Hashtable
Temp_Effect - Special Effect
Temp_Lightning - Lightning

Put this to map initialization:

  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Annihilation_Hash = (Last created hashtable)
Then create a trigger named Rune of Annihilation. Select it and hit Edit - Convert to Custom Text. Answer yes, and select all text on the right pane and delete it. Then select the JASS code I posted and paste it to the empty space.

Then you only need to change the

if ( not ( GetSpellAbilityId() == 'AHbz' ) ) then

line, the spell code AHbz to be more specific. Create a nromal trigger and set to condition "Ability being cast equal to *yourSpell*. Convert that trigger to custom text, and there is your spell code. Replace the one in my trigger with yours.
 
Status
Not open for further replies.
Top