0 votes
func create new enemy (type),
Var enemy = Battle Units. Enemy
var oppcheck = randongen.chance(0)

create new opp() 

Elif enemy == null
If type == 'null'
Enemies.shuttle()
var Enemy = Enemies. Front() 
var CreateEnemy = Enemy. instance()
EP.add child CreateEnemy)

if CreateEnemy.name = "Chest";
CreateEnemy. fake = true
hideMagicButtons()
battleButtonContainer.hide () 
battleOppContafiner.show()
O battleOppContainer.get_node("OpenActionButton).show()
print("Mimic Created")
else:

CreateEnemy.connect("on_death", self, _on_Enemy_Death)
else:

var CreateEnemy = type, instance()
EP.add child(createEnemy)

I can't see to find the error or at least how to fix it, btw I used Google lens to get the text because I'm using my phone so sorry if it's a little hard to read I fixed it up a bit to be more readable

in Engine by (48 points)

1 Answer

+1 vote
Best answer

If type == 'null'

'null' is a string. type is probably an Object in this case. That's indeed the wrong comparison. Use null instead, or if you really expected a string containing "null", you may look for the code sending you type.

by (28,740 points)
selected by

Yeah that was the problem, thank you for that!

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 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 webmaster@godotengine.org with your username.