- Joined
- Aug 20, 2014
- Messages
- 263
I have been working on this code all the night. I already tryed to solve the inssue by myself before post here. The problem is that the code don't add the unit to unit group. I don't know why.
Code:
function Trig_BladeMasterSet_Conditions takes nothing returns boolean
if ( not ( IsUnitType(GetTrainedUnit(), UNIT_TYPE_HERO) == true ) ) then
return false
endif
return true
endfunction
function Trig_BladeMasterSet_Func007C takes nothing returns boolean
if ( not ( 'Obla' == GetUnitTypeId(GetTrainedUnit()) ) ) then
return false
endif
return true
endfunction
function Trig_BladeMasterSet_Actions takes nothing returns nothing
set udg_DemonNumber = 1
call GroupAddUnitSimple( GetTrainedUnit(), udg_BlademasterDeathlist[2] )
call GroupAddUnitSimple( GetTrainedUnit(), udg_BlademasterDeathlist[1] )
call GroupAddUnitSimple( GetTrainedUnit(), udg_BlademasterDeathlist[3] )
call GroupAddUnitSimple( GetTrainedUnit(), udg_BlademasterDeathlist[4] )
if ( Trig_BladeMasterSet_Func007C() ) then
set udg_BlademasterCounter = ( udg_BlademasterCounter + 1 )
set udg_Blademaster[udg_BlademasterCounter] = GetTrainedUnit()
set udg_BlademasterOwner[udg_BlademasterCounter] = GetOwningPlayer(GetTrainedUnit())
else
endif
endfunction
//===========================================================================
function InitTrig_BladeMasterSet takes nothing returns nothing
set gg_trg_BladeMasterSet = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_BladeMasterSet, EVENT_PLAYER_UNIT_TRAIN_FINISH )
call TriggerAddCondition( gg_trg_BladeMasterSet, Condition( function Trig_BladeMasterSet_Conditions ) )
call TriggerAddAction( gg_trg_BladeMasterSet, function Trig_BladeMasterSet_Actions )
endfunction