HowTo:Edit Missions:XML integration

From VsWiki
Revision as of 17:53, 22 February 2009 by Legine (talk | contribs) (Undo revision 16809 by Legine (Talk))
Jump to: navigation, search

Basic XML integration

First let me start by explaining how to run a python class... in this case we start with the prebuild modules/privateer.py script to run our mission. Open up mission/explore_universe.mission First come the variables that designate how the mission should normally start. By normally I mean if they don't have any save game present.

Variables Section

It loads Crucible/Cephid_17.system as the star system (which is in XML and stores all present planets) After this, comes the actors in the mission, the flightgroups of fighters. If a mission has more than one player, then each player is the leader (first ship) in each respective flightgroup.

Notice that so far there are a lot of values you don't see for long in the default vegastrike game. Credits, System, first flightgroup fighter, difficulty--these are all initial values but can change.... since there is specified a savegame. The savegame makes the mission more of a campaign type mission where things may be saved to disk and reloaded at a later point. If no savegame variable is specified (this is where the autosave goes) then the mission will not save and will be a one time play mission.

<mission>
	<settings>
		<origin  planet="earth" x="0000" y="100" z="000.0"/>
	</settings>

	<variables>
<!--		<var name="continuousterrain" value="continuousterrain.txt"/>-->
		<var name="credits" value="13500"/>
		<var name="defaultplayer" value="blue"/>
		<var name="mission_name" value="Privateer Mission" />
		<var name="difficulty" value=".05"/><!--starting difficulty-->
		<var name="system" value="Crucible/Cephid_17" />
		<var name="description" value="Like, as if." />
		<var name="savegame" value="explore_universe_difficulty" />
	</variables>


Flightgroup Section

The rot flag is ignored, and the position specifies the x,y,z coords of the Shlimazel flightgroup, which is of type llama.begin.

        <flightgroups>
                <flightgroup name="Shlimazel" faction="privateer" type="llama.begin"
                                  ainame="default" waves="1" nr_ships="1">
			<pos x="-95124024.543917" y="412089916.256812" 
                             z="-110779667.398050"/>  
			<rot x="180.0" y="180.0" z="180.0"/>
			<order order="tmptarget" target="omikron"/>
			<order priority="0" order="superiority" target="enemy"/>
			<order priority="1" order="bomber" target="omikron"/>
			<order priority="2" order="escort" target="blue"/>
		</flightgroup>
        </flightgroups>

Python Section

Future note: If you wanted to add a campaign to the privateer mission you would most likely modify privateer.py to have a campaign module get loaded.... so you wouldn't necessarily need to modify explore_universe.mission just to add a campaign... lets dig further into the meat of the scripting.

If a mission has python tags...then it is a python mission and may have some embedded python in it. In this case the python makes a new python object of type privateer in the privateer.py module in the modules directory.


	<python>
from privateer import privateer
my_obj=privateer(8000,40000,500,3,2,.6,.25,.1,400000,2000)
	</python>
</mission>

You have to be careful about newlines, etc in the XML, but it shoudl usually work just dandy. You notice that the mission may pass in arguments to the privateer module that can make slight changes in the gameplay. This allows many cargo missions to use the same module in order to change the parameters of the cargo missions. In this case the values I have selected appear to work relatively well.

Note: Python code must be on a line by itself without any indentations--it needs to work exactly as it would if you had the contents in a python file itself. If you want the indents to work in-line with the XML file, you must prefix it with a block, such as an if statement:

	<python>if 1:
             from privateer import privateer
             my_obj=privateer(8000,40000,500,3,2,.6,.25,.1,400000,2000)
	</python>
</mission>