Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest WME version: WME 1.9.1 (January 1st, 2010) - download

Author Topic: Reset Game  (Read 5235 times)

0 Members and 1 Guest are viewing this topic.

TheDerman

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 225
    • View Profile
Reset Game
« on: March 26, 2005, 12:11:09 PM »

So I used Game.Reset() to hopefully be able to start a new game, but when I get to a certain scene I find lots of things are messed up, not working, and causing script errors. For example when I run the game first time it's fine, but then after reset, if I try and pickup a certain item, I get a script error, the item disappears from the scene but doesn't show up in the inventory.

I can't find anything wrong - I can't even find where some of the items would be effected and not others - they all seem to operate in the same way.

Maybe someone can quickly explain what Game.Reset() does and doesn't do so I can find the problem.

Also, isn't there simply a way that the engine could "reboot" the game instead of resetting all the variables and things? Like, QUIT the game but then immediately restart it seamlessly?

This way, it would be just like we were starting the game up for the first time, no?

Thanks.
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Reset Game
« Reply #1 on: March 26, 2005, 12:29:48 PM »

What errors are you getting? The only problem I can think of is that items destroyed by DeleteItem stay deleted even after Game.Reset(). Could that be the cause?
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

TheDerman

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 225
    • View Profile
Re: Reset Game
« Reply #2 on: March 26, 2005, 01:08:42 PM »

Yes, you are right - that's the problem - I delete several items after using them on each other - is that bad? How can they be restored after reset?

I also have a problem with some windows that popup and some speech that gets played depending on a variable value, I initially declare in game.script for some reason. This speech no longer works after reset, so I assume that's because of the variable, but I thought variables were reset to their initial values? Should I set its value in another script file?

So, no way to actually reboot the game?
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Reset Game
« Reply #3 on: March 26, 2005, 01:16:29 PM »

Yes, you are right - that's the problem - I delete several items after using them on each other - is that bad? How can they be restored after reset?
Well, currently the only way is to re-create them using CreateItem. But that's not very elegant. I could add a method for reloading the items definition file (or rather make this part of Game.Reset).

I also have a problem with some windows that popup and some speech that gets played depending on a variable value, I initially declare in game.script for some reason. This speech no longer works after reset, so I assume that's because of the variable, but I thought variables were reset to their initial values? Should I set its value in another script file?
The variables are reset to null. I recommend putting the initialization to the point where the game is actually started.

So, no way to actually reboot the game?
I guess you could start a second game by calling game.exe from within a script and then shut down the original game using Game.QuitGame()...
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

TheDerman

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 225
    • View Profile
Re: Reset Game
« Reply #4 on: March 26, 2005, 02:19:59 PM »

I guess you could start a second game by calling game.exe from within a script and then shut down the original game using Game.QuitGame()...

How do I call game.exe? Would this work nicely, or would it cause problems do you think?

Is there a way to add a "reboot" option to a new version of the engine? Or can it just not be done? It seems to me that if you could just literally restart the game, there wouldn't be any problems at all from the game.reset method. Why can't you just unload everything and then reload everything from the start as if you were starting the game the first time?

Obviously, I'm a novice programmer here.  ;D
Logged

TheDerman

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 225
    • View Profile
Re: Reset Game
« Reply #5 on: March 26, 2005, 05:55:57 PM »

Ok, so I think I solved all my problems with this.

I moved the variable which sorted that out, and I switched Delete.Item to Drop.Item which has sorted out my item script errors. Does Drop.Item remove the item from memory? Or does memory not come into this situation?

I managed to launch the game from inside itself and close the old game down, but, it didn't really work because the settings screen came up again (fullscreen), which messed it up - almost worked though.  :)

Thanks for the help.
Logged

TheDerman

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 225
    • View Profile
Re: Reset Game
« Reply #6 on: March 28, 2005, 10:17:41 AM »

Oh dear - I guess I wasn't paying attention to my game, because dropitem seems to put the item back into the scene.  :-[

So, I guess the best thing would be to add that reload item file method you mentioned - I think that would solve all the problems.

Thanks.

I'm getting there now, learning slowly.  :)
Logged
 

Page created in 0.282 seconds with 24 queries.