Additional Progress Bar and Variable Does Not Exist

Godot Version

Godot 4.2.1

Question

The Problem:

I didn’t add the top left progress bar, I can’t select it, and it doesn’t seem to be in my node tree (top left: it is fully expanded unless there is a way to hide nodes). I can’t delete it, it wasn’t in my recent action history, and it stops the other identical progress bar [selected] from working. I also tried deleting the selected progress bar and restarting the program, but neither worked. More info below.

I found this because I booted up my game and it gave me “Invalid set index ‘value’ (on base: 'Nil) […]” in reference to line 15 in the following image (which means manalossBar didn’t exist at the time unless I’m mistaken). This is everything in my progress bar script. manalossBar is a progress bar under the main progress bar that decreases with latency from a timer.

[The forum doesn’t allow me to put multiple images in a post, so the rest will be in replies, sorry]

IMG1

The progress bar itself works fine in its own scene, so I checked ‘mana_handler’, which deals with the progress bar. Here is its script:

IMG2

This script works fine on its own (when it has the corresponding progress bar in mana_bar).

So next I moved up to the character. This is the only code that references the progress bar (mana_bar) in the character script:

IMG3

The game worked fine when I added lines 55 and 56 (commented out now) and stopped working when I added line 52.

The other, red progress bar has almost identical code that I can upload if it would be helpful. I haven’t been able to find anything about this sort of thing online.

This seems like such a weird issue ;-;

NOTE: The reason why I think the duplicate progress bar might be causing the program not to function is that I got an error early on saying something about a parent already having a child of manaBar BUT I haven’t been able to reproduce it so they are quite possibly two separate issues. Or my bad code causing both LOL

NEW FINDINGS:
Everything works fine if I put:

init_mana(30)

directly into the progress bar. More than this, this initializes BOTH of the blue progress bars that are in the canvaslayer, but only ONE decreases when I set the progress value from a different script. If I later change the value of the progress bar in the progress bar’s script, it sets both of them. This will make sense in a second.

When I move the progress bar in its scene file, the extra progress bar shown in the picture above moves. It is showing the progress bar from the progress bar’s own scene in a different scene, the character scene. It stays there even if I delete all other blue progress bar nodes from that scene. If anyone knows why please do tell ;-;. If this is confusing, I can provide pictures in the replies.

VID1 showing what I mean below

Upon deleting the progress bar node in the character scene it also inconsistently shoots out “Parameter ‘common parent’ is null” and I can’t tell why or how to make it consistent. I can try to get more info if anything is needed.

The forum didn’t let me use multiple images, so I will try to put the missing ones here:

IMG1:

IMG2:

IMG3:

image

VID1:

For some reason it looks like you:

  • Have a @tool script that creates the extra bar
    or
  • Have one of these scenes containing the extra bar

I am mildly silly. I isolated that the additional progress bar was coming from a specific node (manaHandler). I then deleted the node + copied the script over and it got rid of the progress bar (I guess the progress bar was on the node somehow or somewhere but I never found it). Also the Nil variable was just because I was calling a function containing a variable before the @onready variable was stated. Oh well. It’s fixed now

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.