New Game

This forum is meant for requesting technical support or reporting bugs.

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

New Game

Postby GORDON » Fri Jun 01, 2012 3:53 pm

When a player starts playing your game, hotspots/variables etc. change. The player decides to go back to the menu and without quitting and going to Windows starts another new game. How do you reset all the variables/hotspot/inventory etc. information. Can you script all these changes back or might it be better to inform the player if he wants to start a "New Game" again, he must restart the program from Windows. Also, if the player had saved a few times during his first "new game" these saves are still there during his second "new game" play or could they be deleted somehow when he starts a second time?
GORDON
Advanced Member
 
Posts: 154
Joined: Mon Apr 30, 2007 1:36 am
Location: Canada

Postby Vairon » Fri Jun 01, 2012 4:43 pm

The best way is to create a procedure where all necessary variables are initialized and call every time you start a new game or when you need.

sub Procedure Initialize
Variable1 = 0
Variable2 = 0
...
end sub

Instead Variable1, Variable2 ... put variables that interest you. And when you start a new game call the Initialize procedure.

This procedure must be in VBS procedures in the main menu of the project.
User avatar
Vairon
Forum Master
 
Posts: 500
Joined: Sat Jul 14, 2007 12:40 pm
Location: Spain

Postby lbq_bcn » Fri Jun 01, 2012 7:44 pm

Hello Gordon

If you have the classic start menu (not modified by a menu frame type) Every time you start a new game, all variables, hotspots, etc, alone start at 0. You need not implement any code to initialize.
Another topic are the saved games. No I think that can be implemented by code to delete anything, because each user can put the name you want and save them in the directory you want. The only thing that would solve the problem, save your game in files "ini" and recover these items by code. But I find it difficult ...
More info here:
http://www.adventuremaker.com/phpBB2/viewtopic.php?t=3741

Regards.
Llu
User avatar
lbq_bcn
Member
 
Posts: 34
Joined: Tue May 15, 2012 10:50 pm
Location: Spain

Postby GORDON » Fri Jun 01, 2012 8:40 pm

Since this will not happen too often and being quite poor at scripting code, I think I'll put a message on the screen asking the player to quit and restart the game if they try to open a "new game" again without quitting to Windows first. Thanks for your advice! It is appreciated.
GORDON
Advanced Member
 
Posts: 154
Joined: Mon Apr 30, 2007 1:36 am
Location: Canada

Postby Vairon » Fri Jun 01, 2012 9:37 pm

When you press the "New Game" button in main menu, obviously if this is the first time you play all the variables are 0.
But if you are playing and return to the menu(without quitting and going to Windows) and press "New Game", the value of the variables have changed.
So you have to reset these variables. And the only way is through code.

About saved games, I agree with Llu?s. Is difficult but possible.
User avatar
Vairon
Forum Master
 
Posts: 500
Joined: Sat Jul 14, 2007 12:40 pm
Location: Spain

Postby GORDON » Fri Jun 01, 2012 10:01 pm

It seems like so many things have to be reset such as;
1. variables
2. remove inventory items
3 videos that only to play once are now gone
4. frame that gives you a magnifying glass one time only will not reload
5. hotspots used only one time
I've probably missed some others
Btw. Can one line of code reset all variables or do you need to reset each separate variable to "0"
GORDON
Advanced Member
 
Posts: 154
Joined: Mon Apr 30, 2007 1:36 am
Location: Canada

Postby reneuend » Sat Jun 02, 2012 12:26 am

GORDON wrote:It seems like so many things have to be reset such as;
1. variables
2. remove inventory items
3 videos that only to play once are now gone
4. frame that gives you a magnifying glass one time only will not reload
5. hotspots used only one time
I've probably missed some others
Btw. Can one line of code reset all variables or do you need to reset each separate variable to "0"


Correct me if I'm wrong, but if you use Action.Quit doesn't that reset everything? And if you set it up with your own menu, it will quit to your menu and NOT to the desktop. I will test this.

Otherwise,

For hotspots that were hidden and removed permanently use this AM command:
Code: Select all
Action.ResetRemovedHotspots


For inventory items use this AM command:
Code: Select all
Action.RemoveAllItems


To reset integer variables to 0 all at once use the following:
Code: Select all
ghost_count = num_players = num_keys = 0


To reset variant variables to "" at once use the following:
Code: Select all
myName = yourName = petName = ""
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2762
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Postby GORDON » Sat Jun 02, 2012 10:52 pm

Is there a way of going to your first screen with Action.Quit so that clicking on the users second "new game" activates Action.Quit to start your game instead of going to Windows therefore refreshing everything? How would the code look?
GORDON
Advanced Member
 
Posts: 154
Joined: Mon Apr 30, 2007 1:36 am
Location: Canada

Postby reneuend » Sun Jun 03, 2012 6:37 am

I should have looked at the Action.Quit command in the first place. It says in the AM Functions document: "Quits to the Main Menu (or to the desktop, if the "bypass the Initial Screen" is checked).

So, if you have a custom start up screen, you have to take care of the resetting yourself.

If I might add, the load/save plugin I built handles this issue for you. When the user quits to the menu, they click on "New Game" to start a new game. I created a function that resets everything, so you only need to type in "AM_ResetGame" in the advanced tab for the "New Game button" hotspot. you can find it here: http://www.adventuremaker.com/phpBB2/viewtopic.php?t=5912 :wink:

Image
Last edited by reneuend on Sun Jun 03, 2012 6:42 am, edited 1 time in total.
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2762
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Postby reneuend » Sun Jun 03, 2012 6:41 am

GORDON wrote:Is there a way of going to your first screen with Action.Quit so that clicking on the users second "new game" activates Action.Quit to start your game instead of going to Windows therefore refreshing everything? How would the code look?


Sorry Gordon. Could you restate that more clearly?
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2762
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA

Postby GORDON » Sun Jun 03, 2012 9:23 pm

Since I didn't run my game using your menu, which would have worked better, I need the player after exiting the game to click on my "New Game" button and have a complete reset. I know Action.Quit will do that, but you are then back at Windows.
GORDON
Advanced Member
 
Posts: 154
Joined: Mon Apr 30, 2007 1:36 am
Location: Canada

Postby reneuend » Sun Jun 03, 2012 10:06 pm

There are only 2 ways to fix this issue.

1. Use the AM menu and don't bypass it. Then the action.quit will go to the menu

2. Use the AM functions I showed upon starting a new game. Use ShadowHunter's KeyGuard and define your own quit key(s) that would go to the menu instead of exiting to windows desktop.
---


Image
Image
User avatar
reneuend
Administrator
 
Posts: 2762
Joined: Sat Nov 22, 2008 8:37 pm
Location: Midwest Cornfield, USA


Return to Adventure Maker Technical Support and Bug Reports

Who is online

Users browsing this forum: No registered users and 0 guests