- Joined
- Oct 12, 2008
- Messages
- 1,570
Hello people,,
I tried to do some vJass some day,,
And this is what i made,, I am asking you for any mistakes i made or improvements!
Thanks!
-Yixx,,-
EDIT: I had a good look at Dynasti's spells to understand properly how to manage methods!
Thank you Dynasti =)
RE-EDIT: My computer wont let me instal any vJass programs (Yet, but it will!), so mistakes in typing are not stupid, =P
Well, they still are, but you know what i mean!
I tried to do some vJass some day,,
And this is what i made,, I am asking you for any mistakes i made or improvements!
JASS:
library GoldGain Initializer Init
globals
private constant real TimeInterval = 60
private constant real array GoldPerInterval
private constant integer AbID = 'A000'
endglobals
struct GG
unit u
timer t
method Start
local GG g = g.Allocate()
set g.u = GetTriggerUnit
call TimerStart(g.t, TimeInterval, true, function GG.Loop)
endmethod
method Loop
local GG g = g.Allocate()
if GetUnitAbilityLevel(g.u, AbID()) != 0 then
call SetPlayerState(GetOwningPlayer(g.u), PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(GetOwningPlayer(g.u), PLAYER_STATE_RESOURCE_GOLD) + GoldPerInterval[GetUnitAbilityLevel(g.u, AbID)])
else
call PauseTimer(g.t)
call Destroy Timer(g.t)
endif
endstruct
function Init takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 1
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_HERO_SKILL)
call TriggerAddAction(t, function GG.Start)
loop
exitwhen i = 4
set GoldPerInterval[i] = -20 + 60 * i
endloop
endfunction
endlibrary
Thanks!
-Yixx,,-
EDIT: I had a good look at Dynasti's spells to understand properly how to manage methods!
Thank you Dynasti =)
RE-EDIT: My computer wont let me instal any vJass programs (Yet, but it will!), so mistakes in typing are not stupid, =P
Well, they still are, but you know what i mean!
Last edited: