Trying to set up a system where when you reach x number of kills a barrier is removed for the player.
I have a Autoscript that is counting the kills working fine, what i cant figure out is how to write it out. the kills are also displayed and updated on a label.
ive tried
if Autoscript.kills >= 10:
if kills.int >= 10:
if kills >= 10:
if Autoscipt.text >= 10:
Can you paste your actual code in here? I will try to answer by what I am reading and lets see if it helps:
If you are using an Autoscript it would look like this:
Extends Node
#the script would have a name in the Autoscript like GameManager or whatever you named it
Var kills = 0
Then in other scripts you would access this and do an if statement like this:
#This would need to be in a process function or be connected to a signal that emits when the player reaches 10 kill or more.
func _process():
If autoscriptname.kills >= 10:
remove_child(wall)
Share a screenshot of your Autoscript settings and I can tell you the name
I know this is a dumb question, but is that name the same as the name of the script or is it different? For my example above mine is named the same, but that may not be the case for you. Lets check this and then I will see what other solutions I can think of.
FYI and just in case - The autoload scripts need to be put into the Project Settings to be accessible. This is in Project → Project Settings → Globals → Autoload tab
That is so baffling
You havent moved the Autoscript.gd into a folder or anything have you? Is it still in the root of your project like the screenshot shows?
If you did move it then you will need to re-add it with the new path into the Autoload
I would try a simple re-loading of the project. Sometimes turning it off and on works for Godot as well
With the Autoload script it definitely should be accessible from ANY script as you know, so it sounds more like a Godot glitch at the moment if Autoscript.kills is not getting that variable.
Maybe delete it and re-autoload it as well
HA it worked!!! thats so painful. i typed in that if statement you suggested so many times before i made this post. crazy that referencing something that doesnt need it can cause such a issue.
Thanks so much for the help! (im a giant noob i need all the help i can get)