i was used to this script before but now i wasnt able to make it right..i dont know why.. and it causes me lag before so i want to configure a bit but i dont know how..
i have no idea why it gives me syntax errors
JASS:
scope ItemGet initializer onInit
globals
private constant integer MY_ITEM = 'I000'
private constant integer MY_SPELL = 'A000'
private constant integer MY_SPELLBOOK = 'A001'
endglobals
private function a takes nothing returns nothing
local unit hero = GetTriggerUnit()
local integer level = GetUnitAbilityLevel(hero, MY_SPELL)
if level == 0 then
call UnitAddAbility(hero, MY_SPELLBOOK)
else
call SetUnitAbilityLevel(hero, MY_SPELL, level + 1)
endif
set hero = null
endfunction
private function c takes nothing returns boolean
return GetItemTypeId(GetManipulatedItem()) == MY_ITEM
endfunction
private function onInit takes nothing returns nothing
local trigger t = CreateTrigger( )
TriggerAddCondition(t, Condition(function c))
TriggerAddAction(t, function a)
TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_PICKUP_ITEM)
endfunction
endscope
i have no idea why it gives me syntax errors