Fangames > Programming Questions

Back to hub key?

<< < (2/3) > >>

Hop:
Thanks for the replies!

ElectricZz I got the main function of being able to warp back to the room after you've been there working properly however the only way I was able to achieve this was by removing the lines of codes your guide says to put into scrLoadGame and scrSaveGame. I'm assuming that those two keep it so you can warp back after you reload your game. When I add those two lines of code It works fine till I press 'R' or try and reload and it will say "Save Invalid". Then it boots me back to the main title. Starting a new game works fine though. Is there a specific area in the script I need to place it?

Kyir:
I misread your problem. Not entirely sure what's wrong, but if it functions fine when you start a new game file is there really an issue?

Hop:
Yeah because if you reset or reload the game boots you back to main menu and won't let you load it again and if I don't have the code in the saves you lose the ability to warp back to the hub when you reload.

Kyir:
Okay, I see what you mean. Assuming you're using the YoYo Engine, I'd recommend just making use of the built-in secret array if custom code isn't working.

Make an object in the hub room with the create code:
global.saveSecretItem[1] = true;
Then check if that's true before executing the code you're using to bring the player back. Something like:
// Event for whatever key you want pressed
if global.saveSecretItem[1] = true {
player.room = [whatever the hub room's name is];}
Assuming I'm reading the code in the engine right, this is already built into it. The only thing is that the player will need to save once after entering the hub for that variable to save.

Hop:
Ok so now its working and remembers the variable upon reset. However for whatever reason when I press "w" to warp back it warps me to the position I am currently in rather than where the start player object is resulting in being stuck in walls and such.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version