• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Current Food Cap Check

Status
Not open for further replies.
Level 3
Joined
Jan 18, 2014
Messages
27
Hi there,

My second question of the day!

I was wondering if there was a condition in the World Editor that would allow a triggered check of a players food cap to see if they can support a unit that is about to be created.

I'm creating a spell that sacrifices a lesser unit to create a more powerful one (and hence increases the food required by the player). I would like some way of the food cap being consulted to stop the spell being cast if the players current food not being able to support the unit to be created.

Any help would be much appreciated!

(I should mention the sacrificial aspect works).
 
Level 3
Joined
Jan 18, 2014
Messages
27
I might be being an idiot but I'm still having an issue with this.

I can check the food used, food cap or food max with this comparison.

BUT I want to check if there is x amount of food available for the unit to be created for the player.

These comparisons only allow me to check how much food the player has as a static value, not a varying one.

Is there a way to check with this comparison (or any comparison/code), for example, if the player has 8 food or more available?
 
Last edited:
Level 3
Joined
Jan 18, 2014
Messages
27
Pretty sure I've got it now. It's looking like this:

  • If - Conditions
    • Integer Comparison - (((Owner of (Casting Unit)) Food Used) + 8) Less than or equal to ((Owner of (Casting Unit)) Food cap))
Then blah blah blah actions :) with a stop action if 8 food will "blow the food budget" (so to speak).

  • If - Conditions
  • Integer Comparison - (((Owner of (Casting Unit)) Food Used) + 8) Greater than ((Owner of (Casting Unit)) Food cap))
I think that's working all good now so thank you both very much for your help!
 
Last edited:
Status
Not open for further replies.
Top