- Joined
- Nov 25, 2008
- Messages
- 1,309
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.
-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
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
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
