Include events in the scene only if needed

Hello everybody!

I’m creating a card game with effects triggered by the cards (dealing damage, giving shield, stunning the target, etc…)
The fact is that I’m planning to have a lot (probably too much) of cards. Therefore a lot of effects.
So my question is: Is it possible, in the code, to call only the effects that I need? In the loading phase, the compilation, or something.

I know I can separate the events thanks to the external events system, but would it be a way to just load the scene with the events linked to the cards that the player has and nothing more? (loading 10 effects instead of 250, for example)
Is the external events system actually putting the code in no matter what, or can I put a condition for it to not include the code in the compilation?
Like → if the player has the card “healing” in the deck, include events from “healing card”. If not, the “healing card” events are not included at all in the scene for this time.

And if all of that is not possible, what would be the best way to save time/memory while the game is running? (and no, “having less cards” is not an answer I will accept XD)

Thank you very much in advance and have a lovely day! :smiley:

As you expected it is not possible. And there is also i dont think a way to not include an event. Gdevelop has to load all the events you put in to make the game work completely. And i dont think it affects the games performance. You just need good internet. Not including an event would basically mean it not existing.

Well, as long as it’s not affecting the game performances, I’m ok with that.
Thank you very much for your answer! :smiley:

your welcome and a very good day or night to you​:+1::+1::+1:

My understanding is that the code is always included in the compilation (code has to exist somewhere to be called) but in your main event sheet you have conditions for the external event, the external event sheet will only load into the runtime when the condition is true.

There should be no performance impact for an external event sheet that is not currently in use by the current logic in the runtime of the game.

That’s good to know. I’ll make different tests and see how it goes, I guess.
Thank you very much for your answer :smiley: