Import and export of external events

Hello, a request that may be useful, at least in my view!

Have the possibility to be able to import / export external events. With that, we could have several templates for gdevelop, where the user can just import certain events to his project.

A cool example is an external event that I have here about character evolution, in this event they contain several calculations, and many command lines to make an RPG. If I could export this event and then import it into my other projects, everything would be simpler and faster than rewriting the code.

However, if you currently want to use this external event, what you can do is copy it, close GDevelop, open the project you are working on and paste.

Template

Destination project

This is very useful, but it would be much better if we could export and import whichever and as many events we want at the same time.

As you can see, in the first image, I have a complete example of the Finite State Machine that I’ve been working on for a while, as well as several Japanese Castlevania-style RPG mechanics. Whenever I modify something that I would like my game to have, like code improvements and new techniques, I update my template, and do all the copy and paste procedure for other projects that use the same mechanics, but this takes a while. But if I had a way to be able to import everything to the other projects, it would be much faster and simpler.

Have you tried the “Extract events to a function” option when right-clicking on an event or group? If you group your external events, you can use that, then extract it to a function, then export that/import it in whatever projects you want.

In that case you are required to use it on an object, and when is it not? For example, if the function is something from the scene?

As in the case above, I make the function, and I need to put it in an object, as I would when that function depends on other events?

As in the case of a FSM that are separated by several events?

I’m not sure I understand your questions fully, but trying to parse them out:

Functions do not have any restrictions to being for objects or other logic. They’re basically event sheets on their own, and are how most extensions are made.

If you want it to refer to an object, you just add the Parameter of “Object” and can target it as “Object” in any events you had before that was directly calling an object by name.

Although, in the case of FSM, you’re likely better off converting it to a Behavior.

However, for this specific point: If you’re using events for an FSM for a player, and copy it and paste it into another project, you’ve very likely broken your entire FSM. Object names are references not strings, so pasting it in another project may not show an error, but very likely it is no longer referencing objects in your new project and won’t behave as you’d expect. (This is likely why there isn’t an export/import for external events currently).

It breaks if you don’t have the specified group in the other project!
However, when we work with a certain standardization in several games, it is easy to import.

Think of a library written in C++. You know that all the procedures and functions are there. In this case just call through an import.

In the request I made, this would work in almost the same way. You would create several functions in external events that could be used in several games, when exporting this event in question. But with a slight change. When importing this event with all the functions and codes, something might be lost if some kind of group or object was missing. But this could be fixed in the export, like exporting also the references of groups (not objects).

But this should have a warning on export like: “When exporting this event, all groups will be recreated later”

Therefore, only objects will not be. (That’s talking about something like FSM.)

Creating a function in gdevelop is for me a more advanced thing that not all users use. This import and export option would also be.