• 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] Achievment Error

Status
Not open for further replies.
ok I'm working on my map Zombie Survival and I was redoing some triggering and my achievment system stopped working, then it lagged like crazy, not it works for the first one but doesn't do anything on the others. The system uses a simple loop and array.
JASS:
function Trig_Kills_Actions takes nothing returns nothing
    local unit u=GetKillingUnit()
    local player p=GetOwningPlayer(u)
    local integer i=0
    local integer a=GetPlayerId(p)+1
    set udg_Kills[a]=udg_Kills[a]+1
    call LeaderboardSetPlayerItemValueBJ(p,GetLastCreatedLeaderboard(),udg_Kills[a])
    call LeaderboardSortItemsByValue(GetLastCreatedLeaderboard(),false)
    if p!=Player(0)and p!=Player(11)then
        loop
            exitwhen i>4
            if udg_Kills[a]==udg_BonusKillNum[i]and GetUnitAbilityLevel(u,udg_Bonusspell[i])==0then
                call DisplayTextToForce(GetPlayersAll(),"|c00FFFF00"+GetPlayerName(p)+udg_Bonuss[i])
                call UnitAddAbility(GroupPickRandomUnit(GetUnitsOfPlayerAndTypeId(p,'H00A')),udg_Bonusspell[i])
            endif
        endloop
        if UnitHasItemOfTypeBJ(u,'kpin')==true then
            call SetUnitManaBJ(u,GetUnitState(u,UNIT_STATE_MANA)+1)
            call DestroyEffect(AddSpecialEffectTarget("Abilities\\Spells\\Undead\\ReplenishMana\\ReplenishManaCasterOverhead.mdl",u,"overhead"))
        endif
    endif
endfunction
function InitTrig_Kills takes nothing returns nothing
    set gg_trg_Kills=CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(gg_trg_Kills,EVENT_PLAYER_UNIT_DEATH)
    call TriggerAddAction(gg_trg_Kills,function Trig_Kills_Actions)
endfunction
-Thanks,
PS: the mana thingie doesn't work too, and it must be I'm a noob missing something important but i've looked over this many a time, so I'd be most greatful if that could be solved too:grin:
 
You never increment i.

JASS:
        loop
            exitwhen i>4
            if udg_Kills[a]==udg_BonusKillNum[i]and GetUnitAbilityLevel(u,udg_Bonusspell[i])==0then
                call DisplayTextToForce(GetPlayersAll(),"|c00FFFF00"+GetPlayerName(p)+udg_Bonuss[i])
                call UnitAddAbility(GroupPickRandomUnit(GetUnitsOfPlayerAndTypeId(p,'H00A')),udg_Bonusspell[i])
            endif
            set i = i + 1
        endloop
 
Status
Not open for further replies.
Top