Complete, in-depth explanation

Can anyone either explain, or point me in the direction of an explanation of the “how to’s” for extension building? The game documentation is shoddy at best, and there are lots of things that are either out-dated, completely missing, or poorly translated. For instance:

  • What are ‘scene properties’ in behaviors used for?
  • Or the ‘object groups’ tab in functions?
  • Or the ‘children’ tab on custom objects?
  • What’s the difference between a function that’s “type”: “scene
    variable” and it’s parameter that’s “type”: “scene variable”

Frankly I have so many questions about what things are, how to use thing’s, and why thing’s don’t seem to work, I couldn’t possibly fit them all here and actually expect anyone to to take the time to explain ALL of it to me. And I’ve read the documentation so many damn times and gained next to nothing out of it, my brain is going numb… If anyone know where a GOOD in-depth tutorial or document completely outlining the workings of extension creation, I would be forever grateful to you. Otherwise, if anyone is bored AF and wants to answer every single one of my questions as they arise, I would give you my soul. The whole thing. yours. What would YOU do if you had two souls to call your own? Something pretty awesome, I bet…

I’m going to do my best. The way I learned is through experimenting and looking at existing functions and behaviors.

What are ‘scene properties’ in behaviors used for?
Properties are like variables for behaviors. Once added they appear in the behavior’s setup screen unless set as hidden. It’s easier to use a parameter and it allows the setting to be changed from outside the behavior similar to a parameter.

You also click the three dots and automatically create functions to get and set the values.

see more:
https://wiki.gdevelop.io/gdevelop5/behaviors/events-based-behaviors/#2-use-actions-conditions-and-expressions

the ‘object groups’ tab in functions?
Object groups are just like scene or global groups but they use the objects set up as parameters. Say you have a function that has parameters named obj1 and obj2. You could create an extension or behavior group with obj1 and obj2 and use it to select a random object or with a for each object. You can’t use scene group names inside functions. Functions are self-contained. You can’t even use the scene object names; they get passed through parameters. You can only use the objects passed through parameters (unless using JavaScript)

*** Or the ‘children’ tab on custom objects?**
The children are the objects used within the custom or prefab object.

Example the button object has 3 state objects and a text object.

You can use the children in events just like the other event sheets. The actual images are mostly setup in the scene. You can assign some existing images but for the most part you can only add animation names within the behavior and then change the other options from the scene.

You don’t have a scene editor. Objects need to be added through events. You can add startup objects using the OnCreated event.

Example from the button object

What’s the difference between a function that’s “type”: “scene variable” and it’s parameter that’s “type”: “scene variable"

I have no idea. You can copy variables used in a function to a supplied variable chosen from a parameter in the type of variable but I don’t know how you use it as an expression. I can create an action that modifies the variable in the parameter but I have no idea about an expression in the form of a variable.

Post any other questions related to functions and behaviors and I’ll try to help if I can.

your first paragraph explained “Behavior Properties”. I know what behavior properties are for. I need to know what “Scene Properties” are used for.

everything else was helpful though. Thank you for taking the time.
Perhaps you might know how to help with a suspected bug I’m experiencing… I’ve scrapped 2 games now out of frustration in dealing with this…:

So I have an object. Standard sprite. Then I realize I can make things easier using custom extension functions if I make that object a custom object. So I make a new custom object. Give it all the bells and whistles, give it functionality, and when I go to place it in a scene, there is no sprite. Just a red “X”.
Screenshot 2024-06-11 025530
Screenshot 2024-06-11 025723

I can’t figure it out and it’s driving me nutz…

I’m not sure expect as I recall when testing it. Scene properties are just 1 property that is shared among all objects while the other one works at an instance level. I could be wrong. It was a while ago when I tested it.

As far as the X. Does the objects work? Do you have animations assigned to everything.

You can set the image for some objects like tiled and panel sprites within the custom object setup and you can setup empty animations but you can only choose from existing resources.

I think each animation needs as image. Oddly as I recall, the size of the main object is determined by I believe the size of the last added child object.

Scene properties are just 1 property that is shared among all objects while the other one works at an instance level.

This totally checks out. Thank you.

As for the X thing:

This helped SO effing much! It answered my earlier question about what the hell children were for in the custom obj, AND I now realize why I have been having trouble with my custom extension… Thank You. Wholeheartedly. Thank You.

1 Like

Oh master of wisdom in extensions, lol:

I am having an issue I hope you can shed some light on. I am trying to set up a function for an object that triggers on creation of said object. Well, here…:

This is the working Action Function. aaaaaannnd…:

This is what I get when I try to call that action from the ‘OnCreated’ function of the object.

I previously had it all working in an external event, but chose to try and put as much as I could in the extensions functions instead. Ever since I did it’s been nothing but a nightmare. I know I’m just missing something. I just can’t seem to wrap my head around it. any ideas would be rad. TY TY TY so much for your help!

Does your object have the required behaviors? The behavior properties and the function both need to have the required behavior parameter or property. I’m guessing that the function has it but not the behavior. GD will add the list behaviors when your behavior is added to an object but you might need to remove and re-add the behavior to your object if you add the behaviors as a needed behavior after your behavior is added to an object. You could also manually add the missing behavior but sometimes it’s just easier to remove it and add it back.

Behavior properties

Function properties

Object

1 Like

This is what I got

Curse these Funking-Functions lol.

The OnCreated event uses the required behaviors parameters for the behaviors that it’s in.

It would need the required listing there like here.

But you can’t add anything in ‘OnCreated’. I don’t understand

Not the OnCreated but the properties for the behavior that it is in.
In my example, click on Qwerty and then the properties tab.

i think I figured out a solution…
Just call the function manually rather than with ‘OnCreated’

I Watched it. Does cDeck have the required behaviors? If it’s OnCreated function is calling a function that requires behaviors then it’s object also needs to have the behaviors. Everything communicates with each other. If one event needs a behavior then any function or object also needs to have the behavior.

The function behavior list is for the function. If the function has events that use the drag behavior, then the object calling it needs to have the behavior. The required is for the object, functions have parameters. It’s all hierarchy. Functions are basically passing the behavior along.

IDK if this will help or add to the confusion but here’s a try.

You start with an object and any behaviors. The value gets passed from the object to the behavior and then either to its functions or to another behavior.

Not everything needs to have every behavior but if one behavior needs a specific behavior than the previous function, behavior or object needs to have the behavior. You can’t have the next input without a previous output.

id does kind of make sense, but I think the primary issue was that cDeck was creating different objects(cCards) in it’s initializing, which is why cDecks ‘OnCreated’ function was spazzing out, because any ‘lifecycle’ function only has parameters for itself and its behavior. I circumvented the whole issue by simply calling the initialization manually in the same event that would create and place the deck. Now I’m slowly figuring out just how psychotic custom objects really are… I mean, I can see how useful they can be in trimming down and organizing events and sharing with the overall community and what-not, but holy crap-baskets the insane amount of extra work needed just to make them show up as intended in-game is unreal! I can’t imagine anyone else would use these functions, and certainly not the way I have it all set up lol. I might just keep the behaviors and scrap the custom objects in favor of variables’. I swear, if I had stuck with that in the first place, I might have a functioning demo by now lol.

1 Like