The first thing is sorry for my bad English 
Idk how to post trigger in here then... i upload with picture and convert it into custom text
It cause infinity Loop when switch hero @@!
Help me with GUI
(
1st Hero is Hero[1-8] and 2nd is Hero[PlayerNumber+8]
InfinityLoopLol.png
Idk how to post trigger in here then... i upload with picture and convert it into custom text
It cause infinity Loop when switch hero @@!
Help me with GUI
1st Hero is Hero[1-8] and 2nd is Hero[PlayerNumber+8]
InfinityLoopLol.png
Code:
function Trig_Switch_Hero_Conditions takes nothing returns boolean
if ( not ( IsUnitPausedBJ(udg_Hero[GetConvertedPlayerId(GetTriggerPlayer())]) == false ) ) then
return false
endif
if ( not ( IsUnitDeadBJ(udg_Hero[GetConvertedPlayerId(GetTriggerPlayer())]) == false ) ) then
return false
endif
if ( not ( GetTriggerUnit() == udg_Hero[( GetConvertedPlayerId(GetTriggerPlayer()) + 8 )] ) ) then
return false
endif
if ( not ( GetPlayerController(GetTriggerPlayer()) == MAP_CONTROL_USER ) ) then
return false
endif
return true
endfunction
function Trig_Switch_Hero_Actions takes nothing returns nothing
set bj_forLoopAIndex = 1
set bj_forLoopAIndexEnd = 6
loop
exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
call UnitAddItemSwapped( UnitItemInSlotBJ(udg_Hero[GetConvertedPlayerId(GetTriggerPlayer())], GetForLoopIndexA()), udg_Hero[( GetConvertedPlayerId(GetTriggerPlayer()) + 8 )] )
set bj_forLoopAIndex = bj_forLoopAIndex + 1
endloop
call PauseUnitBJ( true, udg_Hero[GetConvertedPlayerId(GetTriggerPlayer())] )
call SetUnitPositionLoc( GetTriggerUnit(), GetUnitLoc(udg_Hero[GetConvertedPlayerId(GetTriggerPlayer())]) )
call AddSpecialEffectTargetUnitBJ( "origin", GetTriggerUnit(), "Abilities\\Spells\\Orc\\FeralSpirit\\feralspirittarget.mdl" )
call DestroyEffectBJ( GetLastCreatedEffectBJ() )
set udg_Hero[( GetConvertedPlayerId(GetTriggerPlayer()) + 8 )] = udg_Hero[GetConvertedPlayerId(GetTriggerPlayer())]
set udg_Hero[GetConvertedPlayerId(GetTriggerPlayer())] = GetTriggerUnit()
call SetUnitPositionLoc( udg_Hero[( GetConvertedPlayerId(GetTriggerPlayer()) + 8 )], GetRectCenter(gg_rct_SafeZone) )
call SelectUnitForPlayerSingle( udg_Hero[GetConvertedPlayerId(GetTriggerPlayer())], GetTriggerPlayer() )
call PauseUnitBJ( false, udg_Hero[GetConvertedPlayerId(GetTriggerPlayer())] )
endfunction
//===========================================================================
function InitTrig_Switch_Hero takes nothing returns nothing
set gg_trg_Switch_Hero = CreateTrigger( )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Switch_Hero, Player(0), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Switch_Hero, Player(1), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Switch_Hero, Player(2), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Switch_Hero, Player(3), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Switch_Hero, Player(4), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Switch_Hero, Player(5), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Switch_Hero, Player(6), true )
call TriggerRegisterPlayerSelectionEventBJ( gg_trg_Switch_Hero, Player(7), true )
call TriggerAddCondition( gg_trg_Switch_Hero, Condition( function Trig_Switch_Hero_Conditions ) )
call TriggerAddAction( gg_trg_Switch_Hero, function Trig_Switch_Hero_Actions )
endfunction
Last edited: