How dynamically call a child of an array inside EXTENSION event?

There’s still some variable functions that exist for extension. Backwards compatibility. Technically, if the variable is only used in the extension then the object variable doesn’t need to be defined in the main scene.

Behaviors like the linked objects behavior still use object variables. It works weather the variable is defined or not. Although, the variables won’t work in the main event sheet.

While it does work. It doesn’t mean it will in the future. It doesn’t mean it’s the best approach.

Mmmmm ok I see.

does that mean that I should do either one of these things?:
1: declare the variable that I use (I have no idea where to do that)

or

2: use object property (from behaviour) for the ID system and other stuffs. Object properties can be different from instances to instances right? similarly obj variables right?

If you want more down to earth advises, you should explain what you are planning to do. For instance, you can list every function, behavior or object, you will make and explain what they do and how they fit in the whole picture of the extension.
You could even give several plans if your not sure which one to choose.

tried using behaviours

is this error message normal? I added the behaviour to the object in the scene editor. Still… it sais missing behaviour. (this message appears in the events inside the extension). when i put the event in the main scene events as shown by AnselGames, it can call dynamically just fine.

error here:

i assume that its because the extension doesnt know if the behaviour is actually assigned before running the preview.

This section should help:

Hello! I am very sorry to annoy you yet again.

I have just read the whole page. An it still doesnt solve the issue.
According to the documentation:

“Parameter values can’t be changed with actions. If you want to give back a value to scene events, you have to create a custom expression.”

Turns out that I still don’t have access to expression functions from behaviours, (i can but only from the main scene event). And if I create a custom function from the extension (not attached to the behaviours), then my function doesnt have access to the behaviour.

there is probably a syntax i’m missing. (which is strange because the main event can access behaviour properties, the same syntax doesnt work for within the extension (inside of which the behaviour is in))

what is the way to call the behaviour properties (from the extension action functions), similarly to what AnselGames proposed?

You are missing the behavior parameter. It is meant to be below the object


Without that Gdevelop doesn’t know the behavior exists on the object.
So then you can access it:

This is true but remember in the extension you are passing an object (The first parameter) and that’s what you can’t change. You can still use the actions (provided by the behaviour) to change the id inside the object.

works wonders thank you! thank you to everyone else as well

You can’t change the value of a property from outside of the behavior but you can add action and expression functions. GD can automatically add them for you.

Go to the behavior properties.

Right click or long press the property to diaplay it’s popup menu.

Choose generate expression… (Mine is greyed out because the functions were already generated)

GD will then add functions that read and set the property. They will now appear for the object with the behavior in the action and expression list.

Having functions allows you to modify the way values are read and set. You could do things like clamp the value or format it. Or trigger something else to happen when the value changes.