- Joined
- Mar 2, 2010
- Messages
- 3,069
i havent used jass before but it seems that i have gotten as far as i can with the trigger editor. therefore i need to learn jass. please teach me how to code in a limit to maximum gold.
library LimitGold initializer InitTrig_LimitGold
globals
private constant integer MAX_GOLD = 100
endglobals
private function Actions takes nothing returns nothing
call SetPlayerState( GetTriggerPlayer() , PLAYER_STATE_RESOURCE_GOLD , MAX_GOLD )
endfunction
private function InitTrig_LimitGold takes nothing returns nothing
local integer i = 0
local trigger LimitGold = CreateTrigger()
loop
exitwhen i == 12
call TriggerRegisterPlayerStateEvent( LimitGold , Player(i) , PLAYER_STATE_RESOURCE_GOLD, GREATER_THAN, MAX_GOLD )
set i = i + 1
endloop
call TriggerAddAction( LimitGold, function Actions )
endfunction
endlibrary
that jass doesnt work. the error message i got was that the trigger was disabled because of some error. the trigger editor is too limited so i have to use jass.
What is this
I don't even.
Jass NewGen Pack does NOT make you lose your wc3 license. Wc3 doesn't even know whether a map has been made with the regular editor or Jass NewGen Pack.
Edit: Btw, JNGP converts the vJASS code into regular JASS.
function LimitGoldActions takes nothing returns nothing
call SetPlayerState( GetTriggerPlayer() , PLAYER_STATE_RESOURCE_GOLD , 1000) // Change "1000" into the maximum gold
endfunction
function InitTrig_LimitGold takes nothing returns nothing
local integer i = 0
local trigger gg_trg_LimitGold = CreateTrigger()
loop
exitwhen i >= 12
call TriggerRegisterPlayerStateEvent(gg_trg_LimitGold, Player(i), PLAYER_STATE_RESOURCE_GOLD, GREATER_THAN, 1000) // change "1000" into the maximum gold
set i = i + 1
endloop
call TriggerAddAction(gg_trg_LimitGold, function LimitGoldActions )
endfunction