I'm trying to make a training map, and I want a trigger to execute whenever the player tries to create a unit but can't because he doesn't have enough supply.
Is there a simple way to execute a trigger when the player gets a "not enough supply" error? I have tried several approaches so far but none of them have worked, and I don't see an obvious corresponding event in the list.
If there isn't a simple way, what approach would you take? I've tried a few different approaches, but each has either not worked, or has required making a separate case for every unit type a player could build (and probably wouldn't have worked anyway).
Every time a unit's training (or building, or morphing, or warping in) progress begins, update a variable containing the current supply count
If this variable is already equal to the current supply count, execute my trigger
Right? That sounds good for buildings that work like barracks. Larvae, corruptor->BL morphs, and warp-ins from warp gates will have to be solved differently though.
This is one of the solutions I considered. It's tricky, since the player can issue the order and result in a unit being queued but not built, so they might not be food blocked. Also, I'd have to make a different case for every type of unit that can increase your food. I'm willing to do that, but as a programmer myself it feels... icky.
Yeah but... it doesn't work anyway, right? Because you can issue the order to a Barracks to build a marine but have it be queued, and then you're not food blocked until you reach that point in the queue, by which time you might have built another supply depot.
I'm trying to make a training map, and I want a trigger to execute whenever the player tries to create a unit but can't because he doesn't have enough supply.
Is there a simple way to execute a trigger when the player gets a "not enough supply" error? I have tried several approaches so far but none of them have worked, and I don't see an obvious corresponding event in the list.
If there isn't a simple way, what approach would you take? I've tried a few different approaches, but each has either not worked, or has required making a separate case for every unit type a player could build (and probably wouldn't have worked anyway).
I know this is kind of stale ... but did you have any luck with this? I too am trying to make a macro training map, and knowing when someone is supply blocked to start timers would be useful.
If I come up with anything useful I'll post it here :).
It would take a lot of work but here's my idea. Create a variable for supply count and make a trigger for every unit that subtracts from the supply count variable. EG a marine would subtract 1 from the supply variable. Also make a trigger for every structure/unit that adds to supply, EG an overlord/pylon adds 8 to the supply variable. You would also have to add/subtract supply when the respective units/structures are killed. When the supply variable is <=0, the player is supply blocked.
Using an if/then/else statement in actions, check whether or not the player's supplies used property is equal to the supplies made property. If true, run your timer. Else do nothing.
Create a dialog or other warning (Could be text, a sound etc)
Create a periodic function that runs every 0.5 seconds. Make it check player property supply used and player property total supply (Make sure when comparing to use greater than or equal to to account for lost overlords etc)
If the player has too many units, display the dialog. If not, hide it. Also, play the sound etc (Make sure the sound is 0.5 seconds long though).
The reason i use 0.5 seconds is to make it seem fluid and not too long (1 second after spawning an overlord may seem like a long time for an annoying dialog to stay up) yet not short enough to be really trigger heavy (Running every 0.1 seconds is a bit redundant for something like this). Think this is what Deathtorn did, but haven't looked at his map yet :)
I'm trying to make a training map, and I want a trigger to execute whenever the player tries to create a unit but can't because he doesn't have enough supply.
Is there a simple way to execute a trigger when the player gets a "not enough supply" error? I have tried several approaches so far but none of them have worked, and I don't see an obvious corresponding event in the list.
If there isn't a simple way, what approach would you take? I've tried a few different approaches, but each has either not worked, or has required making a separate case for every unit type a player could build (and probably wouldn't have worked anyway).
@PlanckEnergy: Go
Maybe you could check if the barracks or whatever is using any ability and the supplies used haven't changed.
@tFighterPilot: Go
Clever! So something like:
Right? That sounds good for buildings that work like barracks. Larvae, corruptor->BL morphs, and warp-ins from warp gates will have to be solved differently though.
id try the event "unit is issued order" and the action "text message" then set the order to (example)"barracks train-marine"
@Jamesswart: Go
This is one of the solutions I considered. It's tricky, since the player can issue the order and result in a unit being queued but not built, so they might not be food blocked. Also, I'd have to make a different case for every type of unit that can increase your food. I'm willing to do that, but as a programmer myself it feels... icky.
@PlanckEnergy: Go
ya its alot of work, thats not normaly a bad thing but its boring work :P
@Jamesswart: Go
Yeah but... it doesn't work anyway, right? Because you can issue the order to a Barracks to build a marine but have it be queued, and then you're not food blocked until you reach that point in the queue, by which time you might have built another supply depot.
I know this is kind of stale ... but did you have any luck with this? I too am trying to make a macro training map, and knowing when someone is supply blocked to start timers would be useful.
If I come up with anything useful I'll post it here :).
It would take a lot of work but here's my idea. Create a variable for supply count and make a trigger for every unit that subtracts from the supply count variable. EG a marine would subtract 1 from the supply variable. Also make a trigger for every structure/unit that adds to supply, EG an overlord/pylon adds 8 to the supply variable. You would also have to add/subtract supply when the respective units/structures are killed. When the supply variable is <=0, the player is supply blocked.
Um, I think there's an easier way to do this.
Use the issue order to build event.
Using an if/then/else statement in actions, check whether or not the player's supplies used property is equal to the supplies made property. If true, run your timer. Else do nothing.
Should work O.o
@ZT178: Go
I made a simple map which will display the supply usage of player 1 periodically, as an example.
The reason i use 0.5 seconds is to make it seem fluid and not too long (1 second after spawning an overlord may seem like a long time for an annoying dialog to stay up) yet not short enough to be really trigger heavy (Running every 0.1 seconds is a bit redundant for something like this). Think this is what Deathtorn did, but haven't looked at his map yet :)
Thanks, I'll give this (and some of the other techniques) a try. Even if it doesn't work for warpin/hatching, any progress would be nice.
@ZT178: Go
This should work for all occasions, as this is what blizzard uses for their score screen, which displays at the end of each game.