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

[Solved] Check for player's available food.

Status
Not open for further replies.
I'm creating a custom training system that works entirely with triggers. Checking for player's food available food doesn't seem to exist in the Integer - Player Properties.

There must be some weird math to get the player's available food, right? I tried most of the calculations but none of them seem to be working. It would work like this:

- Player has 4 out of 10 available food.
- Player attempts to train a unit that costs 5 food.
- Player will get an error saying they don't have enough food.

Thanks in advanced.
 
Level 8
Joined
May 21, 2019
Messages
435
I'm creating a custom training system that works entirely with triggers. Checking for player's food available food doesn't seem to exist in the Integer - Player Properties.

There must be some weird math to get the player's available food, right? I tried most of the calculations but none of them seem to be working. It would work like this:

- Player has 4 out of 10 available food.
- Player attempts to train a unit that costs 5 food.
- Player will get an error saying they don't have enough food.

Thanks in advanced.
It isn't clear to me what you're trying to accomplish. How exactly do you want this system to work? What makes it different from how food currently works, apart from it having to make manual workarounds for things that already work perfectly in the existing system?
 
It isn't clear to me what you're trying to accomplish. How exactly do you want this system to work? What makes it different from how food currently works, apart from it having to make manual workarounds for things that already work perfectly in the existing system?

I need everything to work in triggers. I'm not trying to replicate the vanilla Warcraft training system. I just need to know how their unit food cost works.
 
Level 8
Joined
May 21, 2019
Messages
435
I need everything to work in triggers. I'm not trying to replicate the vanilla Warcraft training system. I just need to know how their unit food cost works.
Why do you need that?
I can come up with some hacky solution to using the food resource outside of its own functionality, but it's going to be error-prone, and if you were to explain your intention, it may turn out that there's a much better approach to what you're trying to accomplish.
 

Wrda

Spell Reviewer
Level 25
Joined
Nov 18, 2012
Messages
1,870
I'm creating a custom training system that works entirely with triggers. Checking for player's food available food doesn't seem to exist in the Integer - Player Properties.
Are you that blind to miss this and actually test what it does?
upload_2019-8-22_14-32-33.png

There must be some weird math to get the player's available food, right? I tried most of the calculations but none of them seem to be working. It would work like this:

- Player has 4 out of 10 available food.
- Player attempts to train a unit that costs 5 food.
- Player will get an error saying they don't have enough food.

Thanks in advanced.
I don't see what this does that the normal wc3 food engine doesn't, seems pointless. Maybe elaborate your idea and post triggers.
 
Are you that blind to miss this and actually test what it does?
View attachment 331091


I don't see what this does that the normal wc3 food engine doesn't, seems pointless. Maybe elaborate your idea and post triggers.

Hmm. I'll test that one out immediately.

And I told you, everything works in triggers. What you tried to point out is the vanilla War3 food engine for its training system. I put the [ Trigger ] in the title for a reason.
 
Level 39
Joined
Feb 27, 2007
Messages
4,994
As Wrda showed it's still there under Player - Property.
  • Set TrainPlayer = (Triggering Player) //or whatever
  • Set FoodCost = 5 //or whatever
  • Set FoodUsed = (TrainPlayer Food Used)
  • Set FoodCap = (TrainPlayer Food Cap) //Max is the max food any player COULD have in your map, cap is the current maximum for the player
  • Set CanTrain = ((FoodCap - FoodUsed) greater than FoodCost)
 
Last edited:
As Wrda showed it's still there under Player - Property.
  • Set TrainPlayer = (Triggering Player) //or whatever
  • Set FoodCost = 5 //or whatever
  • Set FoodUsed = (TrainPlayer Food Used)
  • Set FoodCap = (TrainPlayer Food Cap) //Max is the max food any player COULD have in your map, cap is the current maximum for the player
  • Set CanTrain = ((FoodCap - FoodUsed) greater than FoodCost)

That's much more understandable. Thanks. Solved
 
Status
Not open for further replies.
Top