Turret fire

Okay, I think I figured out the issue, and want to post about it in case anyone else experiences a similar problem.

This is my understanding only without looking at source code, it could be wrong.

In my game, I have this kind of standard mechanism:

Player selects a spot, purchases a turret, and a turret is placed on the selected position (where to place the turret is guided by ID of the selected turret placement spot, ID is written manually as a local variable to each turret placement spot instance).

The purchased turret instance uses local object variables to store information, such as firing range (when to start/stop shooting at enemy), firing speed, etc. Currently not all parts are implemented correctly.

Anyway, you can’t change the initial object variable programatically, unless you do it in the scene editor or gdg file manually. You need to set the variables for each instance after the instance gets created.

The way I solved it for now is something like this:

Where TurretVariables event looks like:

(Turret1 is the Turret type 1, but all turret types will get grouped into a group called Turrets, so I will use this group instead of accessing each type once I recreate my code, just like in the previous posts).

Hopefully, this can help a bit.