cowlol Posted February 1, 2014 Share Posted February 1, 2014 Hey guys, So Piller helped me making a script to load a new map when entering an object in game, with collision type ''trigger''. In App.lua you can see some changes in the App.lua script, and if you go to assets > scripts > objects > triggers > LoadLevel.lua you see the second part in order to load new maps. Now as far as I know I have done exactly what Piller's video described to me what I should do but I get this error when entering the trigger object: Program: ...ents\Leadwerks\Projects\buildandshoot\buildandshoot.debug.exe File: c:\program files (x86)\microsoft visual studio 12.0\vc\include\vector Line: 1442 Expression: vector erase iterator outside range For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts. (Press Retry to debug the application) Here is Piller's video: http://www.youtube.com/watch?v=FBFNbZxoAC8 Is there anything wrong in my part of the scripts, or is there something wrong with my pc settings? The project file can be downloaded here too. If you load the project on start.map you will see a wooden block in front of the place where you spaw: this is the trigger to go to lol.map. In lol.map there is also a wooden block functioning as trigger. You can change to which map the object refers, by selecting the object, going to scene and then object scripts, and there you should be able to change it. Hopefully you guys can solve my issues! Quote Link to comment Share on other sites More sharing options...
Rick Posted February 1, 2014 Share Posted February 1, 2014 Looking at your code from steam. Inside ShouldSwitchLevel() you have Map.Load() instead of Map:Load(). It's different because Map: passes a variable as the first parameter behind the scenes for you, while Map. does not, when calling functions. Quote Link to comment Share on other sites More sharing options...
cowlol Posted February 1, 2014 Author Share Posted February 1, 2014 Here are the scripts. I didn't notice that the maximum uploadable file can be 0.5 MB so the full project isn't uploaded here either. App.lua LoadLevel.lua Quote Link to comment Share on other sites More sharing options...
Rick Posted February 1, 2014 Share Posted February 1, 2014 Sorry, I updated my last post with what is probably wrong. I looked at your code on Steam. Quote Link to comment Share on other sites More sharing options...
cowlol Posted February 1, 2014 Author Share Posted February 1, 2014 Sorry, I updated my last post with what is probably wrong. I looked at your code on Steam. Sorry, I updated my last post with what is probably wrong. I looked at your code on Steam. Changed it to Map:Load(self.mapFile) and I still get the same error :S LoadLevel.lua App.lua Quote Link to comment Share on other sites More sharing options...
Rick Posted February 1, 2014 Share Posted February 1, 2014 So you attached LoadLevel.lua to a csg that is of type Trigger? Then you filled out the Map parameter with a valid path/file to a map? What value did you give the Map parameter of the csg trigger you have LoadLevel.lua attached to Quote Link to comment Share on other sites More sharing options...
cowlol Posted February 1, 2014 Author Share Posted February 1, 2014 Everything what I have in those .lua files are exactly what I use in game. I attatch LoadLevel to an object which is set as trigger at collision type. Then at the script tab at Map I have got lol.map selected. Quote Link to comment Share on other sites More sharing options...
Rick Posted February 1, 2014 Share Posted February 1, 2014 And that map exists in your maps folder for the current project you are in? Can you load that map in the editor and it doesn't give and error itself? Quote Link to comment Share on other sites More sharing options...
cowlol Posted February 1, 2014 Author Share Posted February 1, 2014 And that map exists in your maps folder for the current project you are in? Can you load that map in the editor and it doesn't give and error itself? lol.map exists in C:\Users\********\Documents\Leadwerks\Projects\buildandshoot\Maps so it is in the right folder yes. In the editor itself it does not give an error, no. I can also launch both maps perfectly fine, but as soon as I step into the trigger on start.map it gives the error. When I step into the trigger on lol.map my screen starts shaking and it gives a diffrent error: failed to read file ''C:\Users\********\Documents\Leadwerks\Projects\buildandshoot'' Quote Link to comment Share on other sites More sharing options...
Rick Posted February 1, 2014 Share Posted February 1, 2014 This is a tough one. I just took the 2 scripts you posted and made a test scene and it worked just fine. If your map has just the default stuff (models/textures that come with LE) then can you attach both maps and I can test it. Quote Link to comment Share on other sites More sharing options...
cowlol Posted February 1, 2014 Author Share Posted February 1, 2014 with 2 new clean maps (i imported all the scripts from other project though) it just gives this error: failed to read file ''C:\Users\********\Documents\Leadwerks\Projects\buildandshoot'' so it doesn't work on that either :/ I do use the assets > models > characters > generic.mdl as first person controller. Next to that I have also implemented your teleportation script. the teleport blocks are at physics > collision type = trigger so that should be allright as well. I'm gonna take a nap now, I've been awake way too long today already I'll check the forums and all when I wake up again. Thanks for your help! Quote Link to comment Share on other sites More sharing options...
Rick Posted February 1, 2014 Share Posted February 1, 2014 Attach your maps so I can test them please. Quote Link to comment Share on other sites More sharing options...
cowlol Posted February 1, 2014 Author Share Posted February 1, 2014 ok. Btw, I do use leadwerks in Beta stage ( so i get all the updates early). I added maps to this message. Those are the ones without files from outside leadwerks (2 basic testmaps). (change .lua to .map, i can't upload .map since im not permitted) the other (primairy) maps, on which I at first created the scripts were too big to upload here. but I'm gonna sleep now, see you in perhaps about 8 hours. And once again, thx for your help lol.lua start.lua Quote Link to comment Share on other sites More sharing options...
Rick Posted February 1, 2014 Share Posted February 1, 2014 Those work for me so not really sure what the deal could be. Take the entire project folder and zip it up and make a post in the Bugs forum and attach it for Josh to see what's up. Quote Link to comment Share on other sites More sharing options...
cowlol Posted February 2, 2014 Author Share Posted February 2, 2014 Okay, i'll do that. But if we go back to the very first error I've had, what does that mean in general? Can it be that there is something wrong with my computer settings? Quote Link to comment Share on other sites More sharing options...
cowlol Posted February 2, 2014 Author Share Posted February 2, 2014 Those work for me so not really sure what the deal could be. Take the entire project folder and zip it up and make a post in the Bugs forum and attach it for Josh to see what's up. one small problem though: the project is 500mb. I can upload a maximum of 0.5 kb to those forums. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted February 2, 2014 Share Posted February 2, 2014 Have you tried it with 2 simple scenes? 1 Quote Link to comment Share on other sites More sharing options...
DanceTweety Posted February 24, 2014 Share Posted February 24, 2014 I have same soon as I step in to collision box I crash. Quote 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.