Error with Mana Bar

Started by 2Cool4u on

Topic category: Help with Minecraft modding (Java Edition)

Active 1 year ago
Joined Apr 2015
Points:
1027

User statistics:

  • Modifications: 0
  • Forum topics: 51
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 110
Error with Mana Bar

HI, I made a mana bar but for some reason when I use an item that is supposed to consume the mana, it consumes the nbt value of 1 mana but the overlay doesnt show - 1 mana star. I set the first mana star to display only when the nbt value is greater than 1, than second is 2, etc... any help?

Active 6 months ago
Joined Jul 2020
Points:
699

User statistics:

  • Modifications: 0
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 130
pictures of your work would…
Mon, 11/23/2020 - 22:26

pictures of your work would help allot :)

 

Active 1 year ago
Joined Apr 2015
Points:
1027

User statistics:

  • Modifications: 0
  • Forum topics: 51
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 110
I think I got it but there…
Tue, 11/24/2020 - 02:09

I think I got it but there had to be a better way to do it, ill send a photo one second.

Active 1 year ago
Joined Apr 2015
Points:
1027

User statistics:

  • Modifications: 0
  • Forum topics: 51
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 110
(No subject)
Tue, 11/24/2020 - 02:13

Ok so this is it. But I have a question. I made a global variable called "manavalue" count up on player tick. The global variable is a NUMBER type and variable scope is PLAYER_LIFETIME. I works fine at the moment but I was wondering, will this work in multiplayer? Is the global variable for all players or just each person?

Active 1 year ago
Joined Apr 2015
Points:
1027

User statistics:

  • Modifications: 0
  • Forum topics: 51
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 110
(No subject)
Tue, 11/24/2020 - 02:15

Try #2

Active 1 year ago
Joined Mar 2019
Points:
758

User statistics:

  • Modifications: 2
  • Forum topics: 9
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 44
The global variable when…
Tue, 11/24/2020 - 04:07

The global variable when specified for player only affects the player if I am correct, at least through the testing I've done. I may be wrong however.

Active 6 months ago
Joined Jul 2020
Points:
699

User statistics:

  • Modifications: 0
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 130
the variables are local to…
Tue, 11/24/2020 - 06:06

the variables are local to the event that effects the variable.

remember, there are times where you cannot use global variable of player like on entity attacked trigger.
The only way to update a global variable from a situation like this is to set the one of the triggers nbt data then have a procedure that will set your global variable to the local nbt data that you saved before.

Hope that made sense.

Active 1 year ago
Joined Apr 2015
Points:
1027

User statistics:

  • Modifications: 0
  • Forum topics: 51
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 110
I understand, thank you
Tue, 11/24/2020 - 18:16

I understand, thank you