- Joined
- Oct 24, 2012
- Messages
- 6,545
hello im trying to get an items lumber cost and put it into an array it works w this code
but when i call it in a trigger it doesnt work for player 11 ?
JASS:
function Trig_Untitled_Trigger_003_Actions takes nothing returns nothing
call AddItemToStock( gg_unit_n01L_0127, itemIDS[33],1,1)
call IssueNeutralImmediateOrderById( Player(0), gg_unit_n01L_0127, itemIDS[33])
call RemoveItemFromStock( gg_unit_n01L_0127, itemIDS[33])
call BJDebugMsg( "builds item")
endfunction
//===========================================================================
function InitTrig_Untitled_Trigger_003 takes nothing returns nothing
set gg_trg_Untitled_Trigger_003 = CreateTrigger( )
call TriggerRegisterPlayerChatEvent( gg_trg_Untitled_Trigger_003, Player(0), "-builditem", false)
call TriggerAddAction( gg_trg_Untitled_Trigger_003, function Trig_Untitled_Trigger_003_Actions )
endfunction
//works as expected just place in a loop
JASS:
private function settingLumberCosts takes nothing returns nothing
local integer Loop = 33
local unit u = gg_unit_n01L_0127
local integer maxLumber = 1000000 // 1 mil
local integer itemLumber
local unit Hero = gg_unit_Nalc_0128
call SetUnitOwner( Hero, Player(11), true)
loop
exitwhen Loop > 39
call SetPlayerState( Player(11), PLAYER_STATE_RESOURCE_LUMBER, maxLumber)
call AddItemToStock( u, itemIDS[Loop], 1, 1)
call IssueNeutralImmediateOrderById( Player(11), u, itemIDS[Loop])
call RemoveItemFromStock( u, itemIDS[Loop])
set itemLumber = GetPlayerState( Player(11), PLAYER_STATE_RESOURCE_LUMBER)
set lumberCost[Loop] = maxLumber - itemLumber
call RemoveItem( UnitItemInSlot( Hero, 0))
call DisplayTextToForce( GetPlayersAll(), I2S(Loop) + " " + I2S(lumberCost[Loop]))
set Loop = Loop + 1
endloop
call ShowUnit( u, false )
call ShowUnit( Hero, false )
set u = null
set Hero = null
endfunction