• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Changing a unit's food cost via triggers?

Status
Not open for further replies.
You could always just have their food cost set to 0, and then do
  • Player - Set Player 1 (Red) Food used to ((Player 1 (Red) Food used) + 1)
Replacing Player 1 (Red) with a variable, like:

  • For each (Integer RandomInit) from 1 to 12, do (Actions)
    • Loop - Actions
      • Player - Set (Player(RandomInit)) Food used to (((Player(RandomInit)) Food used) + 1)
Then set all your other conditions as necessary.
 
Disadvantage of such system is that you actually need to capture all events "Unit begins training a unit" and check if there's enough food for the unit.

The unit trained is a dummy unit, and the dummy unit has a Chaos ability that morphs it into a counterpart unit which has no food cost, you check for if the training is finished, then set the food?

Of course, this doesn't have to be for EVERY SINGLE UNIT in the game, just the ones he wants. Unless the ones he wants is every single unit in the game...
 
You can do this.
MindControlledUnits is a player group variable with array with size 17
The reason of second trigger is, when unit dies or gets mind controlled by someone else the game will probably(I didnt test) decrease its food from player so we need to fix this.

  • Disable Cost
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Mind Control
    • Actions
      • Player - Set (Owner of (Triggering unit)) Food used to (((Owner of (Triggering unit)) Food used) - (Supply used by (Target unit of ability being cast)))
      • Unit Group - Add (Target unit of ability being cast) to MindControlledUnits[(Player number of (Owner of (Triggering unit)))]

  • Fix Cost
    • Events
      • Unit - A unit Dies
      • Unit - A unit Changes owner
    • Conditions
      • ((Triggering unit) is in MindControlledUnits[(Player number of (Owner of (Triggering unit)))]) Equal to True
    • Actions
      • Unit Group - Remove (Triggering unit) from MindControlledUnits[(Player number of (Owner of (Triggering unit)))]
      • Player - Set (Owner of (Triggering unit)) Food used to (((Owner of (Triggering unit)) Food used) + (Supply used by (Triggering unit)))
 
Status
Not open for further replies.
Back
Top