killbot5555678 Posted January 15, 2017 Share Posted January 15, 2017 Hello i was working on my game and ran into something i desired i wanted the ability to reload the map i was on (their are many maps!) i found a couple times i got stuck and couldn't fix the problem so my only option was to end game and restart (which mean't i had to start from lvl 1) which was really annoying so what im looking to do is key bind a key like R for instance so when it is pressed it will only reload that map that my player is on along side with everything in it (motors,pivots) it doesn't have to be complex or anything just wanted a simple way to reload one specific map that the player was on thanks (PS): Not overly savvy with this so please explain well i wish to learn how key binding works cause clearly i haven't figured it out lol along side output calling XD Quote Link to comment Share on other sites More sharing options...
Genebris Posted January 15, 2017 Share Posted January 15, 2017 Remember last map you loaded into a variable or have a script on the map that tells you which one it is then this into UpdateWorld: if window:KeyHit(Key.R) then World:GetCurrent():Clear() Map:Load("maps/"..self.map..".map") end Quote Link to comment Share on other sites More sharing options...
killbot5555678 Posted July 27, 2017 Author Share Posted July 27, 2017 On 1/15/2017 at 5:25 AM, Genebris said: Remember last map you loaded into a variable or have a script on the map that tells you which one it is then this into UpdateWorld: if window:KeyHit(Key.R) then World:GetCurrent():Clear() Map:Load("maps/"..self.map..".map") end how would i express which map the player is on so he may reload it (post is a little old sorry) Quote Link to comment Share on other sites More sharing options...
Genebris Posted July 27, 2017 Share Posted July 27, 2017 Write name in a variable when you load it. Quote Link to comment Share on other sites More sharing options...
killbot5555678 Posted July 31, 2017 Author Share Posted July 31, 2017 im not even completely sure where i should be placing said variable any chance you could show an example of this? id like to build on the idea itself so id like a throe understanding if its no bother what ive gotten so far is how to bind a key so that that key will load that specific map Quote Link to comment Share on other sites More sharing options...
Genebris Posted July 31, 2017 Share Posted July 31, 2017 First time map is loaded in main.lua, do it there. currentMap = "Maps/start.map" Map:Load(currentMap) 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.