• 🏆 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!

Shop is removing wrong item

Level 24
Joined
Jun 26, 2020
Messages
1,853
Hello, I'm making that a shop sells 3 items but one of them only appears if there is no player unit in a specific region, so when the condition is met I add the item, if not I remove it, the problem is when is no unit of mine nearby the shop, it removes another item instead of what I wanted. It just works fine if I have a unit nearby (just in case I'm saying that I also added this item via triggers, but it is no supposed to dissapear).

What's happening?
 
Level 24
Joined
Jun 26, 2020
Messages
1,853
Nope, I added this trigger and the item still dissapear:
  • Untitled Trigger 002
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Custom script: PauseTimer(bj_stockUpdateTimer)
      • Custom script: DisableTrigger(bj_stockItemPurchased)
But I noticed what really happened is the wrong item dissapears like 10 seconds after I added the another item that appears when the condition I mentioned before is met.
 
Level 24
Joined
Jun 26, 2020
Messages
1,853
Ok, I'm getting lost, what I was doing is every second removing the item and then re-adding it again if the condition is met, but it seems that if I do it 10 times in a row, it also removes the other items I added with triggers one by one, so are these function broken or what?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,579
Shops are buggy, I think you need to rebuild the whole thing from scratch each time. I made a system a while back where I was using a workflow like this:
  • Shop - Limit items sold to 0
  • Shop - Limit items sold to 12
  • For Loop from X to Y add Item[X] to Shop
Item[X] was loaded from a Hashtable. If I wanted an item gone, I would remove it from the Hashtable and run the above logic again. The limit stuff was to quickly clear the Shop.
 
Level 24
Joined
Jun 26, 2020
Messages
1,853
Shops are buggy, I think you need to rebuild the whole thing from scratch each time. I made a system a while back where I was using a workflow like this:
  • Shop - Limit items sold to 0
  • Shop - Limit items sold to 12
  • For Loop from X to Y add Item[X] to Shop
Item[X] was loaded from a Hashtable. If I wanted an item gone, I would remove it from the Hashtable and run the above logic again. The limit stuff was to quickly clear the Shop.
The problem for me is that the items are being added from 2 different and unrelated systems, so that won't be practical, probably I could try something else.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,579
The problem for me is that the items are being added from 2 different and unrelated systems, so that won't be practical, probably I could try something else.
Well, I would either use custom UI for the shops and avoid all of these annoying limitations, or look into reworking those other systems. It sounds weird to me to have more than 1 shop system, you could probably combine them all into one thing.
 
Level 24
Joined
Jun 26, 2020
Messages
1,853
Well, I would either use custom UI for the shops and avoid all of these annoying limitations, or look into reworking those other systems. It sounds weird to me to have more than 1 shop system, you could probably combine them all into one thing.
In reality... they are not really shop systems I just used items to do actions when they are being bought, if I didn't used spells is to also get the player unit who run the event, at least this last case I realized that I don't need it to be an item because I don't need who "buy" the item, so I can use an spell.
 
Top