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'
var Enemy = Enemies. Front() 
var CreateEnemy = Enemy. instance()
EP.add child CreateEnemy)

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

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

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

asked Jan 12 in Engine by Dead_lucky_32 (29 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.

answered Jan 12 by Zylann (22,041 points)
selected Jan 12 by Dead_lucky_32

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.