I need help making a "mana" counter

Started by ScaredBonez on

Topic category: Help with modding (Java Edition)

Last seen on 18:28, 4. Apr 2021
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I need help making a "mana" counter
Fri, 03/19/2021 - 12:32 (edited)

Hello, I need help making a "mana" counter for my mod, well, mana is actually called magic particles in my mod, but its the same thing as mana. I just want to have a number that appears on the top right of the screen after the player injects themselves with the potion required to unlock the ability to use mana for magic, and depending on what they do, that number will decrease or increase, when the player first unlocks it it will say 100 magic particles and then if they do something like use a spell that takes 50 mana or something it will go down to 50 magic particles but will rise back up over time to 100. Then i also want to add like an item to the game that if used will increase their mana/magic particles number by a certain amount. 

 

 

Edited by ScaredBonez on Fri, 03/19/2021 - 12:32
Last seen on 12:44, 17. Aug 2021
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
um....save variables? I don…
Fri, 03/19/2021 - 12:48

um....save variables?

I don't really know but variables seem to be the thing you use, make things to increase/deacrease it, but then it's single-player exclusive. a price to pay I guess ¯\_(ツ)_/¯

or look it up

Last seen on 18:28, 4. Apr 2021
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
i have tried looking up how…
Fri, 03/19/2021 - 13:02

i have tried looking up how to do this but i ended up empty handed, so i shall wait for more replies and hopefully someone knows.

Last seen on 16:44, 7. Oct 2023
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Create a variable for your…
Fri, 03/19/2021 - 14:52

Create a variable for your counter, set it to number type and set it to player lifetime. Then create overlays that will show up when variable = number of your bar you need. ( for exemple, to show bar that has 1 left, you need: (Variable) > 0 AND (Variable) ≤ 1. (exemple For 2 left:) (Variable) > 1 AND (Variable) ≤ 2 and so on. ) Then create procedures:

 

Here's procedure:

[ON PLAYER TICK UPDATE:]

--------------------------------------------------------------------------

IF: [(Variable) > (Number) AND (variable) ≤ (Number)]

DO: [Return: true]

--------------------------------------------------------------------------

[Renturn: false]

 

For your variable regenerate on time, set following procedure:

[ON PLAYER TICK UPDATE:]

[Set (variable) to: [(Variable + 0.05)]] <(that will regenerate your bar for 1 number per second, to understand how much does regenerates per second, multiply the number by 20)

 

 

To prevent you number going above you want:

 

[ON PLAYER TICK UPDATE:]

------------------------------------------------------------------------

IF: [(Get variable] > [(number you want)]

DO: Set (variable) to: (your max number of bar)

------------------------------------------------------------------------

I think thats all

Last seen on 18:28, 4. Apr 2021
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
thanks, can you send…
Fri, 03/19/2021 - 15:53

thanks, can you send pictures of the procedures just so that way i know exactly what to do?

Last seen on 18:28, 4. Apr 2021
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
and which procedure is for…
Fri, 03/19/2021 - 16:10

and which procedure is for which overlays

Last seen on 16:44, 7. Oct 2023
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
idk how to send images, but…
Fri, 03/19/2021 - 16:17

idk how to send images, but you need to select procedure so it would match the overlay, like if u want to 0.5 number overlay show up when your number is at one, in overlay conditions select mathcing procedure

Last seen on 18:28, 4. Apr 2021
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
is this what im supposed to…
Fri, 03/19/2021 - 17:18

Mana count procedure 1

is this what im supposed to do for the first procedure, then do i link it to "display overlay in-game"

Last seen on 18:28, 4. Apr 2021
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
also how to make it so that…
Fri, 03/19/2021 - 17:22

also how to make it so that it goes down when player does certain thing?

Last seen on 16:44, 7. Oct 2023
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
create a procedure for tht,…
Fri, 03/19/2021 - 18:11

create a procedure for tht, for example:

at tool's trigger, that triggers on right click:

Make a procedure to check if needed amount of you bar is aviable, and if it is, it will run the ability and take from you, for example, 2 . That the procedure to take it away: [(Set (Variable)) to: {(Get (variable)) - (2)}].

Else if its not enough of it, just make it play some sound (for example, blocks.note.bass) and say something like "Not enough mana!"

 

Last seen on 18:28, 4. Apr 2021
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
i made it so it wont go…
Sat, 03/20/2021 - 12:44

i made it so it wont go under 0, but for some reason it also still lets the player use the spell even after it reaches zero, they can keep using the spell and the number will regen when they stop using the spell but how do i make it so that they cant use the ranged item anymore until it regenerates a certain amount?

Last seen on 18:28, 4. Apr 2021
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
also, it shows 999999 when…
Sat, 03/20/2021 - 12:52

also, it shows 999999 when regenerating unless i set it the [(Variable + 0.05)]] to 1 instead of 0.05 it shows 99999999 but 1 is too fast and i don't want it to show those 9's is there a way to fix that, if not thats fine. 

 

mana count 99999

Last seen on 16:44, 7. Oct 2023
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
make your tools consume less…
Sat, 03/20/2021 - 16:52

make your tools consume less of it and make regeneration less. that's only thing i can suggest. To prevent players use smth when your number is at 0, make a procdedure to check if there is amount you need, and if there's not, it will dont do it, instead it will do smth else, like send a messege in chat, like that:

example

Last seen on 18:28, 4. Apr 2021
Joined Mar 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
well alright, i tried…
Sat, 03/20/2021 - 16:57

well alright, i tried everything i can but its not working how i want it to, i think im gonna make players have to use mana potions instead of having a mana counter that goes up they will have to use different variations of potions that hold different amounts of mana.