• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Shop selling issue.

Status
Not open for further replies.
Level 12
Joined
Dec 2, 2016
Messages
733
Screen capture - 06ab3e2c7523ef76cb0d92747d7e9e65 - Gyazo

I've got a shop that sells items. I currently have this trigger.

  • Untitled Trigger 002
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
      • (Owner of (Triggering unit)) Not equal to (Owner of (Buying unit))
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Sold Item)) Equal to Toolkit
        • Then - Actions
          • Game - Display to (All players) the text: Removing item
          • Item - Remove (Sold Item)
        • Else - Actions
Basically, if a player that is not the owner of the shop buys "Toolkit" the trigger instantly removes the item. I do this so that the player is forced to build his own shop to purchase this item. Now the problem I'm having is, if you watch the Gyazo above. Removing the item upon purchase seems to bug it. I buy the item, it deletes itself then I buy another item 'Poison Spire' which is a drop down tower unit.

It should only create the tower unit, but it also spawns the 'Toolkit' ability which is 4 drop down repair units. So the game thinks I still have the item even though I don't. If I add a 'wait 0.01' seconds before removing the item the bug does not happen. But it's possible for the player to use the 'Toolkit' ability before the item is removed. Anyone have a better solution to my problem, or a way to fix this bug? Thanks.
 
Level 4
Joined
Nov 14, 2018
Messages
52
try this

  • Unmarked trigger 001
    • Events
      • Unit - A unit Sells an item (from the store)
    • conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'If' conditions
          • (Owner of (Buying unit)) Unequal (Owner of (Selling unit))
          • (Item-type of (Sold Item)) Equal test
        • 'THEN' actions
          • Hero - Drop (Sold Item) from (Buying unit)
          • Item - Remove (Last dropped item)
        • 'ELSE' actions
 
Level 12
Joined
Dec 2, 2016
Messages
733
try this

  • Unmarked trigger 001
    • Events
      • Unit - A unit Sells an item (from the store)
    • conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'If' conditions
          • (Owner of (Buying unit)) Unequal (Owner of (Selling unit))
          • (Item-type of (Sold Item)) Equal test
        • 'THEN' actions
          • Hero - Drop (Sold Item) from (Buying unit)
          • Item - Remove (Last dropped item)
        • 'ELSE' actions
Same thing
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,555
I've never experienced anything like that before, are you using the latest patch?

Also, do you have any other triggers related to Using items? Could you post any triggers related to using items if you do. Another thing, when you tried FiX_'s method, did you use the wait 0.01 too? I imagine if this is a bug and not an oversight on your part then you could always drop the item, hide it, and remove it 0.01 seconds later. That way the player can't use it in that 0.01 time frame.

If that fails, maybe this would work: [Solved] - Order unit to sell item to unit
Using the method in the link you can immediately sell the item back.
 
Status
Not open for further replies.
Top