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

Can only buy this item ONCE in the shop?

Status
Not open for further replies.
Level 12
Joined
May 9, 2009
Messages
735
Hello, I want to make a system where in the buildable shops (arcane vault and stuff) you can buy all items like normal except this one particular item (orb in this case) you can only buy once.

So when you buy it it is removed from the shop and from any more buildable shops that you build. I tried looking into the neutral buildings actions but they don't seem to work...

Will I have to use the berserker ability? Or is it possible somehow through the neutral buildings actions?
 
Level 12
Joined
Nov 3, 2013
Messages
989
Items and units can only be removed from shops through triggers if you had added them through triggers as well. So one way that would work is to first remove the item from the shop in object editor and afterwards add the item every time a shop is built (unless the item has already been sold). When the specific item is purchases remove it from the shops.

The only drawback I know of is that hotkeys won't work to purchase the item (I haven't actually checked it with items but hotkeys doesn't work for units added through trigger at least)

Having another identical shop unit type and simply add chaos research when the item is bought, like you've said already, would also work.

I don't think there's another way besides these two.
 
Level 12
Joined
May 9, 2009
Messages
735
Well that's a shame because these ways don't seem to work. The chaos and berserker perma-morph abilities don't seem to work on buildings.

And my trigger that is supposed to remove the items just doesn't work.

  • Untitled Trigger 003 Copy
    • Events
      • Unit - A unit Finishes construction
    • Conditions
      • (Current research level of orb research dummy for (Owner of (Constructed structure))) Equal to 0
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Constructed structure)) Equal to Hall of Relics
          • (Unit-type of (Constructed structure)) Equal to Well of Wonders
    • Actions
      • Neutral Building - Add Orb of Chaos to (Constructed structure) with 1 in stock and a max stock of 1
  • Untitled Trigger 001
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
      • (Item-type of (Sold Item)) Equal to Orb of Chaos
    • Actions
      • Player - Set the current research level of orb research dummy to 1 for (Owner of (Selling unit))
      • Set AAAGroupOrbs = (Units owned by (Owner of (Selling unit)) of type Well of Wonders)
      • Unit Group - Pick every unit in AAAGroupOrbs and do (Actions)
        • Loop - Actions
          • Neutral Building - Remove Orb of Chaos from (Picked unit)
      • Custom script: call DestroyGroup (udg_AAAGroupOrbs)
 
Level 23
Joined
Feb 6, 2014
Messages
2,466
http://www.hiveworkshop.com/forums/world-editor-help-zone-98/add-remove-items-specific-shop-236281/

When the orb item is bought, change the value of a boolean variable telling that the player already bought an orb. Example, OrbIsBought[PlayerId of Triggering Player] = true. (which was initially false) Also, pick all other shops of that Player and remove the Orb from those shops
Then when a newly constructed shop is built, if OrbIsBought[PlayerId of Triggering Player] = false then add the Orb item to the shop's stock which was mentioned in the post I linked.
 
Level 19
Joined
Apr 21, 2013
Messages
1,194
I could think of once bought remove the item from every current store and for the future stores you can createa new store type that has everything with the other but only not the orb. When the player builds the store u just replace it with your other shop that hasnt got the orb in it. But Flux's system would work much more efficiently than mine.
 
Level 12
Joined
May 9, 2009
Messages
735
http://www.hiveworkshop.com/forums/world-editor-help-zone-98/add-remove-items-specific-shop-236281/

When the orb item is bought, change the value of a boolean variable telling that the player already bought an orb. Example, OrbIsBought[PlayerId of Triggering Player] = true. (which was initially false) Also, pick all other shops of that Player and remove the Orb from those shops
Then when a newly constructed shop is built, if OrbIsBought[PlayerId of Triggering Player] = false then add the Orb item to the shop's stock which was mentioned in the post I linked.

But that's exactly what I did but I just used a research instead of the variable. I will have to play around with the shop abilities, the differences between items made and sold, and the trigger to see if I can find out why my trigger doesn't work.

Edit: I tested it some more and it works now. I just didn't have the "Select Hero" ability given to my market which created another problem which I made another thread about earlier. If you wonder how i could forget i was working with market buildings from the races like arcane vault which usually sell items (make items) without that ability at all.
 
Last edited:
Status
Not open for further replies.
Top