• 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.

Wait in timer

Status
Not open for further replies.
maybe he meant a looping wait inside a timer?...sample, a timer runs for every 0.1 seconds, then damages enemy(s) for every 5 seconds inside the loop?...

to do this, you need to use hashtables/indexing, set it to zero first during the casting...
then increase the variable to 0.1, when it reaches 5.0 set it back again to zero inside the loop...
 
Level 9
Joined
Jul 4, 2007
Messages
130
an example of trigger:


JASS:
function timer takes nothing returns nothing
timer t = get expired timer blablabla.. (it is a 0.01 timer)

call BJDebugMsg("a")
call TriggerSleepAction(1.00)
call BJDebugMsg("b")

endfunction

well nothing happens past the wait...

ill try bribe thing

EDIT:
with Executefunc it simply skips the wait
and with a normal call it just bug like before :(

I dont get what u told me to do Justify ><
 
Last edited by a moderator:
Level 12
Joined
Feb 22, 2010
Messages
1,115
He probably writed something like this.

JASS:
function waitfunc takes nothing returns nothing
    call TriggerSleepAction(1.00)
endfunction

function somefunc takes something returns something

//something
    call ExecuteFunc("waitfunc")
//actions that will be executed 1 seconds later.
endfunction
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
Read first post and his post again, he is talking about something completely different.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
Then I should have read your post again, you were talking about something completely different.
 
He probably writed something like this.

JASS:
function waitfunc takes nothing returns nothing
    call TriggerSleepAction(1.00)
endfunction

function somefunc takes something returns something

//something
    call ExecuteFunc("waitfunc")
//actions that will be executed 1 seconds later.
endfunction

Yeah, which in that case of course would need to be changed to this:

JASS:
function waitfunc takes nothing returns nothing
    call TriggerSleepAction(1.00)
//actions that will be executed 1 seconds later.
endfunction

function somefunc takes something returns something

//something
    call ExecuteFunc("waitfunc")
endfunction
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
Save values to globals first, then call ExecuteFunc.

JASS:
function WaitedFunc takes nothing returns nothing
    local effect e = PassedEffect
    call TriggerSleepAction(PassedReal)
    call DestroyEffect(e)
    set e = null
endfunction

function MainFunction takes something returns something
//...
    set PassedEffect = AddSpecialEffectTarget(SomeUnit, "someEffect", "origin")
    set PassedReal = 5.00
    call ExecuteFunc("WaitedFunc")
//...
endfunction

or (I have never used it so I am not sure) you can use WaitedFunc.execute(unit, effect) to pass parameters, .execute use a trigger, a trigger action and globals to pass data.

I want my post to stay below 100:vw_sad:
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
Quite off-topic but you don't need to null handle arguments of function, they are not concerned with the bug (personally tested but you can test it yourself).
But locals declared in the corpse of a function have to be nulled, so it's lame when you have to return them :/ (just use a global in this case)
 
Level 16
Joined
Aug 7, 2009
Messages
1,406
JASS:
function WaitedFunc takes effect e, real yourtime returns nothing
    call TriggerSleppAction(yourtime)
    call DestroyEffect(e)
    set e = null
endfunction

function Mainfunction takes nothing reutrns nothing
   call WaitedFunc(youreffect, 5.)
endfunction

?????

That won't work. WaitedFunc will run in the thread Mainfunction is, where you can't use waits --> WaitedFunc will crash it. You have to execute that function.
 
Status
Not open for further replies.
Top