• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[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,240
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