wildcherrii Posted April 15, 2022 Share Posted April 15, 2022 In my code, I'm trying to go from one map to another map ( zones ). I have it setup as so : local mapfile = System:GetProperty("map","Maps/"..fname ..".map") if Map:Load(mapfile)==false then emsg("error, no map file") ; return end Where fname is a variable passed to my MapLoad function. No matter what I try I continue to load the same map over and over. It always seems to be the same map thats loaded in the editor. My question is, is it possible to change maps from code once you start an initial map in the editor. My project loads map1.map then if I hit f12 in code it should load map2.map, but it keeps loading back to map1.map. Debugmode is of little use, all I get is the screen closes down, no way to even see where this error is occuring. Some where in the Map:Load() the entire process bottoms out, I get no errors, I get no warnings, just a closed window. This happens in debug and normal mode. Thats pretty much impossible to to try and fix not even know where to look at. The bottom of the editor screen I see this : Debug process connected. Error: Unknown client disconnected. Please some adivce on this, its got me worried. Quote Link to comment Share on other sites More sharing options...
wildcherrii Posted April 15, 2022 Author Share Posted April 15, 2022 It seems creating or instacing or copying a prefabbed emitter inside a Start() script of an entity causes everything to shut the hell down on loading a new map up. self.dust = tolua.cast(emitcache.dust:Instance(),"Emitter") If I comment this line out the map change goes through. I guess Im just not suppose to have particles in my project. 2 months solid trying different routes to get them 100% working and always a failure. Quote Link to comment Share on other sites More sharing options...
reepblue Posted April 17, 2022 Share Posted April 17, 2022 System:GetProperty() is a fetch function to obtain a command parameter that's passed through when the application starts. The editor launches with your app +map "Maps/<path_to_map>" every time you press the play button. You only want to use System:GetProperty() on the first load. With traditional loading (ie: Clear the map and load a new map), you would clear the world with a loop for safe results. Don't take this presto code for granted as my Lua coding is rusty. local currentmap -- Call me in the app loop function WorldLoop() if newmapname ~- nil then Time:Pause() world:Clear() Map:Load("Maps/"..newmapname..".map") Time:Resume() newmapname = nil end end function ChangeLevel(mapname) newmapname = mapname end -- Example function function ChangeToLevel2() local lvl2 = level2map ChangeLevel(lvl2) end For your streaming chances, you're better off loading sections as prefabs. Prefabs are derived from the entity class so you should be able to use the Show and Hide Commands. I haven't touched this but you don't call Map:Load() again. You would think it would just dump all the data in the world but it seems to mess up the buffer and everything will pop up as brighter. On 4/14/2022 at 11:34 PM, wildcherrii said: It seems creating or instacing or copying a prefabbed emitter inside a Start() script of an entity causes everything to shut the hell down on loading a new map up. self.dust = tolua.cast(emitcache.dust:Instance(),"Emitter") If I comment this line out the map change goes through. I guess Im just not suppose to have particles in my project. 2 months solid trying different routes to get them 100% working and always a failure. Can't be sure without looking at the rest of your code but you would create the "main" particle in the start function and then create the instance when you need it at an event. It could be possible that your emit cache class is getting loaded after your script making that call. Hope this helps. Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.