So, I decided to make a system for my dungeons, that when a player types "-out" and are not within some certain areas. They are teleported to the townsquare, their hero is paused for a set amount of time and a dialog box is shown counting down until the hero should be unpaused and being able to resume play. There is just one problem, everything works fine until the time has run out, and play is supposed to be resumed. There is 2 problems.
1. The Countdown box will not dissapear.
2. The hero will not be unpaused.
The trigger is based upon my hero revival system, that is in many ways like this one. It works perfectly fine without any problems.
The "-out" system.
The hero revival system
Would be happy for any response, and how do I hide the code using spoilers?
Also, how do I do to include the timer "HEROWAIT" in the string below?
EDIT: Might have figured out how to display the time in the message.
1. The Countdown box will not dissapear.
2. The hero will not be unpaused.
The trigger is based upon my hero revival system, that is in many ways like this one. It works perfectly fine without any problems.
The "-out" system.
JASS:
function Trig_Untitled_Trigger_001_Func009Func001C takes nothing returns boolean
if ( not ( RectContainsUnit(gg_rct_Bandit_C_Entrance, GetEnumUnit()) != true ) ) then
return false
endif
if ( not ( RectContainsUnit(gg_rct_Bandit_W_Entrance, GetEnumUnit()) != true ) ) then
return false
endif
if ( not ( RectContainsUnit(gg_rct_Murloc_Entrance, GetEnumUnit()) != true ) ) then
return false
endif
if ( not ( RectContainsUnit(gg_rct_Dungeon, GetEnumUnit()) == true ) ) then
return false
endif
if ( not ( IsUnitType(GetEnumUnit(), UNIT_TYPE_HERO) == true ) ) then
return false
endif
return true
endfunction
function Trig_Untitled_Trigger_001_Func009A takes nothing returns nothing
local timerdialog WINDOW
local integer HEROWAIT
local timer OURTIMER
local unit OURHERO
if ( Trig_Untitled_Trigger_001_Func009Func001C() ) then
set OURHERO = GetEnumUnit()
set HEROWAIT = ( GetHeroLevel(OURHERO) * 1 )
set OURTIMER = CreateTimer()
call SetUnitPositionLoc( GetEnumUnit(), GetRectCenter(gg_rct_High_Spawn) )
call PanCameraToTimedLocForPlayer( GetTriggerPlayer(), GetRectCenter(gg_rct_High_Spawn), 0 )
call DisplayTextToForce( GetForceOfPlayer(GetTriggerPlayer()), "Your hero has been frozen for a few seconds" )
call PauseUnitBJ( true, GetEnumUnit() )
call StartTimerBJ( OURTIMER, false, ( I2R(HEROWAIT)) )
call CreateTimerDialogBJ( OURTIMER, GetPlayerName(GetOwningPlayer(OURHERO)))
set WINDOW = GetLastCreatedTimerDialogBJ()
call TimerDialogDisplayForPlayerBJ( true, WINDOW, GetOwningPlayer(OURHERO))
call PolledWait ( HEROWAIT )
call DestroyTimerDialog(WINDOW)
call PauseUnitBJ( false, GetEnumUnit() )
else
endif
endfunction
function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
call ForGroupBJ( GetUnitsInRectOfPlayer(GetPlayableMapRect(), GetTriggerPlayer()), function Trig_Untitled_Trigger_001_Func009A )
endfunction
//===========================================================================
function InitTrig_TP_Out_not_in_exit_zone takes nothing returns nothing
set gg_trg_TP_Out_not_in_exit_zone = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_TP_Out_not_in_exit_zone, Player(0), "-out", true )
call TriggerRegisterPlayerChatEvent( gg_trg_TP_Out_not_in_exit_zone, Player(1), "-out", true )
call TriggerRegisterPlayerChatEvent( gg_trg_TP_Out_not_in_exit_zone, Player(2), "-out", true )
call TriggerRegisterPlayerChatEvent( gg_trg_TP_Out_not_in_exit_zone, Player(3), "-out", true )
call TriggerRegisterPlayerChatEvent( gg_trg_TP_Out_not_in_exit_zone, Player(4), "-out", true )
call TriggerRegisterPlayerChatEvent( gg_trg_TP_Out_not_in_exit_zone, Player(5), "-out", true )
call TriggerRegisterPlayerChatEvent( gg_trg_TP_Out_not_in_exit_zone, Player(6), "-out", true )
call TriggerRegisterPlayerChatEvent( gg_trg_TP_Out_not_in_exit_zone, Player(7), "-out", true )
call TriggerAddAction( gg_trg_TP_Out_not_in_exit_zone, function Trig_Untitled_Trigger_001_Actions )
endfunction
The hero revival system
JASS:
function Trig_Death_Conditions takes nothing returns boolean
if ( not ( IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) == true ) ) then
return false
endif
return true
endfunction
function Trig_Death_Actions takes nothing returns nothing
local timerdialog WINDOW
local integer HEROWAIT
local timer OURTIMER
local unit OURHERO
set OURHERO = GetDyingUnit()
set HEROWAIT = ( GetHeroLevel(OURHERO) * 5 )
set OURTIMER = CreateTimer()
call StartTimerBJ( OURTIMER, false, ( I2R(HEROWAIT) ))
call CreateTimerDialogBJ( OURTIMER, GetPlayerName(GetOwningPlayer(OURHERO)))
set WINDOW = GetLastCreatedTimerDialogBJ()
call TimerDialogDisplayForPlayerBJ( true, WINDOW, GetOwningPlayer(OURHERO))
call PolledWait ( HEROWAIT )
call ReviveHeroLoc(OURHERO, GetRectCenter(gg_rct_High_Spawn), true )
call PanCameraToTimedLocForPlayer( GetOwningPlayer(OURHERO), GetUnitLoc(OURHERO), 0.60)
call DestroyTimerDialog(WINDOW)
endfunction
//===========================================================================
function InitTrig_Death takes nothing returns nothing
set gg_trg_Death = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_Death, EVENT_PLAYER_UNIT_DEATH )
call TriggerAddCondition( gg_trg_Death, Condition( function Trig_Death_Conditions ) )
call TriggerAddAction( gg_trg_Death, function Trig_Death_Actions )
endfunction
Would be happy for any response, and how do I hide the code using spoilers?
Also, how do I do to include the timer "HEROWAIT" in the string below?
JASS:
call DisplayTextToForce( GetForceOfPlayer(GetTriggerPlayer()), "Your hero has been frozen for a few seconds" )
EDIT: Might have figured out how to display the time in the message.