Force reload of an entity?

Posted By: Superku

Force reload of an entity? - 03/13/19 12:42

Hello!
I am working on a level editor for my game to be used by players.
I create some MDLs at runtime in that editor and save them to disk. It is necessary to change that MDL, re-save it and ent_create it again. External modifications on the MDL might happen as well.

The problem is that on further ent_create calls only the first version of the MDL will be loaded, most likely as the MDL is in the entity cache still. ent_purge does not seem to remove it from the cache, only level_load does, right? Reloading/ clearing the level is not an option for me though.
add_buffer(name, NULL, 0) does not seem to have an effect on those entity/ engine buffers.

Is there any way to force a reload for a filename?

The only workaround I can think of right now is setting meshes manually.
Posted By: Emre

Re: Force reload of an entity? - 03/13/19 14:02

How about ent_reload? Does that help?
Posted By: Superku

Re: Force reload of an entity? - 03/13/19 14:34

Lol... that's exactly what I've needed, thank you. Never seen that function before.
I had searched the manual (ent_create and ent_purge pages, related items, offline and online) and even used the index search to search for the term "reload" but skipped looking at all the results because you get WED and other misc pages first.
Thank you.
Posted By: Emre

Re: Force reload of an entity? - 03/13/19 19:26

Glad to help. To be honest, i didn't know there was such a function either, until few months ago. laugh
© 2024 lite-C Forums