Topic: Swapping Out Mission Files in Mid-Campaign  (Read 2905 times)

0 Members and 1 Guest are viewing this topic.

Offline kiloton

  • Lt. Junior Grade
  • *
  • Posts: 25
Swapping Out Mission Files in Mid-Campaign
« on: August 05, 2004, 10:26:00 am »
Can this be done?  More specifically, if I am on mission 5 of a campaign, can I replace mission 6 and reload the campaign and have everything work OK?  Or do I have to start the whole campaign over?

I figured since the missions are basically DLLs that I could swap them out but I did not know if all missions were loaded at the beginning of the campaign or if the next mission is loaded after completion of the previous, etc.

I tried swapping out a later mission in mid campaign and got some weird behavior, ships not showing up visually until I was right on top of them, for example.  I started the campaign over with the swapped out missions and have not seen these problems, yet.

Any mission scripters out there that can answer this?  Firesoul, how did you have to test when you recompiled the EAW campaigns for OP?  I am doing SFC1 but I figured this aspect would likely be identical.

Thanks,

Ken

Offline NuclearWessels

  • Evil Dave
  • Serverkit Development Team
  • Lt. Commander
  • *
  • Posts: 1249
  • Scripter and general nuisance
    • NukeDocs
Re: Swapping Out Mission Files in Mid-Campaign
« Reply #1 on: August 05, 2004, 11:07:58 am »

I'm not 100% sure it was the same in SFC1, but in EAW/OP there is a line of code in the mission script that specifies an internal name for the subsequent campaign mission, e.g. in OP's X25_Hire you find:

   fMissionScheduler.fNextMissionTitle = "X25_Legend";

This corresponds to an entry in the MissionText.cpp file for the X25_Legend.scr campaign script, not to the filename, so just swapping them out isn't necessarily going to work.

dave

Offline FireSoul

  • Modder of shiplists
  • Lt. Commander
  • *
  • Posts: 1306
  • mew.
    • http://klingon.lostexiles.net/
Re: Swapping Out Mission Files in Mid-Campaign
« Reply #2 on: August 05, 2004, 11:46:18 am »
Can this be done?  More specifically, if I am on mission 5 of a campaign, can I replace mission 6 and reload the campaign and have everything work OK?  Or do I have to start the whole campaign over?

I figured since the missions are basically DLLs that I could swap them out but I did not know if all missions were loaded at the beginning of the campaign or if the next mission is loaded after completion of the previous, etc.

I tried swapping out a later mission in mid campaign and got some weird behavior, ships not showing up visually until I was right on top of them, for example.  I started the campaign over with the swapped out missions and have not seen these problems, yet.

Any mission scripters out there that can answer this?  Firesoul, how did you have to test when you recompiled the EAW campaigns for OP?  I am doing SFC1 but I figured this aspect would likely be identical.

Thanks,

Ken

Can you define 'swap out'? .. the filenames are just filenames. The contents of the .SCR files are read at SFC's load time, and registered with the game. So what do you mean by "swap out", exactly?


Author: OP+ Mod
Maintainer: Coopace
Author: Fests+ for OP
Creator: SFC-OP Mini Updater
Maintainer: SFC-EAW for OP Campaigns
Kitbash: SFC2 models

Offline kiloton

  • Lt. Junior Grade
  • *
  • Posts: 25
Re: Swapping Out Mission Files in Mid-Campaign
« Reply #3 on: August 05, 2004, 12:02:43 pm »
Yep, I should have been clearer.

The line that points to the next mission is intact and already points to the next mission correctly.  I want to replace the existing next mission .scr file with a new one.

In this case, I have modified mission 6.  Mission 5 correctly points to mission 6 in the appropriate tag.  If I replace the mission 6 .scr file and load a saved game where I just completed mission 5, will everything still be OK with the saved game or do I need to start the campaign over?

I think the answer should be yes that I can continue the saved game because it should just load the mission when it needs it but I saw some strange behavior when I did this previously.  That could be due to other factors (like the changes I made, although they are pretty innocuous).

Thanks guys!

Ken

Offline kiloton

  • Lt. Junior Grade
  • *
  • Posts: 25
Re: Swapping Out Mission Files in Mid-Campaign
« Reply #4 on: August 05, 2004, 12:05:40 pm »
Incidentally, I am trying to fix the Hydran campaign from SFC 1.  This is my first attempt at scripting work.

The campaign initially skipped from mission 5 to 9 because 6-8 did not work correctly.  I am trying to rectify that.

Ken

Offline kiloton

  • Lt. Junior Grade
  • *
  • Posts: 25
Re: Swapping Out Mission Files in Mid-Campaign
« Reply #5 on: August 05, 2004, 04:20:07 pm »
To put it another way, Firesoul, when you were doing your EAW ports to OP, if you got to the last mission of say, the Fed campaign, and all the previous missions were fine but the last one turned out to be FUBAR, could you just correct the last mission, replace the .scr file, and load a saved game in which you had just finished the mission prior to the goofed one or did you need to do the campaign over?

Thanks,

Ken

Offline The Postman

  • 1st Sgt, Bugler, Commander, L. A. Tifft Camp 15, SUVCW
  • D.Net Beta Tester
  • Commander
  • *
  • Posts: 4033
  • Gender: Male
Re: Swapping Out Mission Files in Mid-Campaign
« Reply #6 on: August 05, 2004, 05:59:20 pm »
I have found that you can replace but not add missions in mid campaign for OP and EAW. I don't know if this would hold true for SFC 1.

Hope this is what you were looking for.



Link: ht

Offline kiloton

  • Lt. Junior Grade
  • *
  • Posts: 25
Re: Swapping Out Mission Files in Mid-Campaign
« Reply #7 on: August 06, 2004, 11:15:48 am »
Postman,

Thanks.  If I am reading you correctly, that is what I am looking for.  I am in mid campaign and I want to fix the "next" mission, which is broken.  The mission I just finished has the hooks to point to the next mission but I want to replace that next mission's .scr file for testing and, when it's busted, load the same saved game and try another new next mission file again.

Ken

Offline Bonk

  • Commodore
  • *
  • Posts: 13298
  • You don't have to live like a refugee.
Re: Swapping Out Mission Files in Mid-Campaign
« Reply #8 on: August 07, 2004, 12:00:15 am »
I just edit the missionlist blob and its size in the SQL db (can do the same in the flatfile) to match whatever I put in the campaign file and scripts folder. Works fine, I can change all the missions without a reset if desired. The serverkit needs to come down during the change (for SQL or the flatfile) and the change takes when the kit is started up again.

The missionlist is:
the total number of missions
three bytes padding
the number of bytes in the first mission file name
three bytes padding
the first mission file name
the number of bytes in the second mission file name
three bytes padding
the second mission file name
...

(all in hex... e.g.:

22 00 00 00 1A 00 00 00
4D 65 74 5F 4E 57 31 30
50 61 74 72 6F 6C 45 6E
65 6D 79 5F 74 77 2E 73
63 72 15 00 00 00 4D 65
74 5F 4E 57 31 30 50 61
74 72 6F 6C 5F 74 77 2E
73 63 72 ...

as characters:
".......
MetNW_10
PatrolEn
emy_tw.s
cr....Me
t_NW10Pa
trol_tw.
scr...


don't forget to edit the missionlist size as well or it won't work.

I have swapped the missions on the Gravity Well from EEK2.1 to NW's OP Total War missions and back again without a reset using this technique. (and on other servers with different missions as well)

edit: oops, just realised you're talking about a single player SFC1 campaign - I'm not sure the same holds true for the SFC1 flatfile, but it probably does. Anyway, by the sound of it you only need to swap out the new mission files as they'll have the same names as the old ones anyway (?)...
« Last Edit: August 07, 2004, 12:13:05 am by Bonk »

Offline kiloton

  • Lt. Junior Grade
  • *
  • Posts: 25
Re: Swapping Out Mission Files in Mid-Campaign
« Reply #9 on: August 09, 2004, 06:50:08 am »
Hmm, what is the SFC1 missions flatfile?  Is it the .lst file that is in the script directory?  Since the Hydran campaign was busted, it is possible that the flat file did not include the broken missions.  How do I edit this file?  I tried opening the .lst file with wordpad and got gibberish.  Can I use the MS Studio hex editor or something?

Thanks,

Ken

Offline Bonk

  • Commodore
  • *
  • Posts: 13298
  • You don't have to live like a refugee.
Re: Swapping Out Mission Files in Mid-Campaign
« Reply #10 on: August 09, 2004, 09:34:55 am »
Hmm, what is the SFC1 missions flatfile?  Is it the .lst file that is in the script directory?  Since the Hydran campaign was busted, it is possible that the flat file did not include the broken missions.  How do I edit this file?  I tried opening the .lst file with wordpad and got gibberish.  Can I use the MS Studio hex editor or something?

Thanks,

Ken

I just reinstalled SFC1 to check. Man, SFC1 is a lot tougher than I remembered... anyway, the files are completely different for SFC1. What I posted above won't help you at all for SFC1. Yes, you will need a hex editor to change the mission script names if any are different. (The other approach is to rename the new files to the ones present in the save file which would be much simpler). Back up the save file first then try and edit it.

The scripts.lst file looks like part of the picture, but the save file also has the missions listed. Both have missions listed with 1 byte of padding between each character, but I'm not sure how they're structured overall.

Lets see: I took a look at the one campaign save file for a hydran campaign I started (only ran one mission)...
At 01B0 I see a structure that looks much like the missionlist in SFC2, but the structure is a little different, each character in the filenames are seperated by 1 byte padding, but each filename is seperated inconsistently, most are seperated by three bytes of padding but some contain a value in the second byte between each filename... some are separated by 4 bytes padding...may take a while to figure... you'll probably get a new campaign started before I can figure this out.

The answer seems to be in the save file but it will take some figuring to see how the missions are actually listed with a hex editor. Sorry that's not much help, but there ya go.