• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Add trained hero to unit group don't work

Status
Not open for further replies.
Level 15
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
 
Status
Not open for further replies.
Top