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

Hunger System 1.1 GUI bar version

__________HUNGER SYSTEM__________

This is a system for survival maps or maps like LOAP. System is MUI, so multiple units can
use it. System is VERY lagless. It count down hunger value; zero = death; it show hunger
of unit in floating text. Unit can descrease hunger by using items that logicaly you may
count as food.

Updated:
-Better customization

Hope this is usefull. Dont be lazy and give credits.

  • Create Heros
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 3, do (Actions)
        • Loop - Actions
          • Set MAP_Point[0] = (Center of Region 000 <gen>)
          • Unit - Create 1 Survivor for Player 1 (Red) at MAP_Point[0] facing (Random angle) degrees
          • Unit Group - Add (Last created unit) to HU_Group
          • Custom script: call RemoveLocation(udg_MAP_Point[0])
  • Hunger Item data Preloading
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- ----------Chicken Meat---------- --------
      • Set HU_ItemType[0] = Chiken Meat
      • Set HU_DescreaseFrom[0] = 10.00
      • Set HU_DescreaseTo[0] = 15.00
      • Set HU_HealFrom[0] = 50.00
      • Set HU_HealTo[0] = 70.00
      • -------- ----------Rabbit Meat---------- --------
      • Set HU_ItemType[1] = Rabbit Meat
      • Set HU_DescreaseFrom[1] = 5.00
      • Set HU_DescreaseTo[1] = 10.00
      • Set HU_HealFrom[1] = 35.00
      • Set HU_HealTo[1] = 60.00
      • -------- ----------Rat Meat---------- --------
      • Set HU_ItemType[2] = Rat Meat
      • Set HU_DescreaseFrom[2] = 3.00
      • Set HU_DescreaseTo[2] = 5.00
      • Set HU_HealFrom[2] = 20.00
      • Set HU_HealTo[2] = 40.00
      • -------- ----------Set variable to last item index---------- --------
      • Set HU_LastItemIndex = 2
  • Hunger Setings
    • Events
      • Unit - A unit enters (Playable map area)
      • Unit - A unit Finishes reviving
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • HU_Skip Equal to 0
        • Then - Actions
          • Trigger - Turn on Hunger Loop <gen>
        • Else - Actions
      • Set HU_Skip = (HU_Skip + 1)
      • Set HU_Times = (HU_Times + 1)
      • Set HU_Off[HU_Times] = True
      • Set HU_Unit[HU_Times] = (Triggering unit)
      • -------- This is max hunger value. It show hou mach long ur unit can be without food. Make passive spell that will increase this value and make ur survivor to resist hunger more. --------
      • Set HU_MaxValue[HU_Times] = 75.00
      • -------- This is starting hunger value of ur hero. it is equal to Max value because at start your hero may be not hungry. --------
      • Set HU_Value[HU_Times] = 75.00
      • -------- This is Bar that will show hunger level. Changing of characters mean changing type of bar. Here I used "I" (ai) that is fat character and bar in game looks almost without spaces. --------
      • -------- You may use "|" (vertical line) that will cause troubles with showing bar, because it is part of |cff###|r color. Also bar will need about 100-200 or this characters to be long enagth. --------
      • -------- "|" is most thin character and it hide all spaces if it is small enagth. To kill problem with |cff###|r color, you may need to set 2 strings (left and right values) and combine them. --------
      • -------- I used "I" (ai) because meter dont need to be 100-200 characters that is big variable. Better set HU_Meter as Global variable. It will mean what it is one style and size of hunger bar for all units. --------
      • Set HU_Meter[HU_Times] = IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
      • -------- "|" is most thin character and it hide all spaces if it is small enagth. To kill problem with |cff###|r color, you may need to set 2 strings (left and right values) and combine them. --------
      • Set HU_BarSize[HU_Times] = (Length of HU_Meter[HU_Times])
      • Set HU_Point[0] = (Position of (Triggering unit))
      • -------- So I gave you version with bar near unit. In multiboard you will not need HU_Text variable. --------
      • Floating Text - Create floating text that reads HU_Meter[HU_Times] at HU_Point[0] with Z offset 0.00, using font size 4.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Set HU_Text[HU_Times] = (Last created floating text)
      • -------- If you want to use it near unit, so hide text for all players and show to owner of hungry hero. Else other players will see all units bars and it will be crapy. --------
      • Floating Text - Hide (Last created floating text) for (All players)
      • Floating Text - Show (Last created floating text) for (Player group((Owner of (Triggering unit))))
      • Custom script: call RemoveLocation(udg_HU_Point[0])
  • Hunger Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer HU) from 1 to HU_Times, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • HU_Off[HU] Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • HU_Value[HU] Less than or equal to 0.00
                      • (HU_Unit[HU] is dead) Equal to True
                      • HU_Unit[HU] Equal to No unit
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • HU_Value[HU] Less than or equal to 0.00
                    • Then - Actions
                      • Unit - Kill HU_Unit[HU]
                    • Else - Actions
                  • Floating Text - Destroy HU_Text[HU]
                  • Set HU_Off[HU] = False
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • HU Less than HU_Times
                    • Then - Actions
                      • Set HU_Off[HU] = HU_Off[HU_Times]
                      • Set HU_Unit[HU] = HU_Unit[HU_Times]
                      • Set HU_BarSize[HU] = HU_BarSize[HU_Times]
                      • Set HU_MaxValue[HU] = HU_MaxValue[HU_Times]
                      • Set HU_Color[HU] = HU_Color[HU_Times]
                      • Set HU_Meter[HU] = HU_Meter[HU_Times]
                      • Set HU_Value[HU] = HU_Value[HU_Times]
                      • Set HU_Text[HU] = HU_Text[HU_Times]
                    • Else - Actions
                  • Set HU = (HU - 1)
                  • Set HU_Times = (HU_Times - 1)
                  • Set HU_Skip = (HU_Skip - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • HU_Skip Equal to 0
                    • Then - Actions
                      • Set HU_Times = 0
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • HU_Value[HU] Greater than HU_MaxValue[HU]
                    • Then - Actions
                      • Set HU_Value[HU] = HU_MaxValue[HU]
                    • Else - Actions
                  • -------- Hunger increase interval is 0.01 so ~ hunger increse per second is 0.11. So 75.00/0.11=681.(81) seconds without food or 11 min and 20 sec without food. Calculate and Balance it as you wish. --------
                  • Set HU_Value[HU] = (HU_Value[HU] - 0.01)
                  • Set HU_Color[HU] = (Integer(((HU_Value[HU] / HU_MaxValue[HU]) x (Real(HU_BarSize[HU])))))
                  • Floating Text - Change text of HU_Text[HU] to ((|cffffff00 + ((Substring(HU_Meter[HU], 1, HU_Color[HU])) + |r)) + (|cffff0000 + ((Substring(HU_Meter[HU], (HU_Color[HU] + 1), HU_BarSize[HU])) + |r))) using font size 4.00
                  • -------- Applying text to unit position. --------
                  • Set HU_Point[1] = (Position of HU_Unit[HU])
                  • Floating Text - Change the position of HU_Text[HU] to HU_Point[1] with Z offset 100.00
                  • Custom script: call RemoveLocation(udg_HU_Point[1])
            • Else - Actions
  • Descreace Hunger
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • ((Triggering unit) is in HU_Group) Equal to True
    • Actions
      • For each (Integer HU2) from 1 to HU_Times, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering unit) Equal to HU_Unit[HU2]
            • Then - Actions
              • For each (Integer HU3) from 0 to HU_LastItemIndex, 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 HU_ItemType[HU3]
                    • Then - Actions
                      • Set HU_Value[HU2] = (HU_Value[HU2] + (Random real number between HU_DescreaseFrom[HU3] and HU_DescreaseTo[HU3]))
                      • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + (Random real number between HU_HealFrom[HU3] and HU_HealTo[HU3]))
                      • Set HU3 = HU_LastItemIndex
                    • Else - Actions
              • Set HU2 = HU_Times
            • Else - Actions


Keywords:
Hunger, Hungry, Loap, Survival, Food, Need, Simple, NFWar, Bar, Visual
Contents

Hunger System 1.0 GUI bar version (Map)

Reviews
19:26, 17th Jun 2010 Hanky: There are just two things that could be improved: - increase the periodic interval to 0.05 or something, that will be still smooth enough - you could improve the indexing of your system Apart from that stuff the...

Moderator

M

Moderator

19:26, 17th Jun 2010
Hanky:
There are just two things that could be improved:
- increase the periodic interval to 0.05 or something, that will be still smooth enough
- you could improve the indexing of your system

Apart from that stuff the system looks fine enough for an approval.
 
I love the Idea of it:D It might be usefull to some.... but It might need something more.... like you need to cook the food or the food might be rotten or something so you get a disea

Cooking is recipe system. About roten food. Make this food unit and when you kill is (unroot) it drop item that u can eat or cook.
 
Level 14
Joined
Mar 30, 2009
Messages
971
i have a food system in my map and implemented vomiting too. when a player eats too much (or raw fish for example) then he can vomit. vomiting creates sfx, sound, animation and decreases food eaten. btw mine is only MPI

EDIT: btw your testmap could use some more food. they die really fast xD
 
Level 10
Joined
Jan 24, 2009
Messages
606
Cooking is recipe system. About roten food. Make this food unit and when you kill is (unroot) it drop item that u can eat or cook.

Well, what I mean is... since its a hunger bar it should also be that like 20-40% chance for the meat that drops to be bad. It makes logic sense and meat can also become rotten. I am just saying that Rotten food should decrease the Hunger Bar or Give deseases
 
You dont got it do you? Unit dont die instant. It dies with time... bar show it.
This system make gameplay harder because you need to care not about helth of unit, but about his desire of food also. Unit can die now not just from damage, but by not using some items (food items that you locicaly call food). Do you take damage if you hungry? If I will fall from bike and will be half dead, I will be half hungry? This you want me to do: make unit to take damage and call it hunger. This is totaly wrong. I created desire of unit that is not only Health, if he take a llot of damage to die, but desire to "eat". Desire dont have connections with life. You must to keep both in balance to kep unit alive.
 
Last edited:
Level 13
Joined
Jun 9, 2009
Messages
1,129
[QUOTE = metal_13; 1495860] Y они умирают, как "мгновенные"? Как насчет, когда голод = 0 ...
loop2: повреждение х единиц каждую 1 сек ... Til они умирают ...[/ QUOTE]

You dont got it do you? Unit dont die instant. It dies with time... bar show it.
This system make gameplay harder because you need to care not about helth of unit, but about his desire of food also. Unit can die now not just from damage, but by not using some items (food items that you locicaly call food). Do you take damage if you hungry? If I will fall from bike and will be half dead, I will be half hungry? This you want me to do: make unit to take damage and call it hunger. This is totaly wrong. I created desire of unit that is not only Health, if he take a llot of damage to die, but desire to "eat". Desire dont have connections with life. You must to keep both in balance to kep unit alive.
Thats true when i don't eat 3-4 days i will die, i will not take any damage or feel anything other.
 
Level 9
Joined
Oct 7, 2008
Messages
299
Well, well. This System gives very much objectives how to use it in other cases.
I have much ideas how to use it. I can say; very nice coded spell. I dunno that there was a possibility to make it look like this (the bars). I thought I have to use jass for such bars. Never thought about a floating text. I like this very nice and original coded system.
I would rate it 5/5 'cause I could not find anything wrong with it.
Keep it up, dude. :D +rep deserved, if I can give you some. ;D
 
Well, well. This System gives very much objectives how to use it in other cases.
I have much ideas how to use it. I can say; very nice coded spell. I dunno that there was a possibility to make it look like this (the bars). I thought I have to use jass for such bars. Never thought about a floating text. I like this very nice and original coded system.
I would rate it 5/5 'cause I could not find anything wrong with it.
Keep it up, dude. :D +rep deserved, if I can give you some. ;D

Jass use character "|" and it have 2 string variables (or meaby 3). Because "|" is VERY thin character, you need 100-200 characters to make it like fine sized bar. I use "I" because it is not so thin and need only 10-20 to make fine sized bar. Why people use "|" also? Because it fill spaces and looks like one whole bar (like in Skibi Castle blue bars over towers). Character "I" is just fine.
 
One question, is it possible to use a space room as a bar? Seen it on others, looks quite betta :p

I dont tryed. Chose your character that you like better. I just gave example of 2 most in use characters.

EDIT: some strange characters that warcraft dont understand and it is kinda nice symvol can be used too (if it will have good look). Try your keyboard with diferent language :p
 
How do you use it you just import it and thats it or something else?

Well, you need to:
-Open map with system
-Go to File/Preferences/General and tick on box "Automaticaly create unknown variables while pasting trigger data"
-Copy all triggers that you need
-Open your map
-Paste triggers
-Replase unknown items on broken lines with your items
 
Level 31
Joined
Sep 11, 2009
Messages
1,812
Thats true when i don't eat 3-4 days i will die, i will not take any damage or feel anything other.

lol that is so not true... if a human doesnt eat for 2-3 weeks and die, he will start to be rly thin, get sick, will have no strengh, and then will die.

it wont do, u doesnt eat for 2-3 weeks and u are in perfect Shape and boom, u die.

the Spell is, to me, rly good the way it is, but giving a bad example like this is just not helping the spell to stay the way it is.
 
Level 1
Joined
Apr 22, 2010
Messages
4
Hm... I think that this spell can be better - too long time to die without eating. And bar is bit to big... Should be smaller...
 
Level 6
Joined
May 20, 2010
Messages
274
uhhm...NFwar..if i could make a request could you also pls make a rage system like in warcraft :D it removes the mana bar and replace it with rage that increases each time a warrior attacks an enemy and take damage pls pls :) i will surely give you +rep :D
 
Level 18
Joined
Oct 17, 2012
Messages
818
BalanceDruid7,

In the Hunger Loop trigger, go to

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • HU_Value[HU] Less than or equal to 0.00
  • Then - Actions
    • Unit - Kill HU_Unit[HU]
  • Else - Actions
Then change the Actions part as you see fit.
 
Last edited:
In the Hunger Loop trigger, go to
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • HU_Value[HU] Less than or equal to 0.00
  • Then - Actions
  • Unit - Kill HU_Unit[HU]
  • Else - Actions
Then change the Actions part as you see fit.
I am no longer able to modify this resourse or have access to it.
 
Top