- Joined
- Aug 25, 2004
- Messages
- 473
I need a function that will set an Integer_X to the gold cost of an Item.
Ive also found this script:
What is the Custom script function to set Integer_X to the gold value of an item?
THe description also say that it Requires: FindNextItem . What does it mean?
Ive also found this script:
Code:
function GetItemGoldCostById 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_GOLD)
call AddItemToStockBJ(Uid,U,1,1)
call IssueTrainOrderByIdBJ(U,Uid)
set Diff = Diff - GetPlayerState(Player(15),PLAYER_STATE_RESOURCE_GOLD)
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
What is the Custom script function to set Integer_X to the gold value of an item?
THe description also say that it Requires: FindNextItem . What does it mean?