level_load /level_ent

Posted By: xbox

level_load /level_ent - 02/04/20 19:34

Sooo… it's been a while. I decided to get back into game studio to work on ideas I've had for years now, and i'm not sure what I'm missing.

I have several small rooms made in WED, and loading them as levels in SED, easy enough. In SED, i'm loading the map sub entities and assigning them functions, again, easy enough. Now when I come in contact with one of those entities, I want to change the level to either a new level, or restart the current one, however when the new level loads, the map sub entities no longer have functions attached to them. Also, I want to save positional data from them such as pan, tilt, roll, so when the new level is created, the information is copied over, but don't the variables reset when the new level is loaded?
Posted By: 3run

Re: level_load /level_ent - 02/04/20 19:39

Hey man! Glad to see you are back.

If you keep those variables global, they will survive the level loading (as far as I know) and what do you mean by 'sub entities'?

Best regards!
Posted By: xbox

Re: level_load /level_ent - 02/04/20 19:49

Heyy it's good to see you too!

I didn't even think about that actually, I'll have to give it a try. So I have a room with a door, and the door is a map entity which is built as part of the room level (that way it's already loaded in position when the level loads) so when the level loads, I'm doing a for loop to load all of the map sub entities and assigning them functions. But for some reason it's only working on the initial level load.

Code
for(you = ent_next(NULL); you; you = ent_next(you)) {

		doors[count] = ent_create("door.wmb", vector(you.x, you.y, you.z), door);
		count++;
   	set(you, INVISIBLE); // make entity invisible
  	}
Posted By: 3run

Re: level_load /level_ent - 02/04/20 19:53

Why not use models instead of sublevels? I guess it would be much easier to use them (f.e. you could place them all in WED and on level load, depending on some variables you could either delete or keep placed models). What exactly you want to do? Maybe I could help you with coding part.

Edit: please check your private messages

Greets
© 2024 lite-C Forums