• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] get an items lumber cost ?

Status
Not open for further replies.
Level 14
Joined
Jun 27, 2008
Messages
1,325
and i need it to get lumber cost of item so if someone buys item they arent allowed to get in my map then it returns there lumber

Still lumbercost is a property of ItemType, not Item. Its not really a big deal, but implies that your items have individual values for lumbercost. Thats confusing.

What you want is GetLumberCost(GetItemType(GetManipulatedItem())) or GetLumberCost(GetItemTypeId(GetManipulatedItem))).
Which means GetLumberCost takes an itemtype or an integer, not an item.
 
Level 14
Joined
Jun 27, 2008
Messages
1,325
Actually, it has an GetItemWoodCost function that takes an item : p. It returns the item's total cost, accounting for the charges on the item.

ok that does make sense, i forgot about charges...

ya basically tht muzzel except there is no getlumbercost
there is one, in the lib nestharus linked. Its just named differently... If there was a native this whole thread wouldnt exist.
 
i didnt know u were reffering to nestharus' system but thx i might just make one for mine since its only for a small portion of my game tht i need it for and i like to make my own things lol it will be based a little off of urs tho thx nestharus and thx muzzel

edit: one question does this order cause the unit to simulate buying the item ?
JASS:
call IssueNeutralImmediateOrderById(p,u,id)
or am i just missing something in the code ? i hope it does it'll make it so all i need to do is add about 10 lines of code or less to my item buying trigger to make it work properly

edit2: sweet it works as i expected thanks i didnt know there was a way to do simulate buying items like tht. thx tht helps me a lot

edit 3: got all the bugs out heres what i turned it down into and works perfect
JASS:
private function destroyItems takes nothing returns nothing
    local item Item
    set Item = GetEnumItem()
    call RemoveItem( Item)
    set Item = null
endfunction

private function settingLumberCosts takes nothing returns nothing
    local integer Loop = 33
    local unit u = gg_unit_n01M_0127
    local integer maxLumber = 1000000 // 1 mil
    local integer itemLumber
    local rect r = gg_rct_Delete_Items
    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
        set Loop = Loop + 1
    endloop
    call EnumItemsInRect( r, null, function destroyItems)
    call ShowUnit( u, false )
    set u = null
    set r = null
endfunction
 
Last edited:
Status
Not open for further replies.
Top