• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

How to Ignore Food?

Status
Not open for further replies.
Level 14
Joined
Dec 24, 2008
Messages
2,126
As the tittle says, for instance, with the cheat code PointBreak, this makes the game completely ignore the point that you don't have enough food capacity to produce units that require more food. I was wondering if was there a way to turn this code into a real function?

Since I want to turn the food into a currency, like gold and lumber, making food to get reduced when you actually buy an unit that costs food. So doing all of that wasn't a problem at all, the only problem is that I can't get this to work unless I set up my Food Capacity to /100, which I try to avoid to make it look the same as Gold and Lumber. And that's basically it.
 
Level 14
Joined
Dec 24, 2008
Messages
2,126
I think that you need to set the food limit to a defined number and when you buy a unit the trigger will subtract the unit food cost from the food limit an when you get resources ,for example when you kill creeps you receive food, the trigger will add that number of food to the food limit.

That's not the problem here, as I said, making the currency to work was not a problem, the point is that I need to set a max capacity for the food, or it won't let me for instance buy something that requires food. To put it in simple words, if my food says 26, and I want to buy an unit that costs 1 food, it won't let me because I lack farms w/e. If my food says 26/100 then yes it will work, but that's not what I want.

Attempts to remove through the object editor, all food costs for each unit designed to engage. After this, create triggers to assign values ​​to these units.
Then I'll try to make these triggers then I'll show you.

You're missing my point here, the point is to use the food currency, not remove it and just use some variable as value, if that was the problem I wouldn't be asking about this.
 
Level 14
Joined
Dec 24, 2008
Messages
2,126
I will put it this way, you buy a unit/item that costs 2 lumber, you will see in the tooltip that needs 2 lumber to be made, same thing with food, if I remove the food cost it completely kills the whole point here, and my food currency system already works as I said, I just want to get rid of the capacity.
 
Create dummy region for spawning units that consume 1 food, not let any other units consume food. Create a variable and triggers that remove/add new dummy units giving one food.

Will that work?
For very high currency, thousands of dummies won't do. They just lag up the game.
Attempts to remove through the object editor, all food costs for each unit designed to engage. After this, create triggers to assign values ​​to these units.
Then I'll try to make these triggers then I'll show you.
You're missing my point here, the point is to use the food currency, not remove it and just use some variable as value, if that was the problem I wouldn't be asking about this.
Actually, you're missing his point. It's a solution here.

EDIT: Okay, you posted, but.. that doesn't change my answer.
 
^But there's no field for that..
@OP What could you buy with food?

If it's a unit, ability, item, doodad, destructible, upgrade, etc.
Assign them to variables. Indexed style.

Example;

FoodIndex = FoodIndex + 1
FoodItemSample[FoodIndex] = Flute of Accuracy
FoodItem[FoodIndex] = Flute of Accuracy
FoodCost[FoodIndex] = 2
FoodIndex = FoodIndex + 1
FoodItemSample[FoodIndex] = Watcher Ward
FoodItem[FoodIndex] = Watcher Ward
FoodCost[FoodIndex] = 1
FoodIndex = FoodIndex + 1
FoodAbilitySample[FoodIndex] = Fan of Knives Dummy
FoodAbility[FoodIndex] = Fan of Knives
FoodCost[FoodIndex] = 5

/Upon sell
Code:
For each (Integer A) from 1 to FoodIndex, Do Actions
    |_If/Then/Else
       |_____ If (Conditions)
       |       |_Or - Multiple Conditions:
       |         - FoodItemSample[udg_A] Equal to Unit Sold/Item Sold
       |         - FoodAbilitySample[udg_A] Equal to Unit Sold/Item Sold
       |_____Then (Actions
                 - call UnitAddAbility(which Unit, udg_FoodAbility[udg_A])
                 - call CreateNUnitsAtLoc

  • Food Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Food_Index = (Food_Index + 1)
      • Set Food_Cost[Food_Index] = 2
      • Set Food_Ability[Food_Index] = Stormsurge
      • -------- This is the item which you can buy for free, but it only works when you have the food --------
      • Set Food_Sample[Food_Index] = Stormsurge
      • Set Food_Type[Food_Index] = 2
      • -------- 1 = Items, 2 = Abilities, 3 = Units, 4 = Upgrades, etc. --------
      • -------- In case the result is an item too, sample and Food_Item should be the same --------
  • Food Use
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • For each (Integer A) from 1 to Food_Index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item being manipulated)) Equal to Food_Sample[A]
              • ((Owner of (Triggering unit)) Food used) Greater than or equal to Food_Cost[A]
            • Then - Actions
              • Player - Set (Owner of (Triggering unit)) Food used to (((Owner of (Triggering unit)) Food used) - Food_Cost[A])
              • -------- These actions only happen when in the 'Else', so no need to cache things for multiple use --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Food_Type[A] Equal to 1
                • Then - Actions
                  • -------- Create Item for Hero --------
                  • Hero - Create Food_Item[A] and give it to (Triggering unit)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Food_Type[A] Equal to 2
                    • Then - Actions
                      • -------- Add Ability --------
                      • Unit - Add Food_Ability[A] to (Triggering unit)
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • Food_Type[A] Equal to 3
                        • Then - Actions
                          • -------- Create Unit --------
                          • Custom script: set udg_TempPoint = GetUnitLoc(GetTriggerUnit())
                          • Unit - Create 1 Food_UnitType[A] for (Owner of (Triggering unit)) at TempPoint facing (Random angle) degrees
                          • Custom script: call RemoveLocation(udg_TempPoint)
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • Food_Type[A] Equal to 4
                            • Then - Actions
                              • -------- Improve Upgrade --------
                              • Player - Set the current research level of Food_Upgrade[A] to ((Current research level of Food_Upgrade[A] for (Owner of (Triggering unit))) + 1) for (Owner of (Triggering unit))
                            • Else - Actions
            • Else - Actions

/

etc.

Note: A is an integer var, not bj_forloopIntegerA.
 
Last edited:
Status
Not open for further replies.
Top