Dinowc
don't expect anything, prepare for everything
- Reaction score
- 223
can someone explain me why this isn't working?
it should give the players gold depending on number of units on the map, but nothing happens...
the debug msg appears though
EDIT: oh I forgot to create the group....
I feel so dumb
nvm
JASS:
library income initializer init
globals
public integer array INCOME
private integer array SALARY
private group G
endglobals
private function filterFunc takes nothing returns boolean
local unit u = GetFilterUnit()
if IsUnitType(u, UNIT_TYPE_STRUCTURE) == false then
set SALARY[GetPlayerId(GetOwningPlayer(u))] = SALARY[GetPlayerId(GetOwningPlayer(u))] + GetUnitPointValue(u)
endif
return false
endfunction
private function actions takes nothing returns nothing
local integer PROFIT = 0
local integer i = 0
call BJDebugMsg("works?")
call GroupEnumUnitsInRect(G, bj_mapInitialPlayableArea, Condition(function filterFunc))
loop
set PROFIT = INCOME[GetPlayerId(Player(i))] - SALARY[GetPlayerId(Player(i))]
call SetPlayerState(Player(i), PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(Player(i), PLAYER_STATE_RESOURCE_GOLD) + PROFIT)
call DisplayTextToForce(bj_FORCE_PLAYER<i>, "INCOME = " + I2S(INCOME[GetPlayerId(Player(i))]) + "; SALARY = " + I2S(SALARY[GetPlayerId(Player(i))]) + "; PROFIT = " + I2S(PROFIT))
set i = i + 1
exitwhen i == bj_MAX_PLAYER_SLOTS
endloop
endfunction
//====================================================
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
local integer i = 0
loop
set INCOME[GetPlayerId(Player(i))] = 100
set i = i + 1
exitwhen i == bj_MAX_PLAYER_SLOTS
endloop
call TriggerRegisterTimerEvent(t, 30.00, true)
call TriggerAddAction(t, function actions)
endfunction
endlibrary
</i>
it should give the players gold depending on number of units on the map, but nothing happens...
the debug msg appears though
EDIT: oh I forgot to create the group....
I feel so dumb
nvm