Hi all!
Excuse me if this had already been asked hundred times before, but I used the search tool and did not find anything... relevant.
I did a trigger related to a tavern. The user has a shadow to choose a hero. When done, the shadow is killed and the hero is instantly placed at the center of a region. The heroes in the tavern are self-made heroes, I removed the originals ones. I use the "A unit finishes training of a unit" to get the selected hero, but it seems that it doesn't reckognizes it, because the trigger does nothing...
I don't how to put GUI here, so sorry but here's the script :
function Trig_Pick_Human_Conditions takes nothing returns boolean
if ( not ( IsUnitType(GetTrainedUnit(), UNIT_TYPE_HERO) == true ) ) then
return false
endif
return true
endfunction
function Trig_Pick_Human_Func003Func001001 takes nothing returns boolean
return ( GetOwningPlayer(GetEnumUnit()) == GetOwningPlayer(GetTrainedUnit()) )
endfunction
function Trig_Pick_Human_Func003A takes nothing returns nothing
if ( Trig_Pick_Human_Func003Func001001() ) then
call KillUnit( GetEnumUnit() )
else
call DoNothing( )
endif
endfunction
function Trig_Pick_Human_Actions takes nothing returns nothing
call RemoveUnitFromAllStock( GetUnitTypeId(GetTrainedUnit()) )
call SetUnitPositionLocFacingLocBJ( GetTrainedUnit(), GetRectCenter(gg_rct_Attack_Center_Human), GetUnitLoc(gg_unit_ofrt_0013) )
call ForGroupBJ( GetUnitsInRectAll(gg_rct_Ombre), function Trig_Pick_Human_Func003A )
endfunction
//===========================================================================
function InitTrig_Pick_Human takes nothing returns nothing
set gg_trg_Pick_Human = CreateTrigger( )
call TriggerRegisterUnitEvent( gg_trg_Pick_Human, gg_unit_n000_0111, EVENT_UNIT_TRAIN_FINISH )
call TriggerAddCondition( gg_trg_Pick_Human, Condition( function Trig_Pick_Human_Conditions ) )
call TriggerAddAction( gg_trg_Pick_Human, function Trig_Pick_Human_Actions )
endfunction
Excuse me if this had already been asked hundred times before, but I used the search tool and did not find anything... relevant.
I did a trigger related to a tavern. The user has a shadow to choose a hero. When done, the shadow is killed and the hero is instantly placed at the center of a region. The heroes in the tavern are self-made heroes, I removed the originals ones. I use the "A unit finishes training of a unit" to get the selected hero, but it seems that it doesn't reckognizes it, because the trigger does nothing...
I don't how to put GUI here, so sorry but here's the script :
function Trig_Pick_Human_Conditions takes nothing returns boolean
if ( not ( IsUnitType(GetTrainedUnit(), UNIT_TYPE_HERO) == true ) ) then
return false
endif
return true
endfunction
function Trig_Pick_Human_Func003Func001001 takes nothing returns boolean
return ( GetOwningPlayer(GetEnumUnit()) == GetOwningPlayer(GetTrainedUnit()) )
endfunction
function Trig_Pick_Human_Func003A takes nothing returns nothing
if ( Trig_Pick_Human_Func003Func001001() ) then
call KillUnit( GetEnumUnit() )
else
call DoNothing( )
endif
endfunction
function Trig_Pick_Human_Actions takes nothing returns nothing
call RemoveUnitFromAllStock( GetUnitTypeId(GetTrainedUnit()) )
call SetUnitPositionLocFacingLocBJ( GetTrainedUnit(), GetRectCenter(gg_rct_Attack_Center_Human), GetUnitLoc(gg_unit_ofrt_0013) )
call ForGroupBJ( GetUnitsInRectAll(gg_rct_Ombre), function Trig_Pick_Human_Func003A )
endfunction
//===========================================================================
function InitTrig_Pick_Human takes nothing returns nothing
set gg_trg_Pick_Human = CreateTrigger( )
call TriggerRegisterUnitEvent( gg_trg_Pick_Human, gg_unit_n000_0111, EVENT_UNIT_TRAIN_FINISH )
call TriggerAddCondition( gg_trg_Pick_Human, Condition( function Trig_Pick_Human_Conditions ) )
call TriggerAddAction( gg_trg_Pick_Human, function Trig_Pick_Human_Actions )
endfunction