Trigger [request]

Lifee

New Member
Reaction score
46
Ok so i need trigger with timer 10 minutes, when this 10 minutes elapsed all items on the ground will be removed,and also will be created new timer with 10 minutes,and need 2 commands for this timer, when player 1 tupes -stop timer to make timer pause and when player 1 tupes -start timer to unpause this timer.Please help :)
 

tooltiperror

Super Moderator
Reaction score
231
I`ll do it, it will take a second though.

Create a trigger named 'ten minute' and delete everything in it. Then replace it with this.

JASS:
function r takes nothing returns nothing
    call RemoveItem(GetEnumItem())
endfunction
function Trig_ten_seconds_Actions takes nothing returns nothing
    call EnumItemsInRect(GetPlayableMapRect(),null,function r)
endfunction
function InitTrig_ten_minute takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterTimerEventPeriodic(t,600.00)
    call TriggerAddAction(t,function Trig_ten_seconds_Actions)
endfunction
 

tooltiperror

Super Moderator
Reaction score
231
But there will be BJ's, which suck, lag your map, and are pointless.
 

Lifee

New Member
Reaction score
46
ok do in jass but can you do in a Demo map, so i can copy because im noob and dont know jass ? and also commands please :)
 

Nherwyziant

Be better than you were yesterday :D
Reaction score
96
But there will be BJ's, which suck, lag your map, and are pointless.

You mean,

Create a trigger, rename it to Timer, then convert it to Jass, then paste this code to it.

JASS:
//Timer stuffs for Lifee, by Nherwyziant

scope Timer initializer I

    //CHANGE EVERYHING IN THESE PART TO WHAT EVER YOU WAN'T
    globals
        private constant real TIMEOUT     = 10.            //The time of timer.
        private constant string PAUSETYPE = "-stop timer"  //Type to stop timer.
        private constant string STARTTIMER= "-start timer"//Type to resume timer.
        private constant string TIMERNAME = "Timer"        //The timer name.
    endglobals

    //=========NOW DO NOT TOUCH BELOW=============\\

    globals
        timer b = CreateTimer()
    endglobals

    function Remove takes nothing returns nothing
        call RemoveItem(GetEnumItem())
    endfunction

    private function A1 takes nothing returns nothing
        call EnumItemsInRect(bj_mapInitialPlayableArea,null,function Remove)
    endfunction
    
    private function A2 takes nothing returns nothing
        set bj_lastStartedTimer = b
        call TimerStart(b,TIMEOUT,true, null)
        call CreateTimerDialog(b)
        set bj_lastCreatedTimerDialog = CreateTimerDialog(b)
        call TimerDialogSetTitle(bj_lastCreatedTimerDialog,TIMERNAME)
        call TimerDialogDisplay(bj_lastCreatedTimerDialog,true)
        call TimerDialogDisplay(bj_lastCreatedTimerDialog,true)
    endfunction
    
    private function A3 takes nothing returns nothing
        call PauseTimer(b)
    endfunction
    
    private function A4 takes nothing returns nothing
        call ResumeTimer(b)
    endfunction

    private function I takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterTimerExpireEvent(t,b)
        call TriggerAddAction(t,function A1)
        
        set t = CreateTrigger()
        call TriggerRegisterTimerEvent(t,0.,false)
        call TriggerAddAction(t,function A2)
        
        set t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent(t,Player(0),PAUSETYPE,true)
        call TriggerAddAction(t,function A3)
        
        set t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent(t,Player(0),STARTTIMER,true)
        call TriggerAddAction(t,function A4)
    endfunction
    
endscope


EDIT: OK requires vJASS as wat tooltiperror says. GO NewGen to download that, use newgen it's better than plain WE

Here you go a demo map.
 

Nherwyziant

Be better than you were yesterday :D
Reaction score
96

Ayanami

칼리
Reaction score
288
GUI might be inefficient. However, coupled with few JASS knowledge, it can be effective. Sure some functions cannot be done in GUI. But that doesn't mean that GUI is an epic fail.
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top