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

Ignore food

Status
Not open for further replies.
Level 25
Joined
May 11, 2007
Messages
4,651
Just have the units not cost food, when a unit is trained increase food used by triggers, when the unit dies reduce food used with triggers.

If the food used is > food provided by farms, when a unit is trained, cancel it and show an error message.
 
Level 15
Joined
Mar 25, 2016
Messages
1,327
What you want is not possible. You cannot build a unit if you do not have enough food for it. You need to modify either food cost of the trained unit to 0 or increase population limit/decrease food used by the player.

I would do:
Remove food costs from units. When a unit enters the map you adjust the food used for the player.
This would allow you to always train units regardless of your food. You would still have the resource indicator show the right value, but in the unit tooltip you would not see the amount of food required for the unit. You can write it in the tooltip though.
 
Level 15
Joined
Mar 25, 2016
Messages
1,327
The problem is that the moment you want to train the unit you need the food to be able to train this unit.
You have to accept that what you want is not possible in warcraft unfortunatly.

The theoretical solution would be to reduce food used then train the unit then reset the food used to the normal value. But since you cannot reduce the food before someone trains a unit this is not possible.

I found a semi-solution:
This trigger will set food used to 0 and immediatly reset it.
Already queued units will start being trained, because they seem to be started as soon as the required food is available even if the food is reset immediatly. This allows you to go over the food porvided by our food buildings, but not over the food limit.
  • Test
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Wait 0.01 seconds
      • Player - Set Player 1 (Red) Food cap to ((Player 1 (Red) Food cap) + 1000)
      • Player - Set Player 1 (Red) Food cap to ((Player 1 (Red) Food cap) - 1000)
      • Trigger - Run Test <gen> (checking conditions)
 
Status
Not open for further replies.
Top