Trollvottel
never aging title
- Reaction score
- 262
no system, but a quite different version:
(didnt test it and now that many people dont like gamecache):
(didnt test it and now that many people dont like gamecache):
JASS:
library KillCount initializer Init
globals
private gamecache CACHE
endglobals
private function U2I takes unit u returns integer
return u
return 0
endfunction
public function Get takes unit u returns integer
return GetStoredInteger(CACHE, "kills", I2S(U2I(u)))
endfunction
private function Action takes nothing returns nothing
local unit die = GetTriggerUnit()
local unit kill = GetKillingUnit()
local integer id1 = U2I(die)
local integer id2 = U2I(kill)
call StoreInteger(CACHE, "kills", I2S(id2), GetStoredInteger(CACHE, "kills", I2S(id2)+1))
if IsUnitType(die, UNIT_TYPE_HERO) != true then
call StoreInteger(CACHE, "kills", I2S(id1), 0)
endif
endfunction
private function Init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterPlayerUnitEvent(t, GetLocalPlayer(), EVENT_PLAYER_UNIT_DEATH)
call TriggerAddAction(t, function Action)
call InitGameCache("CACHE")
endfunction
endlibrary