Jump to content

GR:AW SP Scripting 8


Recommended Posts

This may look like alot of work, and it was the first time when I had to figure it all out, but it really isn't much to it. It's much fatser to do then to build and script the mission, which you have to do first.

EDIT: I would like to point out though that I haven't tested to use this with anything other then a moddified original map with new script. But I would guess it should work the same, at least in 95% procent of this text, with a custom map.

How To Override An Original SP Mission

Intro and Preparations:

In this tutorial I'll use my own recently finished mission mod and show what I needed to do to get the override to work. Before starting this tutorial you should have completed your work in the world.xml and your scripted mission.xml which you placed in custom_levels\work\"your mod"\script folder. After that you should have exported it from the map editor, I used the [GR] Coop exporter option. We need to do this to generate the new lightmaps, AI graph and some other files. You'll also need to have the quick.bundle extracted, and over that extract the patch.bundle (this so the patch replaces all files updated in it), this as we'll need to get some files from it and edit slightly and also use as reference. I'll refer to these file locations as if you extracted the bundles into local\bundle, and removed the data folder step like said in other tutorials.


Ok, now you're ready to override. First you have to decide which mission to override. In my case it was simple, I used an original map to create my mission on so I override that map, in this case "mission05". But I could just as easily used any of the other missions as you can override all files anyhow.


After that is decided we can create the folder structure. In the local folder I created my own sub-folder, which we can call "my_mod". In that we need as few different sub-folders depending on how the mission is built. But we'll always need the "levels", "strings" and "textures" folders. Inside the "levels" folder we need to create the folder for the mission to override, in this case "mission05", and inside that there should also be a folder called "xml". Inside the "textures" folder we need to create one called "lightmaps", and once again inside that one specfic for the mission we'll override, "mission05", and inside that and "atlas0" folder. Some missions also use and "atlas1" folder, in which case you'll need that as well.

We now have a folder structure that looks like this:

local -> my_mod -> levels -> mission05 -> xml

local -> my_mod -> strings

local -> my_mod -> textures -> lightmaps -> mission05 -> atlas0

Strings Files:

Now it's time to start placing/editing the files needed.

Into local\my_mod\strings you should copy the menu.xml found in the local\bundle\strings folder. This is only needed to edit the name of the mission in the selection menues. Open it in any text/xml editor, search for "campaign_mission" and you'll find the section that sets the name for all the missions. Replace the string inside the quotes with the name you want to use for your mission. I named mine "Titan Skull", which gives me this line efter the editing:

<string id="campaign_mission_5" value="Titan Skull"/>

Levels Files:

Next we'll go into the local\my_mod\levels\mission05 folder. Into this we'll have to pu thte new AI graph, mission xml and diesel, texture scope and materials files.

You'll find that when you exported you mission in the map editor, it created a new folder structure inside custom_levels. In this you'll find all the files it put into the bundle created in the export, but in folders. Great! Now lets look for what we need. First find custom_levels\work_temp\1\data\levels\custom_levels\"your mod".

Inside you'll find the AI graph, texture scope, materials, as well as diesel and xml mission files. Copy all these into the local\my_mod\levels\mission05 folder.

Now rename the diesel and mission xml files to that of the mission you want to override, in my case "mission05.diesel" and "mission05.xml". Then open the mission xml file in your text/xml editor. In the first lines you'll find a few "load_scene" tags. Those we'll have to edit a little. Opened the real mission05.xml file and copy all the "load_scene" tags with their contents and replce all "load_scene" tags in you exported file with that.

<load_scene file="/data/levels/mission05/mission05.diesel" use_lightset="true" materials="/data/levels/mission05/materials.xml">

<object name="world_bb" hidden="true"/>

<!-- Collisions -->

<xi:include href="xml/mission05_collision.xml#xpointer(/collision/*)"/>

<global_ambient color="60 60 40"/>


<load_scene file="/data/objects/lens/normal_lens.diesel">

<object name="normal_lens" hidden="true"/>


<load_scene file="/data/objects/lens/zoom_lens.diesel">

<object name="zoom_lens" hidden="true"/>


Save mission.xml and exit editor. Make a copy of your edited mission.xml file and rename the new file the same as the original but with "_ni" at the end, like "mission05_ni.xml". This file is used if the server uses the "skip insertion" option in Coop. If you have a long insertion in your mission I suggest you redo that part of the script in this file to allow people to skip it, otherwise just keep it the same as the normal mission.xml.

The texture_scope.xml may also need to be edited. But we don't know that until we have tested the map in-game. If there are props missing textures (shows up as yellow and blue squares), the texture_scope.xml is missing some entries. If you're using an original map to build your mission on, you should add all the entires found in the original texture_scope.xml into your (make sure ther are no double entries though), or there may be problems with the environment itself.

That should be it in this folder.

Next we'll go into the local\my_mod\levels\mission05\xml folder.

Into this we again have to put a few files from you exported folder. Copying everything from you custom_levels\work_temp\1\data\levels\custom_levels\"your mod"\xml folder.

Open up the world.xml in your text/xml editor and replace the level_name on line 2, with that of the mission you override, level_name="titan_skull" turns to level_name="mission05". Save and exit editor. Make a copy of the world.xml and, like we did with the mission.xml, add "_ni" to it's name, "world_ni.xml". Like with the mission.xml, a special world.xml is used when checking the "skip insertion" box in Coop mode.

Lightmaps Files:

Finally we'll have to copy the lightmaps to the correct location. Go into custom_levels\work_temp\1\data\textures\custom_levels\"your mod"\lightmaps\atlas0 and copy the files found there in local\my_mod\textures\lightmaps\mission05\atlas0.

Open the tdb_atlas_set.xml in your text/xml editor and edit the name entry on the first line. It should be the location you copied the file to, in this case "lightmaps/mission05/atlas0". Save and exit.

If you have an "atlas1" folder, repeat the same procedure for that one, but from custom_levels\work_temp\1\data\textures\custom_levels\"your mod"\lightmaps\atlas1 to local\my_mod\textures\lightmaps\mission05\atlas1 of course.

That should be it for your basic mission.


Now, if your using a string.xml file to store your strings used for objectives and messages, just pur that in local\my_mod\strings and rename it after the mission you override, in this case "mission05.xml".

I also had edited the group_manager.xml file to create a new hostile group type. That has to be included for the mission to work. It should be placed in a new folder we don't currently have. So in the local\my_mod folder, create a folder called "lib" with a sub-folder called "manager" and inside that one called "xml". Copy your edited group_manager.xml file there, local\my_mod\lib\managers\xml.

This is the final list of files that I have inside my mod folder, which overrides mission05 with my custom one.


















If you edit the group_manager.xml, you'll have to place it in local\english\lib\managers\xml for it to work in the map editor. The same logics goes for all other xml files you edit to use in the map editor. Place them in a mirror folder to where you found them in the local\bundle structure, but inside local\english instead.

Hope it clears up some of your question on how to do it. :rolleyes:

Edited by Wolfsong
Link to comment
Share on other sites

Wolfsong, when using [GR] coop exporting, is there anything [GR] coop specific that is added to the mission.xml or world.xml files that would need editing? Cheers...

No. Nothing. The only thingit adds is inside the description.xml that tells the MP servers where to list it. Besides that it requires you to have done the job needed for it to work in that game mode.

Link to comment
Share on other sites

  • 4 weeks later...

Wolfsong, i've just downloaded your paper aboutt scripting and i just want to say thank you very much for this pro work.

Just a little question (anyone with the answer please feel free) : is there any xsd files anywhere to qualify/verify the xml used in GRAW ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...