HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Special Effect doesnt disappear..

04-17-2007, 02:42 PM#1
akolyt0r
This Spell is supposed to be a Eye-Candy version for a Sprint Ability...(with
...but the created Special Effects dont disappear...but stay forever...

hmm

Hidden information:

Collapse JASS:
constant function FS_MaxTime takes nothing returns real
    return 9.00
endfunction

constant function FS_TimerTimeOut takes nothing returns real
    return 0.08
endfunction

constant function FS_TraceLength takes nothing returns real
    return 0.25
endfunction

function FS_MaxPeriod takes nothing returns integer
    return R2I(FS_MaxTime() / FS_TimerTimeOut())
endfunction

constant function FS_AbilityId takes nothing returns integer
    return 'A000'
endfunction

constant function FireSprint_FX takes nothing returns string
    return "Environment\\LargeBuildingFire\\LargeBuildingFire2.mdl"
endfunction

function Trig_FS_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == FS_AbilityId()
endfunction

function FS_TimerActions takes nothing returns nothing
    local timer Timer= GetExpiredTimer()
    local string s= I2S(H2I(Timer))
    local unit Caster= I2U(GetStoredInteger(udg_gc , "FS" , "CasterUnit" + s))
    local location CasterLoc=GetUnitLoc(Caster)
    local effect FX=AddSpecialEffectLoc(FireSprint_FX(),CasterLoc)
    local integer CurrPeriod = GetStoredInteger(udg_gc , "FS" , "Period" + s)
    if CurrPeriod < FS_MaxPeriod() then
        call StoreInteger(udg_gc , "FS" , "Period" + s , CurrPeriod + 1)
    else
        //CLEANUP Gamecache
        call FlushStoredInteger(udg_gc , "FS" , "Period" + s)
        call FlushStoredInteger(udg_gc , "FS" , "CasterUnit" + s)
        //CLEANUP Timer
        call PauseTimer(Timer)
        call DestroyTimer(Timer)
    endif
    //FINAL CLEANUP
    call RemoveLocation(CasterLoc)
    set CasterLoc = null
    set Caster = null
    call PolledWait(FS_TraceLength())
    call DestroyEffect(FX)
endfunction

function Trig_FS_Actions takes nothing returns nothing
    local timer Timer= CreateTimer()
    local string s= I2S(H2I(Timer))
    local unit Caster= GetTriggerUnit()
    local integer Level= GetUnitAbilityLevel(Caster , FS_AbilityId())
    //Storing into Gamecache
    call StoreInteger(udg_gc , "FS" , "Level" + s , Level)
    call StoreInteger(udg_gc , "FS" , "CasterUnit" + s , H2I(Caster))
    call StoreInteger(udg_gc , "FS" , "Period" + s , 0)
    //Starting Timer
    call TimerStart(Timer,FS_TimerTimeOut(),true,function FS_TimerActions)
    //CLEAN UP
    set Timer = null
    set Caster = null
endfunction

function InitTrig_FireSprinta takes nothing returns nothing
    set gg_trg_FireSprinta = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_FireSprinta , EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(gg_trg_FireSprinta , Condition(function Trig_FS_Conditions))
    call TriggerAddAction(gg_trg_FireSprinta , function Trig_FS_Actions)
endfunction


it should look like this:
Hidden information:
Zoom (requires log in)

but it looks like this:
Hidden information:
Zoom (requires log in)
Attached Images
File type: jpgfireSprint1.jpg (129.4 KB)
File type: jpgfireSprint2.jpg (90.5 KB)
04-17-2007, 03:15 PM#2
Vexorian
You can't have waits in timer actions.
04-17-2007, 03:15 PM#3
Toink
I recommend using a loop that calls Vex's AddAreaDamageForUnitLoc function from Caster System.

Although I've tried doing that with this kind of "fire trail" ability, and it has bugs <_< some weren't removed.
04-17-2007, 05:31 PM#4
akolyt0r
Quote:
Originally Posted by Vexorian
You can't have waits in timer actions.

Damn ... why ??
another failure:
Hidden information:
Collapse JASS:
//....
function FS_DestroyEffect takes effect FX returns nothing
    call PolledWait(FS_TraceLength())
    call DestroyEffect(FX)
endfunction

function FS_TimerActions takes nothing returns nothing
    local timer Timer= GetExpiredTimer()
    local string s= I2S(H2I(Timer))
    local unit Caster= I2U(GetStoredInteger(udg_gc , "FS" , "CasterUnit" + s))
    local location CasterLoc=GetUnitLoc(Caster)
    local effect FX=AddSpecialEffectLoc(FireSprint_FX(),CasterLoc)
    local integer CurrPeriod = GetStoredInteger(udg_gc , "FS" , "Period" + s)
    if CurrPeriod < FS_MaxPeriod() then
        call StoreInteger(udg_gc , "FS" , "Period" + s , CurrPeriod + 1)
    else
        //CLEANUP Gamecache
        call FlushStoredInteger(udg_gc , "FS" , "Period" + s)
        call FlushStoredInteger(udg_gc , "FS" , "CasterUnit" + s)
        //CLEANUP Timer
        call PauseTimer(Timer)
        call DestroyTimer(Timer)
    endif
    //FINAL CLEANUP
    call RemoveLocation(CasterLoc)
    set CasterLoc = null
    set Caster = null
    call FS_DestroyEffect(FX)
endfunction
//....


then i will have to use a dummy unit with timed life again -.-
04-17-2007, 05:57 PM#5
blu_da_noob
It's still the same thread. What you can do is:
Collapse JASS:
function TimedEffectDestruction takes nothing returns nothing
set local effect e = udg_Effect
call PolledWait(5.)
call RemoveLocation(e)
set e = null
endfunction

...
//inside your timer callback
set udg_Effect = FX
call ExecuteFunc("TimedEffectDestruction")
//carry on
...
Or you could use a timer to accurately destroy them.
04-17-2007, 06:13 PM#6
akolyt0r
what will be faster ??
ExecuteFunc or the use of dummy units:
Hidden information:
Collapse JASS:
constant function FS_TraceLength takes nothing returns real
    return 0.25
endfunction

constant function FS_AbilityId takes nothing returns integer
    return 'A000'
endfunction

constant function FireSprint_FX takes nothing returns string
    return "Environment\\LargeBuildingFire\\LargeBuildingFire2.mdl"
endfunction

function Trig_FS_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == FS_AbilityId()
endfunction

function FS_DummyId takes nothing returns integer
return 'h000'
endfunction

function FS_TimerActions takes nothing returns nothing
    local timer Timer= GetExpiredTimer()
    local string s= I2S(H2I(Timer))
    local unit Caster= I2U(GetStoredInteger(udg_gc , "FS" , "CasterUnit" + s))
    local location CasterLoc=GetUnitLoc(Caster)
    local player ownplayer= GetOwningPlayer(Caster)
    local unit Flames = CreateUnitAtLoc(ownplayer,FS_DummyId(),CasterLoc,0)
    local integer CurrPeriod = GetStoredInteger(udg_gc , "FS" , "Period" + s)
    call UnitApplyTimedLife(Flames , 'BTLF' , FS_TraceLength())
    if CurrPeriod < 113 then
        call StoreInteger(udg_gc , "FS" , "Period" + s , CurrPeriod + 1)
    else
        //CLEANUP Gamecache
        call FlushStoredInteger(udg_gc , "FS" , "Period" + s)
        call FlushStoredInteger(udg_gc , "FS" , "CasterUnit" + s)
        //CLEANUP Timer
        call PauseTimer(Timer)
        call DestroyTimer(Timer)
    endif
    //FINAL CLEANUP
    call RemoveLocation(CasterLoc)
    set CasterLoc = null
    set Flames = null
    set Caster = null
    call PolledWait(0.25)
endfunction

function Trig_FS_Actions takes nothing returns nothing
    local timer Timer= CreateTimer()
    local string s= I2S(H2I(Timer))
    local unit Caster= GetTriggerUnit()
    local integer Level= GetUnitAbilityLevel(Caster , FS_AbilityId())
    //Storing into Gamecache
    call StoreInteger(udg_gc , "FS" , "Level" + s , Level)
    call StoreInteger(udg_gc , "FS" , "CasterUnit" + s , H2I(Caster))
    call StoreInteger(udg_gc , "FS" , "Period" + s , 0)
    //Starting Timer
    call TimerStart(Timer,0.08,true,function FS_TimerActions)
    //CLEAN UP
    set Timer = null
    set Caster = null
endfunction

function InitTrig_FireSprint takes nothing returns nothing
    set gg_trg_FireSprint = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_FireSprint , EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(gg_trg_FireSprint , Condition(function Trig_FS_Conditions))
    call TriggerAddAction(gg_trg_FireSprint , function Trig_FS_Actions)
endfunction
04-17-2007, 06:21 PM#7
blu_da_noob
How do you propose to clean the effect off the dummy units?
04-17-2007, 06:30 PM#8
akolyt0r
Timed Life ...?!?!
Collapse JASS:
//...
call UnitApplyTimedLife(Flames , 'BTLF' , FS_TraceLength())
//...


EDIT: lol i just realized ...our avatars are quite similar ^^
04-17-2007, 06:39 PM#9
blu_da_noob
Quote:
Originally Posted by blu_da_noob
How do you propose to clean the effect off the dummy units?
04-17-2007, 06:43 PM#10
akolyt0r
hum ...why do i have to remove any effect ??
the effect disappears when ...the unit is removed ...
04-17-2007, 06:52 PM#11
blu_da_noob
The visual part disappears, yes. But the effect leaks if not destroyed.
04-17-2007, 08:54 PM#12
akolyt0r
Indeed ...i will use ExecuteFunc now :D

thx ..