Buildings and Upgrades [SOLVED]
I don't really understand how you can trigger around buildings mid upgrade.
Here is what I am trying to do. In the map I am making, each player has a custom resource (known as materials). I want the player to be able to upgrade a building they own using that custom resource (this doesn't replace gold or lumber or food). The only way I can think of doing this is checking if the player has enough materials when the upgrade begins and if they don't, cancel the upgrade.
What I have figured out:
If the player doesn't have enough, it should cancel the upgrade. I tested it and couldn't stop the player from bugging it. I added a wait timer but the player can just quickly spam select another unit (even though I force them to select the building) and the building will continue to upgrade. Is there any other way to make it work?
EDIT: Managed to find this post and it answers my question perfectly.
I don't really understand how you can trigger around buildings mid upgrade.
Here is what I am trying to do. In the map I am making, each player has a custom resource (known as materials). I want the player to be able to upgrade a building they own using that custom resource (this doesn't replace gold or lumber or food). The only way I can think of doing this is checking if the player has enough materials when the upgrade begins and if they don't, cancel the upgrade.
What I have figured out:
-
Upgrading House
-
Events
- Unit - A unit Is issued an order with no target
- Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Unit-type of (Ordered unit)) Equal to Tower Base
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Issued order) Equal to (Order(Scout Tower))
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Mats_Number Greater than or equal to 500
-
Then - Actions
- Set Mats_Number = (Mats_Number - 500)
-
Else - Actions
- Game - Display to Player Group - Player 1 (Red) for 3.00 seconds the text: You don't have enou...
- Selection - Select (Ordered unit) for (Owner of (Ordered unit))
- Wait 0.01 seconds
- Game - Force (Owner of (Ordered unit)) to press Escape/Cancel
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Events
EDIT: Managed to find this post and it answers my question perfectly.
Last edited: