Cant get a pressure system to work

Started by ImNotFun on

Topic category: Help with MCreator software

Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Cant get a pressure system to work
Thu, 07/16/2020 - 06:37 (edited)

So I'm trying to make an underwater pressure system, so that the lower you go the higher a custom 'pressure' variable gets. So far I'm trying to get this working in an overlay, where I've been able to get the overlay to appear when the player is in water. The problem is, when I've tried to alter the pressure value It hasn't worked. The way I have it set up is to -

check if the player is in water

if true, display PRESSURE_GUI

 > check if the player's Y level is below a certain threshold - e.g. Y=64

     if true, set PRESSURE_VAR to 1

     else, set PRESSURE_VAR to 0

 

So far that hasn't worked, and I'd like to have a system that doesn't require me to individually alter the pressure value for each Y level, but I can't think of how to do this.

Any help would be greatly appreciated, though be warned, this has caused me many headaches

 

Just to add, I'm running a procedure that (on a player tick update) runs the above code

Edited by ImNotFun on Thu, 07/16/2020 - 06:37
Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I think that is a bad way to…
Thu, 07/16/2020 - 07:23

I think that is a bad way to check the pressure and implement it as a whole.

I made this it took me like 5 or 6 minutes i think anyway it's very basic but i could make it so the pressure isn't just effected by the amount of water you are under but all so effected by your Y cord value.

just so it makes more sense but yea reply to me what you want and i will get back to you. :)

Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
remember the x y z entity…
Thu, 07/16/2020 - 07:30

remember the x y z entity cords are messed up they get fixed in 2020.4 version of MCreator.

but my procedure will work if you are in an ocean, but if you are in a area 1x1 filled with water it won't work because the bug.

Joined Jul 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I got bored but i think that…
Thu, 07/16/2020 - 08:33

I got bored but i think that this is the simplest way to make this work well feel free to modify this i Don't take any official rights over this.

WaterPressure

Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hey, thank you. I tried this…
Fri, 07/17/2020 - 09:59

Hey, thank you. I tried this and it works, although when the player ascends the pressure value doesn't decrease and stays on the highest value