Jump to content

reloading the map in game?


killbot5555678
 Share

Recommended Posts

hello today i thought to myself thinking about some of the motors i have in my game if you were to get in between the two spinning motors it will put them out of place sometimes causing the course to be impossible which got me thinking when you died from falling off the off place motors and got positioned at the start.... the map never actually reloads you just get re positioned which still makes the course impossible being that this can make a lvl impossible it makes a pretty annoying bug...... so what im saying is if you got in between two motor caused it to be out of place (not lining up with the next platform) it would be very difficult to get further so i ask is there any easy way to make the map refresh with a simple key binding or do i have to integrate my main script (which loads the lvl) into my player so when he dies it just reloads the entire thing? thank you very much for any feed back in advance (ps i haven't tried to fix this yet just wanted to hear some feed back on an easy and quick fix)

Link to comment
Share on other sites

In the scripts that are attached to the things that matter in the game, in the Start() function you could save off the position/rotation. Then make your own Reset() function that resets it's position/rotation and any other state you care about. Then you just need a way to callthis Reset() function on entities that have it defined. You could do this a various number of ways. I guess the easiest would be to just loop over every entity in the world and if it has a script attached and that script has a Reset function then call it. You could obviously reload the map if you like as well but that'll take longer for the player to wait depending on how large your maps are.

 

It would be kind of nice if this reset function method is something that could be in the engine itself. Call something like World:Reset() which would trigger a Reset() function for every script.

  • Upvote 1
Link to comment
Share on other sites

It would be kind of nice if this reset function method is something that could be in the engine itself. Call something like World:Reset() which would trigger a Reset() function for every script.

 

I can make this happen in LEX easily. Thanks for the idea.

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

  • 3 weeks later...

If easy is what you want then just reload the map by setting the changemapname variable to the map name you want to reload anywhere in your code.

 

thank you for your feedback and einlander also thank you for yours both ideas are helpful im trying to make it so when the player dies the map refreshes upon his death

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...