function LoadMap_Forest()
{
%MissionFile = "Add-Ons/Map_Forest/Map.mis";
%SimGroupName = "Map_Forest";
%file = new fileObject();
%file.openForRead(%MissionFile);
%file.readLine();
if(%file.isEOF())
{
%file2 = new fileObject();
%file2.openForWrite(%MissionFile);
while(!%file.isEOF())
{
%file2.writeLine(strReplace(%file.readLine(), "MissionGroup", %SimGroupName));
}
%file2.close();
%file2.delete();
}
%file.close();
%file.delete();
//exec(%MissionFile);
}
The Map.mis file remains exactly the same. MissionGroup has not been replaced.
If at all possible, I also need the script to not load default mission stuff (Sky, Sun, fxPlane, SimGroup(PlayerDropPoints), fxDayCycle, and fxSunLight)
EDIT:
I've thought of an easier way to do it, but I don't know how.
Basically it should replace line 2 from new SimGroup(MissionGroup) { to new SimGroup(Map_Forest) {, an delete the contents of lines 4 to 293.
Here is the Map.mis:
//--- OBJECT WRITE BEGIN ---
new SimGroup(MissionGroup) {
//Lines 4 to 293 are here, bunch of default mission stuff
new TSStatic() {
position = "-41.8661 -0.971407 0";
rotation = "1 0 0 0";
scale = "1 1 1";
shapeName = "base/data/shapes/Sharp_Trees/Trees/Scrub_Pines/Sharp_ScrubPine09.dts";
};
};
//--- OBJECT WRITE END ---