• 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.

Upkeep

Status
Not open for further replies.
Level 17
Joined
Mar 21, 2011
Messages
1,611
hi,
i want to customize my upkeep. now what i want to do is change the actual food used via trigger.
at first i thought about just creating a unit for the triggering player with foodcost 1 for each action, but there are 8 players and it could get laggy if there are too much units on map.
then i thought about directly changing the food cost of a unit (current food cost + 1), but i didnt found it in trigger editor.
is there any solution?
ty
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
i dont think it is possible with trigger changeing the unit food cost :/ or atleast i dont got any action for it, i got action for check unit food cost is enable or no or what is the unit food cost but not for change it

JASS:
SetUnitUseFood      takes unit whichUnit, boolean useFood returns nothing
constant native GetUnitFoodUsed     takes unit whichUnit returns integer
constant native GetUnitFoodMade     takes unit whichUnit returns integer
constant native GetFoodUsed         takes integer unitId returns integer
constant native GetFoodMade         takes integer unitId returns integer
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Maker has given the easiest solution to this problem.
To elaborate: the food used by a player can be changed with call SetPlayerState(player, PLAYER_STATE_RESOURCE_FOOD_USED, integer).
You will need to keep track of the created/killed units and change the food of each player manually with this action.
 
Level 16
Joined
Jul 31, 2012
Messages
2,217
If this could help you more:

Change the icon in the Interface of the food to your choice
Be sure that all units appearing in your map have 0 food cost [hard work if your map isn't recently made]

you can change all the text appearing when pointing on the food in the game interface

Finally triggers:
This is an example of a trigger which shows the amount of units rescued over the amount of units that need to be rescued

  • Initialization
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units of type Rescue unit) and do (Actions)
        • Loop - Actions
          • Unit - Make (Picked unit) Rescuable by Player Group - Player 1 (Red)
      • Player - Set Player 1 (Red) Food cap to 10
      • -------- Player 1 needs to rescue 10 units --------
      • Player - Set Player 1 (Red) Food used to 0
      • -------- Player 1 have not rescued any unit yet (0) --------
  • Rescue
    • Events
      • Unit - A unit Is rescued
    • Conditions
    • Actions
      • Player - Set Player 1 (Red) Food used to ((Player 1 (Red) Food used) + 1)
      • Game - Display to (All players) the text: (((Name of Player 1 (Red)) + has rescued ) + ((((String((Player 1 (Red) Food used))) + /) + (String((Player 1 (Red) Food cap)))) + units))
 
Status
Not open for further replies.
Top