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

[vJASS] Vjass Timer Help

Status
Not open for further replies.
Level 6
Joined
Sep 19, 2007
Messages
215
So ive been trying to create a quest system in Vjass since ive been slowly getting better at it and ive read around i should not use waits like i have in the trigger below so what im wondering is how would i go about doing what you can clearly see in the trigger ( Unit talks wait certain amount time clears message and he says something else and so on until quest starts) So can anyone please tell me how i can edit this into using timers or maybe even another way its driving me insane

JASS:
function Trig_QuestSystem_Actions takes nothing returns nothing

    local unit Qu = GetTriggerUnit()
    local unit Pu = GetBuyingUnit()
    local player P = GetOwningPlayer(Pu)
    local integer Pi = GetPlayerId(P)
    local string It = GetItemName(GetSoldItem())
    local string Pun = GetUnitName(Pu)
    local string S = ""
            if It == "Accept" then//// Accept Item
                if Qu == udg_QuestUnits[1] then//// Krillin
                    if Quest1Started[Pi] == false and Quest1Complete[Pi] == false then
                        set Quest1Started[Pi] = TRUE
                        set S = "Am I happy to see you "  + Pun + " Do you have any idea where we are?"
                            call DisplayTextToPlayer(P,0,0,S)
                            call TriggerSleepAction(3)
                            call ClearTextMessages()
                        set S = "Blah Blah"
                            call DisplayTextToPlayer(P,0,0,S)
                            call TriggerSleepAction(2)
                    endif
                endif
            endif
           
endfunction

Edit: Yes i Have TimerUltis In my map just dont know how to use them properly yet all tutorials ive found are outdated or i just couldnt make sense of them.
 
Last edited:
Level 7
Joined
Mar 10, 2013
Messages
366
Two questions before anything: Why you can't use the sleep actions? And why you're using PolledWait instead of TriggerSleepAction?

Put your code inside of jass tags instead of code.
 
Level 7
Joined
Mar 10, 2013
Messages
366
Ive read around that If i use those it stops the trigger and its not MUI anymore
What you mean by stop the trigger? Isn't that what you want?
You mean it hangs the processor and the event can't be called in another instance because it's waiting? If you think is that, it's not the case.
 
Level 6
Joined
Sep 19, 2007
Messages
215
ya like if i started it then another player came up and started the same thing while mine was still running would it still run everything for him?
 
Level 7
Joined
Mar 10, 2013
Messages
366
ya like if i started it then another player came up and started the same thing while mine was still running would it still run everything for him?
Yes. Test this: Create a trigger that fires when a player (can be red) Skips a Cinematic (press ESC) and then Wait 10 seconds and then place a Footman in the middle of playable map area. Now, once testing, press the Esc button like twenty times, very very fast. After a while, twenty footmans will pop at the same rate you pressed Esc.

This basically means that each event runs parallel to each other.
 
You can do timers like this:

JASS:
// will be called only by the timer
function callback_clean takes nothing returns nothing
    call ClearTextMessages()
    call DestroyTimer(GetExpiredTimer())
endfunction

// runs normaly, somehow
function main takes nothing returns nothing
    local timer t = CreateTimer()
    call DisplayTextToPlayer(GetLocalPlayer() , 0, 0, "Hello")
    call TimerStart(t, 1, false, function callback_clean) // will call the other function after 1 second

    set t = null
endfunction
 
Status
Not open for further replies.
Top