Can I Reset the Cooldown on an Item to Be Sold?

Squeekems

TH.net Regular
Reaction score
11
I am trying to make it so players can only buy one item from this shop. I have it so that once a player buys something from the shop, every time they select the shop, it immediately deselects it. That is not enough. They still have a half-second to select the shop and use a hot-key to make a purchase.

So, I decided I would make it so that when they acquire an item from the shop, after they have already bought one, I would remove the item and refresh the item in the shop. The problem is I don't know how to refresh the item in the shop. Can I do that somehow?
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
I believe there is an action:
Trigger:
  • Neutral Building - Remove (Last Purchased Item) from (Triggering unit)
 

Squeekems

TH.net Regular
Reaction score
11
man, you don't know how to add cooldown?
its in options tab

Using triggers.

I believe there is an action:
Trigger:
  • Neutral Building - Remove (Last Purchased Item) from (Triggering unit)
Will that replenish the item in the shop? I'm gonna go check right now. Lol. I'm just saying if all it does is remove the item from the unit, I already go that covered.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
wait im confused as to what you are trying to accomplish now, i thought you wanted to make it so that only 1 of an item could be purchased...
 

Squeekems

TH.net Regular
Reaction score
11
No no, I want a player to only be able to purchase 1 item from a shop.
Let me be more specific:
I'm setting up a system for players to pick abilities from shops. I am grouping the abilities by their hot-key/position. The hot-keys are Z, X, C, and V. I only want them to purchase only one of each kind. I think you can see what I am trying to do from this.
 

NoobImbaPro

You can change this now in User CP.
Reaction score
60
towers equal to number of heroes played....
each player can only manipulate his tower.
Don't make a neutral and try to hide item, because the other guy who has not bought the item can't buy it.
Or you can add a boolean array variable which tells you if the hero has bought the item, and upon purchase remove it and give gold back
 

Squeekems

TH.net Regular
Reaction score
11
towers equal to number of heroes played....
each player can only manipulate his tower.
Don't make a neutral and try to hide item, because the other guy who has not bought the item can't buy it.
Or you can add a boolean array variable which tells you if the hero has bought the item, and upon purchase remove it and give gold back

Because I think you are a little behind on what I thought I explained I have done already I am going to post what I have.

Trigger:
  • Prevent Z Selection
    • Events
      • Player - Player 1 (Red) Selects a unit
      • Player - Player 2 (Blue) Selects a unit
      • Player - Player 3 (Teal) Selects a unit
      • Player - Player 4 (Purple) Selects a unit
      • Player - Player 5 (Yellow) Selects a unit
      • Player - Player 6 (Orange) Selects a unit
      • Player - Player 7 (Green) Selects a unit
      • Player - Player 8 (Pink) Selects a unit
      • Player - Player 9 (Gray) Selects a unit
      • Player - Player 10 (Light Blue) Selects a unit
      • Player - Player 11 (Dark Green) Selects a unit
      • Player - Player 12 (Brown) Selects a unit
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Z Abilities (1)
          • (Unit-type of (Triggering unit)) Equal to Z Abilities (2)
      • BoughtZ[((Player number of (Triggering player)) - 1)] Equal to True
    • Actions
      • Selection - Select Hero[((Player number of (Triggering player)) - 1)] for (Triggering player)


I'm trying to figure out how to tell the game to replenish the bought item in the shop in the final [ljass]Else[/ljass].
Trigger:
  • Learn Blizzard
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Blizzard
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • BoughtZ[((Player number of (Owner of (Triggering unit))) - 1)] Equal to False
        • Then - Actions
          • Set BoughtZ[((Player number of (Owner of (Triggering unit))) - 1)] = True
          • Set Ability[(((Player number of (Owner of (Triggering unit))) x 4) + 1)] = Blizzard
          • Unit - Add Blizzard to (Triggering unit)
          • Selection - Select (Triggering unit) for (Owner of (Triggering unit))
        • Else - Actions
          • //Replenish Blizzard in the Shop
 

Squeekems

TH.net Regular
Reaction score
11
The items in the store will only be at 1. Their replenish rate is set at 3600. I don't want players having any of the same abilities. But, if someone sneaks a buy, then that ability becomes unavailable to all the other players. Using triggers, I want to replenish the item in the shop.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
why dont you use unit at another location with the hero classification and no model, then give it all the abilities you want to enable in the form of a charge lumber/gold ability, so it seems like you are just buying it? then remove the ability from that unit
 

Squeekems

TH.net Regular
Reaction score
11
I do not think I am getting what you are trying to say, but I realized I could just use a marketplace. At least I think I can.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
try playing H.O.S.K and double click the yellow + sign in the top left and i think you will see what i was meaning
 

NoobImbaPro

You can change this now in User CP.
Reaction score
60
ahahahahaha man, the enemy treat was opposite, we made neutral passive think us as enemies......
we solved it
 

Squeekems

TH.net Regular
Reaction score
11
Here is the solution that I am using:

In Initialization, I added the abilities to the shops using this line:
Trigger:
  • Neutral Building - Add Blizzard to Z Abilities 0013 <gen> with 1 in stock and a max stock of 1


This is the trigger I used when a hero purchases an item:

Trigger:
  • Learn Blizzard
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Blizzard
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • BoughtZ[((Player number of (Owner of (Triggering unit))) - 1)] Equal to False
        • Then - Actions
          • Set BoughtZ[((Player number of (Owner of (Triggering unit))) - 1)] = True
          • Set Ability[(((Player number of (Owner of (Triggering unit))) x 4) + 1)] = Blizzard
          • Unit - Add Blizzard to (Triggering unit)
          • Selection - Select (Triggering unit) for (Owner of (Triggering unit))
        • Else - Actions
          • Neutral Building - Add (Item-type of (Item being manipulated)) to Z Abilities 0013 <gen> with 1 in stock and a max stock of 1
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top