How to put a limit of time? - TimerDialog

Nocturne

New Member
Reaction score
1
Hello,
I did a modifycation to this trigger in order that it could revive in a random region... But now I want to put a limit of time to revive... of 120 seconds.

Can someone help to do it? i don't know nothing about JASS :(

Code:
Revive
    Events
        Unit - A unit Dies
    Conditions
        ((Triggering unit) is A Hero) Equal to True
        ((Triggering unit) belongs to an ally of Player 11 (Dark Green)) Equal to True
    Actions
        Custom script:   local timerdialog WINDOW
        Custom script:   local integer HEROWAIT
        Custom script:   local timer OURTIMER
        Custom script:   local unit OURHERO
        Custom script:   set OURHERO = GetDyingUnit()
        Custom script:   set HEROWAIT = ( GetHeroLevel(OURHERO) * 4 )
        Custom script:   set OURTIMER = CreateTimer()
        Custom script:   call StartTimerBJ( OURTIMER, false, ( I2R(HEROWAIT) ))
        Custom script:   call CreateTimerDialogBJ( OURTIMER, GetPlayerName(GetOwningPlayer(OURHERO)) )
        Custom script:   set WINDOW = GetLastCreatedTimerDialogBJ()
        Custom script:   call TimerDialogDisplayForPlayerBJ( true, WINDOW, GetOwningPlayer(OURHERO) )
        Custom script:   call PolledWait( HEROWAIT )
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Random integer number between 1 and 100) Less than or equal to 50
            Then - Actions
                Custom script:   call ReviveHeroLoc( GetTriggerUnit(), GetRectCenter(gg_rct_ItemsHums), true )
                Custom script:   call PanCameraToTimedLocForPlayer( GetOwningPlayer(OURHERO), GetUnitLoc(OURHERO), 0.60 )
                Custom script:   call DestroyTimerDialog(WINDOW)
            Else - Actions
                Custom script:   call ReviveHeroLoc( GetTriggerUnit(), GetRectCenter(gg_rct_HumsBL), true )
                Custom script:   call PanCameraToTimedLocForPlayer( GetOwningPlayer(OURHERO), GetUnitLoc(OURHERO), 0.60 )
                Custom script:   call DestroyTimerDialog(WINDOW)
 

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
change that:
Code:
        Custom script:   set HEROWAIT = ( GetHeroLevel(OURHERO) * 4 )
to that:
Code:
        Custom script:   set HEROWAIT = 120
 

Nocturne

New Member
Reaction score
1
change that:
Code:
        Custom script:   set HEROWAIT = ( GetHeroLevel(OURHERO) * 4 )
to that:
Code:
        Custom script:   set HEROWAIT = 120

thanks for help me, but i only want to establish a limit of 120 seconds. For example:
A hero Level 4 Die -> Revive in 16 seconds
A hero Level 8 Die -> Revive in 32 seconds
But if a hero level 40 die it will revive in 160 seconds( and i don't want that)... Well i in that case i want to revive in 120 seconds...

Thanks
 

trb92

Throwing science at the wall to see what sticks
Reaction score
142
>Well i in that case i want to revive in 120 seconds...

Oh, easy. Simply add these lines after the set HEROWAIT line

Code:
        Custom script:   if HEROWAIT > 120 then
        Custom script:      set HEROWAIT = 120
        Custom script:   endif
And HEROWAIT will never go above 120.
 

Nocturne

New Member
Reaction score
1
>Well i in that case i want to revive in 120 seconds...

Oh, easy. Simply add these lines after the set HEROWAIT line

Code:
        Custom script:   if HEROWAIT > 120 then
        Custom script:      set HEROWAIT = 120
        Custom script:   endif
And HEROWAIT will never go above 120.

Thanks!! But have I to put it exactly this way?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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