Final called twice on instances

Not sure if I have some obscure bug or something here but here goes:

I have an enemy, instance0. I kill it, final is called upon it. Within the same or a few frames afterwards (tried both scenarios), after its death, its death is reported to a spawner script.

This spawner script, still in the same frame, creates a new enemy. It is given also the name of instance0.
After this, the final function is called once again. Yet instance0 lives.

I might be making a mistake here, but it seems something’s wrong if the final function is called multiple times, and the reported id is actually living?

Edit:
Ok, I’ll let this stand here as a warning example of fooling yourself over silly things.. the final call I was observing was from when I was closing the game.

So yeah.. code late at night.. see what happens!

2 Likes

make sure youre not using local variable
for example if you have:

local health_points = 5 

change it to

self.health_points = 5

That’s assuming that may be your problem. otherwise you probably should share a snippet of the code.

Just noticed your edit lol

1 Like