Started by
GreensilverMega
on
Topic category: Help with Minecraft modding (Java Edition)
I am working on a mod and I want to add thirst as a requirement to survive. You can purify it to replenish your thirst better but I don't know how to make a thirst bar above the hunger bar and I don't know how to make it work. It would be so appreciated for my Horror Mod
Maybe with an overlay that has display conditions based on a variable.
Like, create 10 overlays for each level of thirst and set their display conditions depending on the variable.
you prb will need a Global Var (Player Lifetime) - this will save when u leave the world and reset when the player dies, then:
make a procedure to Return the current value (from the last procedure) of the Variable (thrist) so u can display on the Overlay
let me know if u made it work, i made a bank acount system like that (mine is player persistent thou, so wont reset on player death) but the rest its the same i think, i might be able to help you more :)
and no you dont need 10 overlays, all u need is to Return the Current value of the Thrist variable on the overlay, work with my variable so should work for you :)
for your thirst bar u need to make 10 images (1 display on each condition - bar 25%, 50% and so on, so u need 10 bars over each other on the Same overlay), like condition 1 -> if Return value (current thrist) = max value (full bar) / 5 = 20% so this will display the bar at 20% for example, i also made this for fuel and energy bars so principle is the same, but instead of Return current energy you return the current thrist (global var)
clarifying - 10 images for bars that go 10% for condition
5 images - 20% per conditions and so on
Yes, 10 images, not 10 overlays, thanks for the correction.
Thanks for the help I found a tutorial on youtube for the bar but now I just need the part where it drains every 2 minutes, any ideas?
You can make tick counter timer for this.
https://www.youtube.com/watch?v=gTbWiMu-M-0
https://www.youtube.com/results?search_query=mcreator+tick+timer
Thanks Klemen!
Wait nevermind it won't let me save it because it says this
it says this: On world tick update global trigger is tick event based. Keep in mind that running to complex or demanding procedures each tick can impact game performance
Try on player tick update.
You can save anyway, this is warning only:
yeah its a warning so people know if they start to put A LOT of stuff on world/player ticks off course the game might lag (fps drop) - btw u should use OnPlayerTickUpdate (since its a player variable) instead of OnWorldTickUpdate, less heavy