Page 1 of 1
Is it possible to change the prototype of an entity during a game?
Posted: Fri Jul 31, 2020 2:39 pm
by Philuminati
Hello,
I try to make a mod that makes trains look different depending on their fuel. My question now is: How do I change the properties of e.g. the front lights of a locomotive in a script in a running game?
Thanks in advance,
Phil
Re: Is it possible to change the prototype of an entity during a game?
Posted: Fri Jul 31, 2020 4:51 pm
by Pi-C
Hi!
Philuminati wrote: Fri Jul 31, 2020 2:39 pm
I try to make a mod that makes trains look different depending on their fuel. My question now is: How do I change the properties of e.g. the front lights of a locomotive in a script in a running game?
You should probably make a copy of the locomotive during the data stage and then swap the entities (create clone of the first entity, then destroy the original) during control. Don't forget to raise an event in that case, so other mods have a chance to update their tables!
By the way, that's how these things are usually done. I don't know if it will also work with trains -- could well be that problems would occur if the train was moving.