Hi guys, just something that occurred to me while I was trying to create an easier character selection/buy screen for my game. This is probably a really Noob question.
The below objects belong in a group called Bloblos.
Now I just want to know why this happens. Why was the Sub-Event needed here? Why this couldnât work with my first try (Without the sub-event) ? As I see it, Gdevelop needed the description object, to already exist in the scene in order for the description to change?
Just when I thought that I learned somehow how sub-events work I come face to face with this thing.
In case you donât understand my question I have the example here.
Just disable the correct action and enable the wrong one to see what I mean
I noticed a similar issue with external layouts. The objects that are added canât seem to be referenced in the same event. Itâs weird that it works in a subevent but it does.
For me, it was adding a tween right after the layout objects were added. Nothing happened when the actions were in the same event.
IDK if itâs a bug. When you add objects in the usual way, you can modify them immediately.
This is just my observation
And thx to what @Keith_1357 wrote i am more willing to believe this is the case
In same fashion as you canât set something to letâs say width of object which not yet exist
Or position of it if its not there already since there is nowhere to get information from
Same way something 1st need to be created from external layout then you can reference it
I would assume that sub event is taking extra frame or some time delay for object from parent event to be created
And then you can reference it in any way you want
But for now its case like
Hey sell me your keyboard for 5$ i just donât have money now i will pay you next week
Today i get keyboard you did not get money right now
So you did not sell me anything you gave me something and your wallet did not get any heavier from this action
So there is no information for how much you sold me your keyboard
And again that is just my assumption based on observation
Glad to see that at least Iâm not the only one with the problem I was trying to figure out what I was doing wrong and almost punched my screen.
I like the analogy with the keyboard, I just never thought that this could be the problem since I was with the Idea that Gdevelop does the actions from top to bottom in a âconsecutive?â order. Like it wonât proceed to the changed text action until the Layout is created first, not ignore it completely. I wonder if the action will happen properly if I add a wait 0.5 or 1 seconds action in the same event before the edit of the text.
If this is indeed the problem and Gdevelop canât reference objects from external layouts in the same event I wonder if there is a way to fix it. Maybe I should create a request cause I was honestly baffled when it happened. (I started using external layouts last week for pop up windows, menus etc and they make life so much easier)
This has also happened to me i.e. I canât do things with objects that have been created from an external layout in the same event that they are created.
For my dialogue system I use âCreate objects from external layoutâ at the beginning of the scene in its own event that I do nothing else with. In the next event down (another âat the beginning of the sceneâ event) I do things with those created objects, such as hiding them or changing their opacity.
I also went through a whole troubleshooting process over it and discovered the fix by accident. I did not know until your post that a sub-event can also work.
Just to be clear AGAIN observation not actually knowledge
1 - Action for loading is triggered
Imagine you have huge ass crap to load from external layout
So letâs lag your game?
Or let it load in background?
2 - in that exact event you are referring to object that DOES NOT EXIST you are creating that object from external layout
If you would create object in that event and then reference it you should be able to do it i mean change text but here you donât create object but bunch of them
You donât really know how long and in which order it takes to create them
3 - Another issue here is that you set text to something for ONE SINGLE FRAME in which this object donât exist yet
You could delay setting text or run it without trigger once which also should solve issue
4 - Imagine its not something with external layout but something with gdevelop
There is hide cursor action
So you can hide original mouse cursor if you create custom one for your game
And most logical way to use it is in event with at beginning of the scene condition
Sometimes it donât hide it
I discovered if i run this action without any condition it works perfectly fine
Then i discovered if i run WAIT action like 0.02 or 0.8 sec with at beginning of the scene it hides it perfectly fine ALWAYS
So i use compare 2 numbers conditon
And i check if TImeFromStart()+1 is less than TimeFromStart()
Action hide cursor
So for 1 sec since scene starts i am constantly hiding mouse cursor
It never failed me
5 - In few cases i use WAIT 0.02
itâs like nothing but somehow it does kick in some action which donât want to work
Some variables in extensions do not work
Yet they do if i add that wait action
In conclusion letâs face it
Our games make us slaves of time and only thing we can do is adapt to it