<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.vega-strike.org/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Nabaco</id>
		<title>VsWiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.vega-strike.org/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Nabaco"/>
		<link rel="alternate" type="text/html" href="https://wiki.vega-strike.org/Special:Contributions/Nabaco"/>
		<updated>2026-05-13T17:41:18Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.30.2</generator>

	<entry>
		<id>https://wiki.vega-strike.org/mediawiki/index.php?title=Development:Missions&amp;diff=19866</id>
		<title>Development:Missions</title>
		<link rel="alternate" type="text/html" href="https://wiki.vega-strike.org/mediawiki/index.php?title=Development:Missions&amp;diff=19866"/>
				<updated>2020-03-22T17:58:18Z</updated>
		
		<summary type="html">&lt;p&gt;Nabaco: Switched SVN URLs to GH&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NAV_Manual |&lt;br /&gt;
| previous=[[Development:Campaigns|Edit Campaigns]]&lt;br /&gt;
| up=[[HowTos]]&lt;br /&gt;
| next=[[HowTo:Edit News|Edit News]]&lt;br /&gt;
}}&lt;br /&gt;
----&lt;br /&gt;
==EDITING MISSIONS==&lt;br /&gt;
{{attention}}&lt;br /&gt;
&lt;br /&gt;
===Introduction===&lt;br /&gt;
Vega Strike has a powerful missions scripting interface that allows you to nearly modify Vega Strike at whatever level you choose, from the AI scripts (and the physics thereof) to the missions... to the overall plot and goal of the game.&lt;br /&gt;
&lt;br /&gt;
===[[HowTo:Edit_Missions:XML_integration|Basic XML integration]]===&lt;br /&gt;
&lt;br /&gt;
===[[HowTo:Edit_Missions:Python:Missions|Python Inheritance In Missions]]===&lt;br /&gt;
&lt;br /&gt;
===Conclusions===&lt;br /&gt;
Well this is the best I can do so far. Please read this documentation over and let me know if you have any suggestions or clarifications. And best yet give it a shot and try it out. And at least look at &lt;br /&gt;
'''[https://github.com/vegastrike/Assets-Production/tree/master/modules/missions/cargo_mission.py modules/missions/cargo_mission.py]''' (which is called from a number of missions I think) as well as '''[https://github.com/vegastrike/Assets-Production/blob/master/modules/missions/privateer.py modules/missions/privateer.py]''' called by '''[https://github.com/vegastrike/Assets-Production/blob/master/mission/explore_universe.mission mission/explore_universe.mission]'''. And certainly try to understand '''[https://github.com/vegastrike/Assets-Production/blob/master/modules/quests/quest_drone.py modules/quests/quest_drone.py]''' before trying to write a quest (or while trying to write one).&lt;br /&gt;
&lt;br /&gt;
Please also have a look in [[Development:Quests]] for a detailed explanation on the structure of quests and an explanation on how they work.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[HowTo:Add_Conversations]]&lt;br /&gt;
* [[HowTo:Edit_News]]&lt;br /&gt;
* [[Development:Campaigns]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
{{NAV_Manual |&lt;br /&gt;
| previous=[[Development:Campaigns|Edit Campaigns]]&lt;br /&gt;
| up=[[HowTos]]&lt;br /&gt;
| next=[[HowTo:Edit News|Edit News]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:HowTos|Edit Missions]]&lt;br /&gt;
[[Category:Development|Edit Missions]]&lt;/div&gt;</summary>
		<author><name>Nabaco</name></author>	</entry>

	<entry>
		<id>https://wiki.vega-strike.org/mediawiki/index.php?title=HowTo:Edit_Missions:Python:Missions&amp;diff=19865</id>
		<title>HowTo:Edit Missions:Python:Missions</title>
		<link rel="alternate" type="text/html" href="https://wiki.vega-strike.org/mediawiki/index.php?title=HowTo:Edit_Missions:Python:Missions&amp;diff=19865"/>
				<updated>2020-03-22T17:54:03Z</updated>
		
		<summary type="html">&lt;p&gt;Nabaco: Replaced one SVN URL&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Python Inheritance In Missions==&lt;br /&gt;
&lt;br /&gt;
Ok lets dig further into the &amp;lt;code&amp;gt;[https://github.com/vegastrike/Assets-Production/blob/master/modules/missions/privateer.py privateer.py]&amp;lt;/code&amp;gt; module:&lt;br /&gt;
&lt;br /&gt;
It is a very short module written in more or less pure python... I say more or less for a very specific reason: it inherits from a C++ class!&lt;br /&gt;
&lt;br /&gt;
Director is a C++ class exported to python. All missions must inherit from director.... in this case the mission is very short as it uses other (pure python) modules. &amp;lt;code&amp;gt;random_encounters.random_encounters&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;difficulty.difficulty&amp;lt;/code&amp;gt; and ,&amp;lt;code&amp;gt;trading.trading&amp;lt;/code&amp;gt; all do NOT inherit from C++ as this class takes care of the C++ inheritance.&lt;br /&gt;
&lt;br /&gt;
The constructor &amp;lt;code&amp;gt;__init__&amp;lt;/code&amp;gt; takes the arguments that we passed in from the XML file and passes them on to the various submodules. The only really really important thing you do in the constructor is call&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Director.Mission.__init__ (self)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
If you do not do this, Vegastrike will not load your module and will silently fail (this calls the C++ constructor, which actually triggers the binding of your module to the python mission).&lt;br /&gt;
&lt;br /&gt;
Each mission module must have an execute function so that something can happen every physics frame. In this case it just calls execute on all the submodules... not very interesting.&lt;br /&gt;
&lt;br /&gt;
Missions also may have 2 functions:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;Pickle (self)&amp;lt;/code&amp;gt; which returns a string with a XML mission file that will load the mission properly as well as a string representing the mission in serialized form... if the mission were reloaded that mission would be loaded and its corresponding python would be run. &lt;br /&gt;
* Then &amp;lt;code&amp;gt;Unpickle (self, str)&amp;lt;/code&amp;gt; would be called (with str being a string) and the expectation that the mission would be reloaded. &amp;lt;code&amp;gt;[http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/vegastrike/data4.x/modules/newmission.py?rev=HEAD&amp;amp;content-type=text/vnd.viewcvs-markup modules/newmission.py]&amp;lt;/code&amp;gt; has an example of this. {{fixme}} ''LINK IS WRONG!! - OLD DATA MODULE REFERENCE''&lt;br /&gt;
&lt;br /&gt;
You may also choose to save data in a float by float format as follows (the advantage to this format is that it is saved on a PER PLAYER basis... so that each player may have a different value):&lt;br /&gt;
&lt;br /&gt;
There are 4 functions at your disposal for this older way to save missions:&lt;br /&gt;
&lt;br /&gt;
This function adds the key for later retrieval (even after VS quits ) and pushes the float to the end of the hashtable indexed by stringkey:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
myindex=Director.pushSaveData(int whichplayer, stringkey,floatVal);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This function modifies a index in a key that has already been pushed back at one point: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  Director.putSaveData (intWhichPlayer, stringkey, myIndex, floatVal);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This function gets the number of float values for a given player: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  Director.getSaveDataLength (int whichplayer, string key)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This function gets save data saved at that number: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  Director.getSaveData(int whichplayer, stringkey, int num)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can make up stringkeys and save only 1 float per key if you wish... each key is allowed to have an vector of possible values. Use as you wish! For the privateer mission I save things with key 31337ness and the one value in there is the difficulty that I write out.... If a campaign is more global rather than player specific you may just choose to pickle it...however if something is on a per-player basis, it may be best going in these SaveData float vectors.&lt;br /&gt;
&lt;br /&gt;
With the exception of AI modules from here on out it's straight python. I will go over some of the functions you can call inside Vega Strike in a minute.&lt;br /&gt;
&lt;br /&gt;
[[Category:HowTos|Edit Missions:Python:Missions]]&lt;br /&gt;
[[Category:Development|Edit Missions:Python:Missions]]&lt;/div&gt;</summary>
		<author><name>Nabaco</name></author>	</entry>

	<entry>
		<id>https://wiki.vega-strike.org/mediawiki/index.php?title=HowTo:Edit_Missions:XML_integration&amp;diff=19864</id>
		<title>HowTo:Edit Missions:XML integration</title>
		<link rel="alternate" type="text/html" href="https://wiki.vega-strike.org/mediawiki/index.php?title=HowTo:Edit_Missions:XML_integration&amp;diff=19864"/>
				<updated>2020-03-22T17:27:03Z</updated>
		
		<summary type="html">&lt;p&gt;Nabaco: Switched SVN URLs to GH&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Basic XML integration==&lt;br /&gt;
First let me start by explaining how to run a python class... in this case we start with the prebuild &amp;lt;code&amp;gt;[https://github.com/vegastrike/Assets-Production/blob/master/modules/missions/privateer.py modules/missions/privateer.py]&amp;lt;/code&amp;gt; script to run our mission. Open up &amp;lt;code&amp;gt;[https://github.com/vegastrike/Assets-Production/blob/master/mission/explore_universe.mission mission/explore_universe.mission]&amp;lt;/code&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
===Variables Section===&lt;br /&gt;
&lt;br /&gt;
* '''continuousterrain''' [string]&lt;br /&gt;
** &amp;quot;&amp;quot; (default)&lt;br /&gt;
* '''credits''' [float] - Starting money.&lt;br /&gt;
** 0 (default)&lt;br /&gt;
* '''defaultplayer''' [string] - Team name. Doesn't seem to matter. {{fixme}}&lt;br /&gt;
* '''description''' [string] - Description is used in scripts only, the engine doesn't read it.&lt;br /&gt;
* '''difficulty''' [float] - Multiplier for lots of game parameters - e.g. &amp;quot;Basic repair&amp;quot; cost equals &amp;lt;code&amp;gt;[[Manual:Config:Advanced:Variables#.22physics.22_section|physics/repair_price]]&amp;lt;/code&amp;gt;*difficulty.&lt;br /&gt;
** In net games is set by server variable. Can be modified by scripts later. E.g. difficulty.py module provides a simple way to automatically vary it with PC's wealth (it only goes up, to 0.999) and in default campaign it maxes out at 400000 Cr.&lt;br /&gt;
** 1 (default)&lt;br /&gt;
* '''num_players''' [int]&lt;br /&gt;
** 1 (default)&lt;br /&gt;
* '''savegame''' [string] - The savegame makes the mission more of a campaign type mission where things may be saved to disk and reloaded at a later point.&lt;br /&gt;
** 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. &lt;br /&gt;
** &amp;quot;&amp;quot; (default)&lt;br /&gt;
* '''system''' [string] - Starting system. Can be overridden via savegame or scripts.&lt;br /&gt;
** &amp;quot;sol.system&amp;quot; and &amp;quot;Sol/Sol&amp;quot; (default) {{fixme}}&lt;br /&gt;
* '''terrain''' [string]&lt;br /&gt;
** &amp;quot;&amp;quot; (default)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;mission&amp;gt;&lt;br /&gt;
	&amp;lt;settings&amp;gt;&lt;br /&gt;
		&amp;lt;origin  planet=&amp;quot;earth&amp;quot; x=&amp;quot;0000&amp;quot; y=&amp;quot;100&amp;quot; z=&amp;quot;000.0&amp;quot;/&amp;gt;&lt;br /&gt;
	&amp;lt;/settings&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	&amp;lt;variables&amp;gt;&lt;br /&gt;
&amp;lt;!--		&amp;lt;var name=&amp;quot;continuousterrain&amp;quot; value=&amp;quot;continuousterrain.txt&amp;quot;/&amp;gt;--&amp;gt;&lt;br /&gt;
		&amp;lt;var name=&amp;quot;credits&amp;quot; value=&amp;quot;13500&amp;quot;/&amp;gt;&lt;br /&gt;
		&amp;lt;var name=&amp;quot;defaultplayer&amp;quot; value=&amp;quot;blue&amp;quot;/&amp;gt;&lt;br /&gt;
		&amp;lt;var name=&amp;quot;mission_name&amp;quot; value=&amp;quot;Privateer Mission&amp;quot; /&amp;gt;&lt;br /&gt;
		&amp;lt;var name=&amp;quot;difficulty&amp;quot; value=&amp;quot;.05&amp;quot;/&amp;gt;&amp;lt;!--starting difficulty--&amp;gt;&lt;br /&gt;
		&amp;lt;var name=&amp;quot;system&amp;quot; value=&amp;quot;Crucible/Cephid_17&amp;quot; /&amp;gt;&lt;br /&gt;
		&amp;lt;var name=&amp;quot;description&amp;quot; value=&amp;quot;Like, as if.&amp;quot; /&amp;gt;&lt;br /&gt;
		&amp;lt;var name=&amp;quot;savegame&amp;quot; value=&amp;quot;explore_universe_difficulty&amp;quot; /&amp;gt;&lt;br /&gt;
	&amp;lt;/variables&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
It loads &amp;lt;code&amp;gt;Crucible/Cephid_17.system&amp;lt;/code&amp;gt; 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.&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
===Flightgroup Section===&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;flightgroup&amp;lt;/code&amp;gt;&lt;br /&gt;
** '''name''' [string] [needed] - The displayed name.&lt;br /&gt;
** '''logo''' [string]&lt;br /&gt;
** '''logo_alpha''' [string]&lt;br /&gt;
** '''faction''' [string] [needed]&lt;br /&gt;
** '''type''' [string] [needed] - Unit type.&lt;br /&gt;
*** &amp;quot;hornet.xunit&amp;quot; (default) {{fixme}}&lt;br /&gt;
** '''ainame''' [string] [needed] - AI to use.&lt;br /&gt;
*** Much like &amp;lt;code&amp;gt;data/ai/VegaEvents.csv&amp;lt;/code&amp;gt;: it refers to &amp;lt;code&amp;gt;[https://github.com/vegastrike/Assets-Production/tree/master/ai/events data/ai/events/]'''ainame'''.*.xml&amp;lt;/code&amp;gt; AI files, ''not'' .xai scripts they call.&lt;br /&gt;
*** &amp;quot;_ainame&amp;quot; - {{fixme}} Seems to use Python [https://github.com/vegastrike/Assets-Production/tree/master/modules/ai/ AI modules].&lt;br /&gt;
** '''waves''' [int] [needed] - Number of waves. The next one will be launched only after its predecessor is completely eliminated.&lt;br /&gt;
** '''nr_ships''' [int] [needed] - Ships per wave.&lt;br /&gt;
** '''terrain_nr'''&lt;br /&gt;
*** &amp;quot;&amp;quot; (default); &amp;quot;mission&amp;quot;&lt;br /&gt;
** '''unit_type'''&lt;br /&gt;
*** &amp;quot;&amp;quot; (default) ='''unit'''; &amp;quot;vehicle&amp;quot;; &amp;quot;building&amp;quot;&lt;br /&gt;
* &amp;lt;code&amp;gt;pos&amp;lt;/code&amp;gt; [double] [needed], &amp;lt;code&amp;gt;rot&amp;lt;/code&amp;gt; [float] - Coordinates and orientation.&lt;br /&gt;
** '''x''', '''y''', '''z''' [float]&lt;br /&gt;
* &amp;lt;code&amp;gt;order&amp;lt;/code&amp;gt; - Scripted orders for the flightgroup. Elements are read, but seems to not being actually parsed currently. {{fixme}} Flightgroups spawn with &amp;quot;fire at will&amp;quot; directive and start acting as their AI setups and AI priorities suggest.&lt;br /&gt;
** '''order''' [needed]&lt;br /&gt;
** '''target''' [needed] - The name of target flightgroup.&lt;br /&gt;
** '''priority''' - Seems not to be used at all. {{fixme}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
        &amp;lt;flightgroups&amp;gt;&lt;br /&gt;
                &amp;lt;flightgroup name=&amp;quot;Shlimazel&amp;quot; faction=&amp;quot;privateer&amp;quot; type=&amp;quot;llama.begin&amp;quot;&lt;br /&gt;
                                  ainame=&amp;quot;default&amp;quot; waves=&amp;quot;1&amp;quot; nr_ships=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
			&amp;lt;pos x=&amp;quot;-95124024.543917&amp;quot; y=&amp;quot;412089916.256812&amp;quot; &lt;br /&gt;
                             z=&amp;quot;-110779667.398050&amp;quot;/&amp;gt;  &lt;br /&gt;
			&amp;lt;rot x=&amp;quot;180.0&amp;quot; y=&amp;quot;180.0&amp;quot; z=&amp;quot;180.0&amp;quot;/&amp;gt;&lt;br /&gt;
			&amp;lt;order order=&amp;quot;tmptarget&amp;quot; target=&amp;quot;omikron&amp;quot;/&amp;gt;&lt;br /&gt;
			&amp;lt;order priority=&amp;quot;0&amp;quot; order=&amp;quot;superiority&amp;quot; target=&amp;quot;enemy&amp;quot;/&amp;gt;&lt;br /&gt;
			&amp;lt;order priority=&amp;quot;1&amp;quot; order=&amp;quot;bomber&amp;quot; target=&amp;quot;omikron&amp;quot;/&amp;gt;&lt;br /&gt;
			&amp;lt;order priority=&amp;quot;2&amp;quot; order=&amp;quot;escort&amp;quot; target=&amp;quot;blue&amp;quot;/&amp;gt;&lt;br /&gt;
		&amp;lt;/flightgroup&amp;gt;&lt;br /&gt;
        &amp;lt;/flightgroups&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;rot&amp;lt;/code&amp;gt; flag is ignored, and the position specifies the &amp;lt;code&amp;gt;x,y,z&amp;lt;/code&amp;gt; coords of the Shlimazel flightgroup, which is of type &amp;lt;code&amp;gt;llama.begin&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
===Python Section===&lt;br /&gt;
Future note: If you wanted to add a campaign to the privateer mission you would most likely modify &amp;lt;code&amp;gt;privateer.py&amp;lt;/code&amp;gt; to have a campaign module get loaded.... so you wouldn't necessarily need to modify &amp;lt;code&amp;gt;explore_universe.mission&amp;lt;/code&amp;gt; just to add a campaign... lets dig further into the meat of the scripting.&lt;br /&gt;
&lt;br /&gt;
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 &amp;lt;code&amp;gt;privateer.py&amp;lt;/code&amp;gt; module in the &amp;lt;code&amp;gt;[https://github.com/vegastrike/Assets-Production/blob/master/modules/missions/ modules/missions/]&amp;lt;/code&amp;gt; directory.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	&amp;lt;python&amp;gt;&lt;br /&gt;
from privateer import privateer&lt;br /&gt;
my_obj=privateer(8000,40000,500,3,2,.6,.25,.1,400000,2000)&lt;br /&gt;
	&amp;lt;/python&amp;gt;&lt;br /&gt;
&amp;lt;/mission&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You have to be careful about newlines, etc in the XML, but it should 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.&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
	&amp;lt;python&amp;gt;if 1:&lt;br /&gt;
             from privateer import privateer&lt;br /&gt;
             my_obj=privateer(8000,40000,500,3,2,.6,.25,.1,400000,2000)&lt;br /&gt;
	&amp;lt;/python&amp;gt;&lt;br /&gt;
&amp;lt;/mission&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:HowTos|Edit Missions:XML integration]]&lt;br /&gt;
[[Category:Development|Edit Missions:XML integration]]&lt;/div&gt;</summary>
		<author><name>Nabaco</name></author>	</entry>

	<entry>
		<id>https://wiki.vega-strike.org/mediawiki/index.php?title=Development:Campaigns&amp;diff=19863</id>
		<title>Development:Campaigns</title>
		<link rel="alternate" type="text/html" href="https://wiki.vega-strike.org/mediawiki/index.php?title=Development:Campaigns&amp;diff=19863"/>
				<updated>2020-03-22T16:39:21Z</updated>
		
		<summary type="html">&lt;p&gt;Nabaco: Switched the example campaign URL from SVN to GH&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NAV_Manual |&lt;br /&gt;
| previous=[[HowTo:Edit faction relationships|Edit faction relationships]]&lt;br /&gt;
| up=[[HowTos]]&lt;br /&gt;
| next=[[Development:Missions|Edit Missions]]&lt;br /&gt;
}}&lt;br /&gt;
----&lt;br /&gt;
=Editing Campaigns=&lt;br /&gt;
&lt;br /&gt;
'''''Note:''' The information contained here is useful only to those willing to learn a minimal amount of python code (the language does not need to be learned, only the formatting restrictions imposed).  A GUI based campaign editor is in development, but work has stalled due to lack of time on the developer's part.  If anyone wishes to assist, please contact [[User:dandandaman|dandandaman]].''&lt;br /&gt;
&lt;br /&gt;
An example campaign can be found under the following [https://github.com/vegastrike/Assets-Production/blob/master/modules/campaigns.py link]&lt;br /&gt;
&lt;br /&gt;
To write a campaign, you'll require missions. The mission system is what is used by both the mission bbs, and the campaign. As a start, it is good to plan to use only the mission types available, as writing your own can be a pain, and requires a degree of proficiency with python and vegastrike which you may not have for a little while. If you are developing a campaign and do require something specific that isn't available, just ask, and we'll see what can be done.&lt;br /&gt;
&lt;br /&gt;
Since you are then limited to the missions we have, you'll want a nice reference about what each of the variables for each mission are ... and what they do. We don't actually have one ;-) but we have something that is almost as good: verify_missions.py At the bottom of this file is a list of the mission types, and slightly more descriptive labels for the arguments (their meanings should be relatively easy to glean from that info, but ask if you're unsure :-) ).&lt;br /&gt;
&lt;br /&gt;
That is unfortunately the easy part. The harder part (easy once you understand it) is then writing the campaign. The campaign for Vega Strike is stored in campaigns.py.&lt;br /&gt;
&lt;br /&gt;
Before we proceed I think it's best if you look at this stuff and try to understand a little bit yourself. At the top of campaigns.py is a whole bunch of text, the dialog and strings used by all the various campaign 'nodes.'&lt;br /&gt;
&lt;br /&gt;
A 'node' is a branch of a campaign, it is where fixers get created and the decision to accept or deny a mission occurs, or where the campaign is branched automatically (depending on some conditions that you might want to specify. I.e. you might have a branching storyline depending on whether a flight group still exists or not).&lt;br /&gt;
&lt;br /&gt;
Typically, each node contains a mission ... Cargo missions are a special case, they have a special type of node wrapper, and are probably the easiest to start with. Anyway, get yourself a text editor with syntax highlighting for python, and have a look at the nodes in the function ''LoadTestCampaign'' (this is a short test campaign that I made to demonstrate a bug).&lt;br /&gt;
&lt;br /&gt;
There was more documentation somewhere, but it appears to have been vanquished. So, ask the inevitable questions!&lt;br /&gt;
&lt;br /&gt;
=Campaign Structure=&lt;br /&gt;
&lt;br /&gt;
==Campaign Integration==&lt;br /&gt;
&lt;br /&gt;
You will need to create a new campaign python file (e.g. ''campaign_mycamp.py''), which then will be integrated into the ''campaigns.py'' with the following additions:&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
import campaign_mycampaign&lt;br /&gt;
&lt;br /&gt;
campaignsloaders = [ ...&lt;br /&gt;
  lambda:campaign_mycamp.LoadMyCampaign()&lt;br /&gt;
]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The basic structure of your new ''campaign_mycamp.py'' file will then be:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
import universe&lt;br /&gt;
import campaign_lib&lt;br /&gt;
from campaign_lib import *&lt;br /&gt;
&lt;br /&gt;
### define node dialogs&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
### define fixer sprites&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
def LoadMyCampaign():&lt;br /&gt;
&lt;br /&gt;
  ### define nodes&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  # savegame_variable (can't contain spaces)&lt;br /&gt;
  vs = Campaign(&amp;quot;campaign_mycamp&amp;quot;)&lt;br /&gt;
  # the starting node.&lt;br /&gt;
  vs.Init(FirstNode)&lt;br /&gt;
&lt;br /&gt;
  ### define node missions&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
  # finalize campaign definition&lt;br /&gt;
  return vs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Campaign Missions =&lt;br /&gt;
&lt;br /&gt;
==Nodes==&lt;br /&gt;
&lt;br /&gt;
There are 2 types of nodes:&lt;br /&gt;
* ''CampaignClickNode(args)'' - here you have to talk to a fixer and accept or reject the proposed mission.&lt;br /&gt;
* ''CampaignNode(args)'' - creates an action, like adding reward or adjusting a faction relation, without fixer intervention.&lt;br /&gt;
* ''CampaignChoiceNode(args)''&lt;br /&gt;
&lt;br /&gt;
Nodes must be initialized first:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
    ThisNode   = CampaignClickNode() # initialize the node&lt;br /&gt;
    ActionNode = CampaignNode()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The nodes are then connected with the last four arguments in the ''MakeMission'' function:&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;pre&amp;gt;MakeMission(vs, ... &lt;br /&gt;
    RejectNode, # If you reject the mission twice. &amp;quot;None&amp;quot; means that he continues asking you forever until you accept&lt;br /&gt;
    LoseNode, # Node if you lose the mission&lt;br /&gt;
    WinNode, # Node if you win the mission&lt;br /&gt;
    ThisNode) # The node for this mission &lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The complete mission statement and the different types of mission nodes that can be created are described in the following section. Further down, you will find the singular structure of the arguments.&lt;br /&gt;
&lt;br /&gt;
==MakeMission Node==&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;pre&amp;gt;MakeMission(savegame_variable, fixer_sprite, start_location, end_location, click_script, &lt;br /&gt;
mission_script, mission_arguments, completion_script, dialog_dictionary, reject_node, lose_node, &lt;br /&gt;
win_node, this_node)&amp;lt;/pre&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==MakeCargoMission Node==&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;pre&amp;gt;MakeCargoMission(savegame_variable, fixer_sprite, start_location, end_location, &lt;br /&gt;
click_script, mission_script, mission_arguments, completion_script, dialog_dictionary, &lt;br /&gt;
reject_node, lose_node, win_node, this_node)&amp;lt;/pre&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==MakeNoFailureCargoMission Node==&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;pre&amp;gt;MakeNoFailureCargoMission(savegame_variable, fixer_sprite, start_location, end_location, &lt;br /&gt;
click_script, mission_script, mission_arguments, completion_script, dialog_dictionary, &lt;br /&gt;
reject_node, lose_node, win_node, this_node)&amp;lt;/pre&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Init Node==&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;pre&amp;gt;NodeName.Init(savegame_variable, start_location, dialog_dictionary, fixer_sprite, &lt;br /&gt;
subnode_script, completion_script, next_node)&amp;lt;/pre&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Mission Arguments==&lt;br /&gt;
&lt;br /&gt;
* '''savegame_variable''' - usually ''vs''&lt;br /&gt;
* '''fixer_sprite''' - sprite file for the fixer in the form (sprite_path, display_name, full_screen_sprite), e.g. ''(&amp;quot;campaign/captain.sprite&amp;quot;,&amp;quot;Talk_To_The_Captain&amp;quot;,&amp;quot;campaign/heads/captain.sprite&amp;quot;)''&lt;br /&gt;
* '''start_location''' - a command for location checking containing a tuple with (sector/system, base), e.g. ''[InSystemCondition(&amp;quot;Crucible/Cephid_17&amp;quot;,&amp;quot;Serenity&amp;quot;)]''&lt;br /&gt;
* '''end_location''' - same format as start_location&lt;br /&gt;
* '''click_script''' - script to be run as you click on the fixer. A common use is to ''AddCredits()'' for the previous mission.&lt;br /&gt;
* '''mission_script''' - script to be run to start the mission (usually ''None'' if you don't have a script, but ambush is also common.)&lt;br /&gt;
* '''mission_arguments''' - depend on the mission. E.g. for cargo mission you will give the loaded cargo as arguments: ''(&amp;quot;Recycled_Plastics&amp;quot;,50,False)''&lt;br /&gt;
* '''completion_script''' - script to be set on completion (-1=Failure, 0=Not Accepted, 1=Succeed, 2=In progress), often just ''vs.name+&amp;quot;_mission&amp;quot;''&lt;br /&gt;
* '''dialog_dictionary''' - the lines that the fixer says: a dictionary with {dialog_type, dialog_lines_list}, see structure description further down&lt;br /&gt;
* '''reject_node''' - name of the node if you reject the mission twice. &amp;quot;None&amp;quot; means that fixer continues asking you forever until you accept&lt;br /&gt;
* '''lose_node''' - next node if you are unsuccessful in the mission&lt;br /&gt;
* '''win_node''' - next node if you successfully complete the mission&lt;br /&gt;
* '''this_node''' - name of the node for this mission, e.g. ''FirstNode''&lt;br /&gt;
&lt;br /&gt;
= Subnodes =&lt;br /&gt;
&lt;br /&gt;
* TrueSubnode&lt;br /&gt;
* GoToSubnode&lt;br /&gt;
* GoToSubnodeIfTrue&lt;br /&gt;
* TrueBackwardsSubnode&lt;br /&gt;
&lt;br /&gt;
= Conditions =&lt;br /&gt;
&lt;br /&gt;
* SaveVariableCondition&lt;br /&gt;
* HaveCredits&lt;br /&gt;
* InSystemCondition&lt;br /&gt;
* HasUndocked&lt;br /&gt;
* CargoSpaceCondition&lt;br /&gt;
* AtMostActiveMissionsCondition&lt;br /&gt;
* AtLeastActiveMissionsCondition&lt;br /&gt;
* OrCondition&lt;br /&gt;
* AndCondition&lt;br /&gt;
* InvertCondition&lt;br /&gt;
&lt;br /&gt;
= Scripts =&lt;br /&gt;
&lt;br /&gt;
Scripts and script arguments can be seen in ''data/modules/campaign_lib.py''.&lt;br /&gt;
The usual arguments are: (scriptarguments, nextscript), where the next script can be omitted and is nested as the last script argument.&lt;br /&gt;
&lt;br /&gt;
* AddCredits(numcreds,nextscript)&lt;br /&gt;
* AddCargo(name,num,missionflag,nextscript)&lt;br /&gt;
* RemoveCargo(name,num,missionflag,nextscript)&lt;br /&gt;
* SetSaveVariable(varname,varvalue,nextscript)&lt;br /&gt;
* IncSaveVariable(varname,nextscript)&lt;br /&gt;
* AddTechnology(technology,nextscript)&lt;br /&gt;
* AdjustRelation(us,them,change,nextscript)&lt;br /&gt;
* ClearFactionRecord(fac,newrelation,nextscript)&lt;br /&gt;
* ClearRecord(nextscript)&lt;br /&gt;
* PushRelation(faction,nextscript)&lt;br /&gt;
* PopRelation(faction,nextscript)&lt;br /&gt;
* LaunchWingmen(faction,shiptype,num,nextscript)&lt;br /&gt;
* ChangeSystemOwner(system,faction,nextscript)&lt;br /&gt;
* SaveVariableGreaterScript(var,val,nextscript)&lt;br /&gt;
* DisplayTextIfTrueScript(text,nextscript)&lt;br /&gt;
* RemoveCredits(numcreds,nextscript)&lt;br /&gt;
* SetCredits(numcreds,nextscript)&lt;br /&gt;
* PushCredits(nextscript)&lt;br /&gt;
* PopCredits(nextscript)&lt;br /&gt;
* PushNews(story,nextscript)&lt;br /&gt;
* LoadMission(name,missionname,missionargs,nextscript=None,briefing='',briefing_done='',vars=None,vars_done=None)&lt;br /&gt;
* AddSprite(name,sprite,pos,nextscript)&lt;br /&gt;
* AddPythonSprite(name,sprite,center_position,widthheight,text,python,nextscript)&lt;br /&gt;
* AddRemovingSprite&lt;br /&gt;
* AddConversationStoppingSprite&lt;br /&gt;
* GoToSubnodeIfTrue&lt;br /&gt;
* TrueSubnode&lt;br /&gt;
* TrueBackwardsSubnode&lt;br /&gt;
* GoToSubnode&lt;br /&gt;
&lt;br /&gt;
Remarks:&lt;br /&gt;
* relation is saved as two bidirectional values ranging from -0.5 to 1.0 in a variable &amp;quot;Relation_to_''factionname''&amp;quot; with two float values appended. One is the players relation to that faction, the second is the faction relation to the player.&lt;br /&gt;
&lt;br /&gt;
= Dialogs =&lt;br /&gt;
&lt;br /&gt;
The structure for the ''dialog_dictionary'' is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
dialog_dictionary = { &lt;br /&gt;
  &amp;quot;intro&amp;quot;:     [conversation],&lt;br /&gt;
  &amp;quot;reject1&amp;quot;:   [conversation],&lt;br /&gt;
  &amp;quot;reconsider&amp;quot;:[conversation],&lt;br /&gt;
  &amp;quot;reject2&amp;quot;:   [conversation],&lt;br /&gt;
  &amp;quot;accept&amp;quot;:    [conversation],&lt;br /&gt;
  &amp;quot;accept2&amp;quot;:   [conversation],&lt;br /&gt;
  &amp;quot;reminder&amp;quot;:  [conversation],&lt;br /&gt;
  &amp;quot;failure&amp;quot;:   [conversation],&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
with:&lt;br /&gt;
conversation = (speaker1, line1, ...), (speaker2, line1, ...), ..., soundfile&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For Init Nodes you will supply only one ''[conversation]''.&lt;br /&gt;
&lt;br /&gt;
= Examples =&lt;br /&gt;
&lt;br /&gt;
==The first major campaign written (Jenek)==&lt;br /&gt;
&lt;br /&gt;
See also the [http://forums.vega-strike.org/viewtopic.php?t=3246 forum thread] (comments &amp;amp; feedback) when this mission was first put into SVN.&lt;br /&gt;
{{Fixme}} Improve/expand it?&lt;br /&gt;
&lt;br /&gt;
==Ending Node with AddCredits and AdjustRelation==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
    FinalNode.Init(vs, # savegame variable&lt;br /&gt;
        [], #start location&lt;br /&gt;
        [], #dialog&lt;br /&gt;
        None, # fixer sprite&lt;br /&gt;
        TrueSubnode(AddCredits(100000,AdjustRelation(&amp;quot;privateer&amp;quot;,&amp;quot;pirates&amp;quot;,0.01))), # subnode script&lt;br /&gt;
        None, # completion script&lt;br /&gt;
        [CampaignEndNode(vs)]) # continue with next mission&lt;br /&gt;
&amp;lt;/pre&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=See Also=&lt;br /&gt;
* [[Development:Missions|Editing Missions]]&lt;br /&gt;
* [[HowTo:Add_Conversations|Adding Conversations]]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
{{NAV_Manual |&lt;br /&gt;
| previous=[[HowTo:Edit faction relationships|Edit faction relationships]]&lt;br /&gt;
| up=[[HowTos]]&lt;br /&gt;
| next=[[Development:Missions|Edit Missions]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:HowTos|Edit Campaigns]]&lt;br /&gt;
[[Category:Development|Edit Campaigns]]&lt;/div&gt;</summary>
		<author><name>Nabaco</name></author>	</entry>

	</feed>