How would I add a Thirst requirement and bar

Started by GreensilverMega on

Topic category: Help with modding (Java Edition)

Last seen on 02:17, 17. Apr 2024
Joined Dec 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How would I add a Thirst requirement and bar

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 

Last seen on 17:56, 10. Mar 2024
Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Maybe with an overlay that…
Sun, 12/17/2023 - 21:10

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. 

Last seen on 04:46, 14. Mar 2024
Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
you prb will need a Global…
Mon, 12/18/2023 - 00:17

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 (OnPlayerTickUpdate) - to timer your thrist decays and also to modify the value here when player drink water, make a Return of that variable on the end of the procedure
  • 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 :)

Last seen on 04:46, 14. Mar 2024
Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
and no you dont need 10…
Mon, 12/18/2023 - 00:18

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 :)

Last seen on 04:46, 14. Mar 2024
Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
for your thirst bar u need…
Mon, 12/18/2023 - 00:22

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)

Last seen on 04:46, 14. Mar 2024
Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
clarifying - 10 images for…
Mon, 12/18/2023 - 00:23

clarifying - 10 images for bars that go 10% for condition

5 images - 20% per conditions and so on

Last seen on 17:56, 10. Mar 2024
Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yes, 10 images, not 10…
Mon, 12/18/2023 - 12:34

Yes, 10 images, not 10 overlays, thanks for the correction. 

Last seen on 02:17, 17. Apr 2024
Joined Dec 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks for the help I found…
Mon, 12/18/2023 - 15:17

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?

Last seen on 02:17, 17. Apr 2024
Joined Dec 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thanks Klemen!
Mon, 12/18/2023 - 19:57

Thanks Klemen!

Last seen on 02:17, 17. Apr 2024
Joined Dec 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Wait nevermind it won't let…
Mon, 12/18/2023 - 20:17

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

Last seen on 02:17, 17. Apr 2024
Joined Dec 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
   
Mon, 12/18/2023 - 20:28

aa

 

 

Last seen on 17:56, 10. Mar 2024
Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Try on player tick update. 
Tue, 12/19/2023 - 12:53

Try on player tick update. 

You can save anyway, this is…
Wed, 12/20/2023 - 19:50

You can save anyway, this is warning only:

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

Last seen on 04:46, 14. Mar 2024
Joined Nov 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
yeah its a warning so people…
Thu, 12/21/2023 - 01:50

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