Why not use [LJASS]thistype[/LJASS], instead?
What?
Thistype refers to that struct, to be used within a struct.
What I said was for calling a static method outside of a struct.
Why not use [LJASS]thistype[/LJASS], instead?
Oh, I thought we were talking about coding spells inside of structs, like without any outside functions.
And just asking out of curiosity, what does GetHandleInt do?
GetHandleId. zz. Used for attaching. Every handle has it's own id(in integer). You will know that when you go playing with timers/triggers stuffs.
function GetHandleInt takes handle subject, string name returns integer
return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
endfunction
library DamageBonus initializer InitTrig
globals
private constant integer ABIL_ID1 = 039;ADa1039;
private constant integer ABIL_ID2 = 039;ADa2039;
private constant integer ABIL_ID3 = 039;ADa3039;
private constant integer ABIL_ID4 = 039;ADa4039;
private constant integer ABIL_ID5 = 039;ADa5039;
private constant integer DUMMY_ID = 039;h003039;
endglobals
globals
private integer array ABIL_ID
private unit dummy
endglobals
public function SetDamage takes real damage, unit caster returns nothing
local real r = damage
local integer array i
set i[0] = 0
if GetUnitAbilityLevel(caster, ABIL_ID[0]) == 0 then
loop
call UnitAddAbility(caster, ABIL_ID[i[0]])
set i[0] = i[0] + 1
exitwhen i[0] == 5
endloop
endif
set i[0] = 0
set i[1] = 10000
loop
set i[2] = R2I(r) / i[1]
call SetUnitAbilityLevel(caster, ABIL_ID[i[0]], i[2] +1)
set r = r - I2R(i[2] * i[1])
set i[1] = i[1] / 10
set i[0] = i[0] + 1
exitwhen i[0] == 5
endloop
endfunction
//===========================================================================
private function InitTrig takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
set ABIL_ID[0] = ABIL_ID1
set ABIL_ID[1] = ABIL_ID2
set ABIL_ID[2] = ABIL_ID3
set ABIL_ID[3] = ABIL_ID4
set ABIL_ID[4] = ABIL_ID5
set dummy = CreateUnit(Player(0), DUMMY_ID, 0, 0, 0)
loop
call UnitAddAbility(dummy, ABIL_ID<i>)
set i = i + 1
exitwhen i == 5
endloop
call RemoveUnit(dummy)
endfunction
endlibrary
</i>