• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] [Jass] Trigger not registering heros properly

Status
Not open for further replies.
Level 3
Joined
Jul 9, 2006
Messages
23
Set Heros
JASS:
globals
    integer Q
endglobals

function IsHero takes nothing returns boolean
    return IsUnitType(GetEnumUnit(), UNIT_TYPE_HERO)
endfunction

function SetHero takes nothing returns nothing
    set udg_Player_Heros[Q] = GetFilterUnit()
endfunction

function Trig_Set_Heros_Actions takes nothing returns nothing
    local integer P
    set Q = 0
    set P = 11
    loop
        exitwhen Q > P
        call ForGroupBJ(GetUnitsOfPlayerMatching(Player(Q), Condition(function IsHero)), function SetHero )
        set Q = Q + 1
    endloop
endfunction

//===========================================================================
function InitTrig_Set_Heros takes nothing returns nothing
    set gg_trg_Set_Heros = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_Set_Heros, 60.00 )
    call TriggerAddAction( gg_trg_Set_Heros, function Trig_Set_Heros_Actions )
endfunction

NoHeroKICK
JASS:
function HeroExists takes nothing returns boolean
    return udg_Player_Heros[GetForLoopIndexA()] == null
endfunction

function Trig_NoHeroKICK_Actions takes nothing returns nothing
    set bj_forLoopAIndex = 0
    set bj_forLoopAIndexEnd = 11
    loop
        exitwhen bj_forLoopAIndex > bj_forLoopAIndexEnd
        if ( HeroExists() ) then
            call CustomDefeatBJ(Player(GetForLoopIndexA()), "Baka! You didn't pick a hero!")
            call DisplayTextToForce(GetPlayersAll(), "Player " + I2S(GetForLoopIndexA() + 1) + " has been kicked because no hero was chosen by this player.")
        else
        endif
        set bj_forLoopAIndex = bj_forLoopAIndex + 1
    endloop
endfunction

//===========================================================================
function InitTrig_NoHeroKICK takes nothing returns nothing
    set gg_trg_NoHeroKICK = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_NoHeroKICK, 61.00 )
    call TriggerAddAction( gg_trg_NoHeroKICK, function Trig_NoHeroKICK_Actions )
endfunction

Basically, I've tested it alone and gotten it to kick me, but it shows the message that its kicked everyone so I think it is kicking everyone. Any and all help appreciated.
 
Status
Not open for further replies.
Top