Save changed skin of an entity?

Posted By: HellThunder

Save changed skin of an entity? - 09/27/13 16:46

Hi there!

I got a small problem with my Map Editor.
It has the ability to create Tiles as "*.wmb" with

Code:
ent_create("Tile.wmb",a Vector,null);



After that the user can change the skin of the tile Object with

Code:
ent_setskin(TileEntity,Texture,1);



So far, so good.
This is the result of the ingame mapeditor.



After using "wwmp2wmb.exe" in order to save my map, I reload my map and all changed skins got lost.



Perhaps the ent_setskin function isn't the right way to my solution - I really don't know. I didn't found anything in the manual about this problem.

Is there any way to save the changed skin?
Or is there a way to place WMP file Format into a Map via Lite C?

Thanks in advance.
Marco
Posted By: sivan

Re: Save changed skin of an entity? - 09/27/13 17:04

I think it is because of wmb format. but don't know why it worked before compilation... because as I know, all entities within a level created of the same wmb map entity, or model, share their textures by default. you can use ent_clone to make each created entity unique after ent_create, but it makes slower the rendering, and increases nexus very much. imo it is more desirable to use different models or wmb map entities for each different tiles.
Posted By: Ch40zzC0d3r

Re: Save changed skin of an entity? - 09/27/13 18:09

Well, if you load the wmb as entity and change the skin, how would the compiler know that you changed the skin? It simply recompiles the wmb file..
So make the tiles better a model, use the mdl SDK and export it as mdl file wink
Posted By: HellThunder

Re: Save changed skin of an entity? - 09/28/13 17:40

Thanks for the answers!

I thought about the SDK solution - but the engine didn't load the included dll. Perhaps I don't know how to handle with plugins or it's the fact, that I use the LiteC Free Version. I really don't know. I have also read the manual about SDK.

After that I tried the ent_clone function. Ent_Clone function works with SED but if I use the C# Wrapper the engine throws an error 'E2005 - Can't create DirectX texture mtl_shaded.' Did I forget to implement some shaders?

Indeed the easiest solution would be to create an own wmb file for every tile . But I think this solution isn't felxible enough for the user. It would take a lot of time to create them.

I will go on and try to solve the problem with ent_clone.

Nevertheless, I would appreciate further help. =)
Regards Marco.
Posted By: HellThunder

Re: Save changed skin of an entity? - 10/04/13 23:27

I solved the problem. It's a very simple solution.
With ent_next I'm able to iterate through the list of entities.
I'm using XML-Serialization to save all textures (a list of strings) into a file - 'mapname.tex'.
After saving/closing the map, every texture will be saved into 'mapname.tex'.
By reloading the 'mapname.wmb', the application will search the '*.tex' file of the map in order to reload every single texture with an ent_next loop.
Posted By: sivan

Re: Save changed skin of an entity? - 10/05/13 15:07

ahh, I could give you this hint before, I use it too for some special settings when compiling a level from MapBuilder, but I use the 1st 20 skills for numeric, and the 2 entity strings for character based information (like its decal shadow name when applied)... anyway, good to hear you solved it laugh
© 2024 lite-C Forums