Warcraft III resources & community, 2003–2006 · archived

GetItemWoodCostById

not rated
Submitted by PitzerMikeFunctions0 downloads
Returns the wood cost of the chosen item type.

Thanks tho Darky for showing me a way to do this function.

Requires: FindNextItem

Source

//============================================================================================================ 
//
// For more JASS scripts, visit us at http://www.wc3JASS.com
//
//============================================================================================================ 

function GetItemWoodCostById takes integer Uid returns integer
local integer Val = GetPlayerState(Player(15),PLAYER_STATE_RESOURCE_GOLD)
local integer ValB = GetPlayerState(Player(15),PLAYER_STATE_RESOURCE_LUMBER)
local integer Diff
local unit U = CreateUnitAtLoc(Player(15),'nshe',GetRectCenter(GetPlayableMapRect()),bj_UNIT_FACING)
call AdjustPlayerStateBJ(50000,Player(15),PLAYER_STATE_RESOURCE_GOLD)
call AdjustPlayerStateBJ(50000,Player(15),PLAYER_STATE_RESOURCE_LUMBER)
call UnitAddAbilityBJ('Asid',U)
set Diff = GetPlayerState(Player(15),PLAYER_STATE_RESOURCE_LUMBER)
call AddItemToStockBJ(Uid,U,1,1)
call IssueTrainOrderByIdBJ(U,Uid)
set Diff = Diff - GetPlayerState(Player(15),PLAYER_STATE_RESOURCE_LUMBER)
call SetPlayerState(Player(15),PLAYER_STATE_RESOURCE_GOLD,Val)
call SetPlayerState(Player(15),PLAYER_STATE_RESOURCE_LUMBER,ValB)
call RemoveItem(FindNextItem(GetUnitLoc(U)))
call RemoveUnit(U)
return Diff
endfunction

Comments

0

No comments.