Changing the initial value of object variables programat.

Hi there,

I’m not sure whether or not it’s possible to change the initial value of local object variables programatically (with an action) before any object instances are created. If it is possible, please ignore the suggestion. I think it might not be possible, after some experiments with my project (Turret fire - #7 by kalel), but I’m not sure.

In my project example, I want to set turret local variables (speed, range, etc.) programatically which will be automatically inherited by each instance when the user creates a turret object at a specific location. This is so I can have one control code (no duplicates necessary) which read the important data from local variables for each object. It is possible to change the initial value in scene editor/variable editor manually., so this suggestion is to also make an action that allows to change the initial value, which will apply to all created instances.

This would be useful also when saving/loading these parameters (e.g. once a turret is upgraded in the “upgrade shop”, this should be saved to a file, then the local object value can be read from the file when the game is restarted, and applied to all instances of the object that are later created).

As far as I know, no, you can’t do that right now… you will have to modify the instance variables after creating it :neutral_face: