Change script of a node at runtime.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By EnrikeChurin

I was wondering if I could create a game with support of coding. For example having a game about launching rockets and having a way for player to code some functionality. Can I change script of a node at runtime? How?
And if it’s possible, how can I create api for coding behavior? I could allow players to script in plain gdscript, but it will require engine knowledge and if used incorrectly could let to players accessing other code of the game. Maybe I can create methods that player can access, but can’t built-in.

Hopefully this might help? Reddit - Dive into anything

TheJokingJack | 2021-07-11 16:52

Thanks, that should be it! If all said there is true, I could implement it.

EnrikeChurin | 2021-07-11 16:59

maybe this could also help
Expression — Godot Engine (4.x) Dokumentation auf Deutsch

klaas | 2021-07-11 17:13

:bust_in_silhouette: Reply From: DavidPeterWorks

Version 3.3.3
Use method:

It replaces existing script on any nodes.