Select mission (Save each mission as player progresses)
by Jesse P · in Torque Game Engine · 09/24/2008 (10:02 pm) · 10 replies
Hello, here is what I would like to do:
Have the player open the game for the first time, and be able to select ONLY mission 1.
After player beats mission 1, it saves where the player is at and then next time the player opens the game, or if the player quits to the main menu, the player sees mission 1 and 2 as an option and can load either one.
Any suggestions on how to go about this? Thanks
Have the player open the game for the first time, and be able to select ONLY mission 1.
After player beats mission 1, it saves where the player is at and then next time the player opens the game, or if the player quits to the main menu, the player sees mission 1 and 2 as an option and can load either one.
Any suggestions on how to go about this? Thanks
#2
I know where to put a "set status" code but not sure what I would put.
09/25/2008 (7:41 am)
How would I go about setting the status on the completion of each mission?I know where to put a "set status" code but not sure what I would put.
#3
10/09/2008 (9:05 pm)
Still having issues, how would I go about doing this?
#4
maybe writeline() or something? ahh, i'll check on this tomarrow when i got my book handy :P
anyways, what i would do is script a function that writes some lines to a file like this (roughly) :
function writeprogress(%progress)
{
%file= new scriptFile(PATH/FILENAME.cs);
%file.writeLine("$missionProgress="@%progress@";");
}
then just execute this file in your startup script (prolly game.cs)
still not sure of the correct syntax. I'll try to check on it tomarrow and update this.
10/11/2008 (1:55 am)
Looks like your gonna need to look into tge's write functions and create a script file. i've done this before but off hand i cant recall what the exact syntax was. if you dont have 'game programmers guide to torque' then you need it! maybe writeline() or something? ahh, i'll check on this tomarrow when i got my book handy :P
anyways, what i would do is script a function that writes some lines to a file like this (roughly) :
function writeprogress(%progress)
{
%file= new scriptFile(PATH/FILENAME.cs);
%file.writeLine("$missionProgress="@%progress@";");
}
then just execute this file in your startup script (prolly game.cs)
still not sure of the correct syntax. I'll try to check on it tomarrow and update this.
#5
12/22/2008 (10:49 pm)
Bump for updates, still need some help on this from anyone who wants to assist, this is the last thing holding up my project
#6
12/22/2008 (11:18 pm)
Wow, I just figured out a real simple way to save and load progressive missions using this. All I did was cheat by having the original missions 2+ renamed .foo and only the first level .mis, then inside the .mis files for levels 2+ I added the line MissionGroup.save("starter.fps/data/missions/level2.mis"); to save a copy of the mission with .mis in addition to the .foo, that way the gui at startup will only see .mis files and will look like it has saved the players missions as he/she progresses. Too cool, this has only taken me two years to figure out and was darn simple!
#7
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=1955
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=4213
Anyone want to help on this?
12/22/2008 (11:52 pm)
Now I need to figure out a good way to save the player's inventory at the beginning of each level. And to load it when the level is reloaded. I have already implemented the following two resources that I am utilizing for inventory:http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=1955
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=4213
Anyone want to help on this?
#8
an example inventory.txt file:
Weapon : Sniper Rifle
Ammo : 20
and just have torque replace the text with new text at the end of the game during shutdown.
12/23/2008 (3:38 am)
What you'll need to do here is to save the players current inventory to a text file, and have torque pull the players inventory from that.an example inventory.txt file:
Weapon : Sniper Rifle
Ammo : 20
and just have torque replace the text with new text at the end of the game during shutdown.
#9
Thanks
-JP
12/23/2008 (9:17 am)
Would I be able to put it in that .mis file that was saved? I'd like to have it so it only pulls up the inventory that you had for that particular mission, that way you can't load level 1 and have everything you had from level 6. What would some syntax look like though for pulling it up from the text file though...Thanks
-JP
#10
12/24/2008 (4:42 pm)
Your best bet at this time would be to buy Edward Maurina's book Game Programmers guide to torque. He shows you how to load entire levels and populate them using text files. I haven't studies how it works as I don't need to functionality.
Torque Owner Christian S
Oak-Entertainment
1: at gamestart have the startMissionGui display those missions that are "openedUp" status only.
2: at completion of a mission, change the next ones status to "openedUp" or something similar.
function startMissionGui::onWake() { SM_missionList.clear(); %i = 0; for(%file = findFirstFile($Server::MissionFileSpec); %file !$= ""; %file = findNextFile($Server::MissionFileSpec)) [b][i]if (%i.status equals "openedUp"){ // or use == instead of equals if its a integer you use.[/b][/i] SM_missionList.addRow(%i++, getMissionDisplayName(%file) @ "\t" @ %file ); [b][i]// will only be added if valid }[/b][/i] // well, sort the list, etc. anyways SM_missionList.sort(0); SM_missionList.setSelectedRow(0); SM_missionList.scrollVisible(0); }(sorry for the Java mixing in, Im at school and not having any code/tools here.