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

MUI delay.. -_-

Status
Not open for further replies.
Level 23
Joined
Oct 20, 2012
Messages
3,075
Hey guys, I'm kinda stuck with making this trigger MUI.. (I know, i'm kinda dumb at making things MUI..)

I'm trying to make a special effect where whenever a creep dies, his corpse will disappear like in the feral spirit spell. but I don't want it to be instant, I want it to have a small delay before disappearing.. (so that part of the death anim plays)

yes. a gif. in case you misunderstood me. XD
222907-albums6224-picture68250.gif


  • cool but not MUI Creep Death
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Triggering unit)) Equal to Player 12 (Brown)
      • ((Triggering unit) is A Hero) Equal to False
    • Actions
      • Set Temp_point = (Position of (Triggering unit))
      • Wait 1.00 seconds
      • Unit - Remove (Triggering unit) from the game
      • Special Effect - Create a special effect at Temp_point using Abilities\Spells\Orc\FeralSpirit\feralspirittarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation(udg_Temp_point)
aaaaannnddd since I haven't made something that's MUI in quite a while. I'm having a hard time doing it.. XD so can you guys help me?
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Why should he do that? It's a global. Globals don't leak.

Inspect WC3 memory consumption while running this. Test with and without the nulling...
JASS:
library leakTest initializer onInit
    globals
        private timer t = CreateTimer()
        private constant integer LOCS = 5
        private integer c = 0
    endglobals

    private function leaks takes nothing returns nothing
        local integer i = LOCS
        
        loop
            exitwhen i == 0
            set udg_loc = Location(0,0)
            call RemoveLocation(udg_loc)
            set c = c + 1
            set i = i - 1
        endloop
        //set udg_loc = null
    endfunction
    
    private function pauseResume takes nothing returns nothing
        if ModuloInteger(GetTriggerExecCount(GetTriggeringTrigger()) , 2) == 1 then
            call BJDebugMsg("started")
            call TimerStart(t, 0.01, true, function leaks)
        else
            call BJDebugMsg("paused, " + "locs created: " + I2S(c))
            call PauseTimer(t)
        endif
    endfunction

    private function onInit takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterPlayerEvent(t, Player(0), EVENT_PLAYER_END_CINEMATIC)
        call TriggerAddAction(t, function pauseResume)
    endfunction
endlibrary
 
Inspect WC3 memory consumption while running this. Test with and without the nulling...
I bet this is memory consumption created by cycling through an internal stack of whatever-it-is.

I'm pretty sure that at some point, the memory consumed will go back down (the memory resource management of wc3 is pretty fucked up anyway).
It's definitely not leaking in the common sense, as the pointer gets overwritten.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Use local variable to make it MUI;
  • Melee Initialization
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Custom script: local unit dead = GetTriggerUnit()
      • Custom script: local location loc = GetUnitLoc(dead)
      • Wait 1.00 seconds
      • Custom script: call RemoveUnit(dead)
      • Custom script: call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Orc\\FeralSpirit\\feralspirittarget.mdl", loc))
      • Custom script: call RemoveLocation(loc)
      • Custom script: set loc = null
      • Custom script: set dead = null
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
Use local variable to make it MUI;
  • Melee Initialization
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Custom script: local unit dead = GetTriggerUnit()
      • Custom script: local location loc = GetUnitLoc(dead)
      • Wait 1.00 seconds
      • Custom script: call RemoveUnit(dead)
      • Custom script: call DestroyEffect(AddSpecialEffectLoc("Abilities\\Spells\\Orc\\FeralSpirit\\feralspirittarget.mdl", loc))
      • Custom script: call RemoveLocation(loc)
      • Custom script: set loc = null
      • Custom script: set dead = null

He doesnt need all that since Triggering Unit is already a local variable.
 
Status
Not open for further replies.
Top