Saving/loading additional (separate) camapaigns
Moderator: Moderators
- Teancum
- Jedi Admin

- Posts: 11080
- Joined: Wed Sep 07, 2005 11:42 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: Indiana
Saving/loading additional (separate) camapaigns
The closest thing I've found is Zerted's save/load scripts, which might do just what I need, but I'm curious about separate mini-campaigns I could possibly add from the shell. Doing the shell-side stuff and missions isn't difficult, but I don't know if I can actually save/load totally separate campaign files.
- Maveritchell
- Jedi Admin

- Posts: 7366
- Joined: Mon Aug 21, 2006 11:03 pm
Re: Saving/loading additional (separate) camapaigns
I'm not sure entirely what you're trying to do, but you don't need to create something special to save/load if you're just using a stock setup. You can use a shell addon (i.e. a custom GC) with the 1.3 patch to load in a custom campaign, which you can save like any stock campaign sequence. Or so I understand, I haven't tried it yet.
- Teancum
- Jedi Admin

- Posts: 11080
- Joined: Wed Sep 07, 2005 11:42 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: Indiana
Re: Saving/loading additional (separate) camapaigns
Dang -- this is for the Xbox, which means no 1.3 patch. Guess I'll keep looking into it. It was more for a mini-campaign (Smuggler mode) than a GC thing.
- Frisbeetarian
- Jedi

- Posts: 1233
- Joined: Wed Sep 12, 2007 3:13 pm
Re: Saving/loading additional (separate) camapaigns
Which files are you able to edit again? Also, just to clear things up, campaigns and GCs are basically the same thing.
- [RDH]Zerted
- Gametoast Staff

- Posts: 2982
- Joined: Sun Feb 26, 2006 7:36 am
- Projects :: Bos Wars AI - a RTS game
- xbox live or psn: No gamertag set
- Location: USA
- Contact:
Re: Saving/loading additional (separate) camapaigns
Campaigns and Galactic Conquest (metagames) are almost exactly the same thing. Their main difference is that one uses the ScriptCB functions with 'Campaign' in its name and the other uses 'Metagame' in the function's name.
The SaveAndLoadUtils has no dependences. It can run without modifications to the shell, ingame, or common. However metagames use the metagame state which is also what SaveAndLoadUtils uses. Unless you back that table up and restore it right afterwards, using SaveAndLoadUtils inside a metagame/GC will mess everything up (or you could edit SaveAndLoadUtils to use campaign states).
There were only two changes needed to support custom Galactic Conquests. First, change where the button list is generated into a function call. Each new cGC should override this function to add in its button data into the returning table. Next, add a new function into where the button presses are handled. Each new cGC should override this function to determine when its button was pressed. If you name the new functions custom_GetGCButtonList and custom_PressedGCButton, then you can use the v1.3 cGC templates.
At the time, I didn't think of adding in support for custom Campaigns. In theory, the shell changes should be almost exactly the same as in cGCs. However, I think campaigns only use campaign states. If so, the SaveAndLoadUtils will work fine within it.
In saving metagames, SWBF2 just stores the game's main table. I would assume the same is for Campagins. If so, there is nothing extra you need to do once the campaign has loaded.
The SaveAndLoadUtils has no dependences. It can run without modifications to the shell, ingame, or common. However metagames use the metagame state which is also what SaveAndLoadUtils uses. Unless you back that table up and restore it right afterwards, using SaveAndLoadUtils inside a metagame/GC will mess everything up (or you could edit SaveAndLoadUtils to use campaign states).
There were only two changes needed to support custom Galactic Conquests. First, change where the button list is generated into a function call. Each new cGC should override this function to add in its button data into the returning table. Next, add a new function into where the button presses are handled. Each new cGC should override this function to determine when its button was pressed. If you name the new functions custom_GetGCButtonList and custom_PressedGCButton, then you can use the v1.3 cGC templates.
At the time, I didn't think of adding in support for custom Campaigns. In theory, the shell changes should be almost exactly the same as in cGCs. However, I think campaigns only use campaign states. If so, the SaveAndLoadUtils will work fine within it.
In saving metagames, SWBF2 just stores the game's main table. I would assume the same is for Campagins. If so, there is nothing extra you need to do once the campaign has loaded.
- Teancum
- Jedi Admin

- Posts: 11080
- Joined: Wed Sep 07, 2005 11:42 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: Indiana
Re: Saving/loading additional (separate) camapaigns
Yeah, but what exactly differentiates a custom campaign from the shipped 501st? I don't really need any GC stuff - I just wanted to do a mini-campaign where you need to smuggle things from several planets, one at a time, in a linear order, one unlocking after the other - just like in the shipped campaign - just separate.
- [RDH]Zerted
- Gametoast Staff

- Posts: 2982
- Joined: Sun Feb 26, 2006 7:36 am
- Projects :: Bos Wars AI - a RTS game
- xbox live or psn: No gamertag set
- Location: USA
- Contact:
Re: Saving/loading additional (separate) camapaigns
Like I said, I'm not sure why I never looked closely at Campaigns so I don't know all their details. Skimming through the code, it seems the push screen sequence roughly follows:
ifs_sp
ifs_sp_briefing
ifs_freeform_rise_newload
or
ifs_sp_campaign
and
ifs_campaign_main (or ifs_campaign_load if loading an existing campaign)
ifs_campaign_turn_intro
ifs_campaign_battle
ifs_campaign_battle_card
ifs_campaign_battle_intro (plays intro movie, then ScriptCB_EnterMission() to load the set map)
I'm not exactly sure what ScriptCB_SetSPProgress( num1, num2 ) does. A quick guess is the first parameter is the Campaign number and the second number is that Campaign's progress, but thats just a bad guess.
The Campaign mission sequence is stored in ifs_campaign_data's ifs_campaign_mission table. The scripts just go to the next index at each Campaign 'turn'.
A really cheap/poor way of supporting Custom Campaigns would be to replace that mission table with your own whenever the player clicks on your Campaign button.
ifs_sp
ifs_sp_briefing
ifs_freeform_rise_newload
or
ifs_sp_campaign
and
ifs_campaign_main (or ifs_campaign_load if loading an existing campaign)
ifs_campaign_turn_intro
ifs_campaign_battle
ifs_campaign_battle_card
ifs_campaign_battle_intro (plays intro movie, then ScriptCB_EnterMission() to load the set map)
I'm not exactly sure what ScriptCB_SetSPProgress( num1, num2 ) does. A quick guess is the first parameter is the Campaign number and the second number is that Campaign's progress, but thats just a bad guess.
The Campaign mission sequence is stored in ifs_campaign_data's ifs_campaign_mission table. The scripts just go to the next index at each Campaign 'turn'.
A really cheap/poor way of supporting Custom Campaigns would be to replace that mission table with your own whenever the player clicks on your Campaign button.
- Teancum
- Jedi Admin

- Posts: 11080
- Joined: Wed Sep 07, 2005 11:42 pm
- Projects :: No Mod project currently.
- xbox live or psn: No gamertag set
- Location: Indiana
Re: Saving/loading additional (separate) camapaigns
Hmmm -- that might be an option. Thanks for the ideas.
