Integer 0 + 1 = 2?

Status
Not open for further replies.
Level 1
Joined
Aug 21, 2010
Messages
3
Thanks for considering my post.

I am having an issue with my custom map. It's just a little fun experiment I'm working on for my friends and I. The basis is, a 2vs2 auto unit spawning match. I will post the map at the end of this. Here is my current problem.

In this map I have four Command Centers. Each Command Center hosts a variety of Upgrades and buildable structures for the player. The units spawn every 10 seconds. I have created a Global 10 second counter to reset. I use a periodic timer to represent each units wave spawn.




The problem lies in my Upgrades to Trigger to Spawn. I spawn my units based on a Global Variable. "Red Marine Count Base = 4" For example. Will spawn every 10 seconds, the Variable Marines at Point, etc. Now I am using an Upgrade that technically has no function besides costing resources and having an upgrade limit. When this Upgrade is bought by the player, I'm calling a Trigger. When "That" building uses "Purchase Marine" increase variable "Set Red Marine Count Base = Red Marine Count Base + 1". This works. No problems. Now comes the confusing part.



I've duplicated the above for my next Purchasable unit, Marauders. I have a similar Integer, "Red Marauder Count Base = 0". You don't start with them. This works. I then have a Trigger exactly like the Purchase Marine above that sets, "Set Red Marauder Count Base = Red Marauder Count Base + 1" So 0 + 1 = 1. Except, I end up with a Spawn of "2" Marauders. I've changed the Integer in experiments to 1, and get 3. When I set the count to "Set Red Marauder Count Base = Red Marauder Count Base + 2" I get "4". I don't understand.




This has literally stopped, and froze my map-making process.

P.S. Will be adding Images of the Triggers and Map.

Thanks.
 
Last edited:
Level 1
Joined
Aug 21, 2010
Messages
3
I updated the event from Any to Execute. That worked. I would like you to know you've solved so many hours of frustration with that single sentence. Thanks
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,285
The irony is there are spawning solutions which do not involve triggers at all I discovered.

They basically use the spawn behaviour.

Anyway you might wish to instead of duplicating each trigger for each player smply making 1 trigger which coveres all players and having arrays with player indexes for variables. This is the most efficent solution.
 
Level 1
Joined
Aug 21, 2010
Messages
3
I'm unfamiliar with that solution. Arrays I've not looked into. This is a dummy map, it has a purpose and mild entertainment value. It's more for testing and preparing to construct real projects. Thanks though, I'm sure this will be useful.

Edit: Just checked into Arrays. I'll be definitely using those in the future. Currently working on why Units are Spawned damaged. It's probably because I'm increasing the Max-Life, but the unit being spawned still has the same Life.
 
Status
Not open for further replies.
Top