[SOLVED] How Do I assign values to object variables on creation, based on other things

I am trying to make evolution using the boid extension. I am trying to add mutations into the weights. It all works fine, but when a boid reproduces, I need its child to inherit the same weights as it before I mutate. How??

You could use a scene or global variable to hold the value and then assign it to the new object and it’s behavior. I don’t understand your methodology so I’m not sure where you would get the value from. I don’t know if it would come from another object behavior or variable.

I don’t know if each object would need a mutated and pre-mutation variable. Again, I don’t understand the science.

basically i need each boid(prey) to copy itself, including all its variables. ‘create object’ creates a blank copy with only the default variables. i am aware that ‘create object’ selects the object, but i need to keep the original boid selected as well as the new one to copy over the variables

If they’re instances of the same object then you can’t access the information selectively. Reading the data would probably reference the older object and setting values would either apply to both or the older one.

It would be easier if all of the variables were in 1 object structure then you could copy the structure to a string variable with JSON and then assign it to the new instance.

Pick the older object
Copy it’s variables and any other setting to scene variables or 1 Json string
Create a new object
Copy the variables and settings from the scene variables to the new object

The extended variables extension can copy all of object variables but it seems to be from 1 object to another object not instances. I guess you could use a dummy object to hold the variables.

Copy old to a dummy unused object
Add new object
Copy from dummy object to new one

I prefer the scene variables with Json method but variables are variables.

yeah I had an idea to store each variable as a temporary scene variable but i thought it was too jank ill try that

1 Like

ok my idea works thank you