This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

At least, I think thats what the problem is. I'm not exactly sure how to describe it.

What I'm trying to do here is create a simple point and click where a cutscene plays each time you click something. I have a script called "globals" containing variables and functions to get them. These variables are: stage, progress, and animon.

"stage" and "progress" are self explanatory. "animon" is a boolean, which is there so that I can tell if an animation (cutscene) is playing or not.

Here is my script for the button:

extends Control

onready var animplayer = get_node("../../../AnimationPlayer") 

func _input_event(ev):
    if (ev.type==InputEvent.MOUSE_BUTTON and ev.button_index==BUTTON_LEFT and ev.pressed and get_node("/root/globals").getAnimon() == false):
        if(get_node("/root/globals").getStage() == 1):
            if(get_node("/root/globals").getProgress() == 0):
                animplayer.connect("finished", get_node("/root/globals"), "setAnimon", [false])
      "Cutscene 2")
        elif(get_node("root/globals").getProgress() == 1):
                animplayer.connect("finished", get_node("/root/globals"), "setAnimon", [false])
      "Cutscene 3")

func _ready():

This throws the following error when I click the button:

Attempt to call function 'getProgress' in base 'null instance' on a null instance.

Its most likely a simple mistake. Thanks for any help that I get!

in Engine by (174 points)

1 Answer

+1 vote

Easy, you missed the "/" before root at elif(get_node("root/globals").getProgress() == 1):

by (692 points)

Now clicking the first button plays the first cutscene. However, it gives me the same error when I click the second.

Please check the row number in the error message. Sure it is the same mistake.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.