Stopping levels from running and changing levels

Posted By: Knuckles

Stopping levels from running and changing levels - 09/18/07 04:05

How do I switch between levels effectively? When I want to switch a level, I don't want the previous level to still be running and use up resources. So how do I stop one level from running so the other can run?
Posted By: Shadow969

Re: Stopping levels from running and changing levels - 09/19/07 12:23

previous level will be terminated automatically when you load a new one(level_load)
Posted By: Knuckles

Re: Stopping levels from running and changing levels - 09/19/07 12:52

Even the functions associated with the previous level?
Posted By: Shadow969

Re: Stopping levels from running and changing levels - 09/19/07 13:29

Quote:

The current level will terminated. The engine cache holding level entity files is purged. All current entities in the old level are removed, all entity pointers referring to them cannot be used any longer.
All actions assigned to or functions called by level entities - that means all functions in which the my pointer is not zero - are automatically terminated at their next wait instruction.
The game script itself will keep running and won't change, even if a different script was assigned by WED to the new level.
One frame cycle after this instruction the level is loaded, two frame cycles after the instruction the local entities in the new map are created and their actions are started. Wait two frame cycles (wait(2);) before modifying the level, for instance by creating entities.
When giving a HMP or MDL file name, the new level contains this terrain or model only. When using an empty string (""), an empty level will be loaded.
During the load process, the on_level event can be used to display a progress bar or animation on a panel.
One frame after level loading the last_error variable indicates loading errors.



From the almighty manual
Posted By: Knuckles

Re: Stopping levels from running and changing levels - 09/20/07 20:58

Alright, I do not know what is going on... When I try to change levels, the level loads, but the game freezes. It's zoomed in using the camera that's in the WMB file. Yet, when I call the level from the startup() function, everything works fine. The camera works and everything. I don't see what the difference is. It's not calling any other function but that one.

It is hard to explain what I mean, if this sounds confusing, so I would be more than happy to email the source code to someone who is willing to help me figure it out to show you what I mean. At this point, I am stumped at what the problem could be.
Posted By: Marwan

Re: Stopping levels from running and changing levels - 09/21/07 06:37

Ok , pm me
© 2024 lite-C Forums