Script with mapeditor


I understand mapeditor is not made to handle script language but if you put a objet that have to execute a script (in the real game).
What is the best solution you founded to add a script to an object ?

A nice solution could be to be able to add a longtext (textarea) as custom properties !
Of course if you can set a type of language to have a syntax coloration, it would be wonderfull !

I’m using Lua for scripting dialogue and cutscenes in my game.

Originally I was using a custom property that had a string in it for the script. Obviously, writing scripts in this way isn’t a great experience, so what I ended up doing was simply using a file custom property and then the game engine loads up that file and executes it.

I don’t think it would work too well as a built-in feature since everyone’s use case for Tiled is different.

So you add a property called function (for example)
and you have a file with all the functions of a level !
That’s the solution I’m using but, there is at least 2 problems:

  • you have 2 files for one level
  • and this is less easy to let another person to make a level !

But, I’ll continue like this !

You’re usine Solar2D ou Love2D or something like this ?

I’m using a custom engine that I created that has Lua embedded.

Personally, I don’t think having the scripts being separate files is too big of a problem, especially if the game engine you use packs all the resources anyway.

This is already supported. If you click the “…” edit button on a custom string property, it’ll open a multi-line text editor.


Ah yes :+1:

I haven’t seen the “…”