• 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.

[Solved] Order unit to sell item to unit

Status
Not open for further replies.
Level 8
Joined
Dec 9, 2009
Messages
397
As the title says, been looking around for quite a while, can't seem to find an order to sell an item

Tried to use the give item order, but it just sets the item next to the store.
 
Level 8
Joined
Dec 9, 2009
Messages
397
Am I able to use arrays in custom script? How would I specify HeroSave[(playernumber(ownerofunit(castingunit)))]
Would that be right in the script?
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
Am I able to use arrays in custom script? How would I specify HeroSave[(playernumber(ownerofunit(castingunit)))]
Would that be right in the script?

udg_HeroSave[GetPlayerId(GetOwningUnit(GetTriggerUnit()))]

Note that GetPlayerId() returns 0 for player 1, 1 for player 2 and so on. The GUI action returns 1 for player 1, 2 for player 2 so you might have to use udg_HeroSave[1+GetPlayerId(GetOwningUnit(GetTriggerUnit()))]
 
Level 8
Joined
Dec 9, 2009
Messages
397
Jasshelper is giving me error, could you fix this?

  • Custom script: call UnitDropItemTarget(udg_HeroSave[1+GetPlayerId(GetOwningUnit(GetTriggerUnit()))] , udg_TempItem, udg_Shop[1+GetPlayerId(GetOwningUnit(GetTriggerUnit()))])
 
Level 8
Joined
Dec 9, 2009
Messages
397
Thats what I thought you meant, I tried:

  • Custom script: call UnitDropItemTarget(udg_HeroSave[1+GetPlayerId(GetOwningPlayer(GetTriggerUnit()))] , udg_TempItem, udg_Shop[1+GetPlayerId(GetOwningPlayer(GetTriggerUnit()))]
 
Level 8
Joined
Dec 9, 2009
Messages
397
No more errors, It's working.. but it still drops the item next to the shop, and doesn't sell the item. (store has "Shop Purchase Item" ability.)

Have to head to my office for a bit, I'll be back later :/
 
Level 8
Joined
Dec 9, 2009
Messages
397
Yes, the item is pawnable, the reason a triggers is needed is the unit has no model, so the player can't click on it themselves.
 
Level 8
Joined
Dec 9, 2009
Messages
397
If i do the triggers to make him give the item to the store, he can give it to the store if it has an inventory and no model. But I want it to sell :/

Is there a function to get the sell value of an item?
Cause I can't find it in GUI
So I can just make a trigger to emulate the sell.
 
Level 8
Joined
Dec 9, 2009
Messages
397
WORKS!! Thank you :)

Now one last little thing, How can I make the inventory of the hero show up while your on the sell menu?
Works when i add an item, and I tried to set that items image to blank, but it is a green square then.
So, I'd like it to show the inventory without having to put an item up for sale :/
 
Status
Not open for further replies.
Top