Difference between revisions of "HowTo:Edit Missions:Python:Summary"

From VsWiki
Jump to: navigation, search
(added categories)
m
Line 6: Line 6:
 
----
 
----
  
* Missions must inherit from '''Director.Mission'''
+
* Missions must inherit from <code>Director.Mission</code>
* AI's must inherit from '''VS.PythonAI'''
+
* AI's must inherit from <code>VS.PythonAI</code>
* Missions must have an '''__init__ '''function with any number of arguments that calls '''Director.Mission.__init__ (self)'''; to trigger the C++ binding  
+
* Missions must have an <code>__init__</code> function with any number of arguments that calls <code>Director.Mission.__init__ (self);</code> to trigger the C++ binding  
* AI's must have an '''init(self, un)''' function with those exact 2 arguments... the second one is the parent Unit. I don't recommend you save the unit currently--I'm not sure if it will garbage collect the unit in that case... just call the '''self.GetParent()''' function as the AI script.  
+
* AI's must have an <code>init(self, un)</code> function with those exact 2 arguments... the second one is the parent <code>Unit</code>. I don't recommend you save the unit currently--I'm not sure if it will garbage collect the unit in that case... just call the <code>self.GetParent()</code> function as the AI script.  
* Both AI's and Missions may have an '''Execute(self)''' function that does somethign each frame depending on the disired result.  
+
* Both AI's and Missions may have an <code>Execute(self)</code> function that does something each frame depending on the disired result.  
* Missions may have a '''Pickle''' and '''Unpickle''' function in order to save and load the state of a campaign (this can be incredibly complex!)
+
* Missions may have a <code>Pickle</code> and <code>Unpickle</code> function in order to save and load the state of a campaign (this can be incredibly complex!)
 
----
 
----
 
{{NAV_Manual |
 
{{NAV_Manual |
Line 18: Line 18:
 
| next=[[HowTo:Edit_Missions:Writing_addon_adventures|Writing AddOn Adventures]]
 
| next=[[HowTo:Edit_Missions:Writing_addon_adventures|Writing AddOn Adventures]]
 
}}
 
}}
[[Category:HowTo|Edit Missions:Python:Summary]] [[Category:Development|Edit Missions:Python:Summary]]
+
[[Category:HowTos|Edit Missions:Python:Summary]]
 +
[[Category:Development|Edit Missions:Python:Summary]]

Revision as of 19:22, 28 May 2005

arrow_left.png Python Bindings arrow_up.png Edit Missions Writing AddOn Adventures arrow_right.png

  • Missions must inherit from Director.Mission
  • AI's must inherit from VS.PythonAI
  • Missions must have an __init__ function with any number of arguments that calls Director.Mission.__init__ (self); to trigger the C++ binding
  • AI's must have an init(self, un) function with those exact 2 arguments... the second one is the parent Unit. I don't recommend you save the unit currently--I'm not sure if it will garbage collect the unit in that case... just call the self.GetParent() function as the AI script.
  • Both AI's and Missions may have an Execute(self) function that does something each frame depending on the disired result.
  • Missions may have a Pickle and Unpickle function in order to save and load the state of a campaign (this can be incredibly complex!)

arrow_left.png Python Bindings arrow_up.png Edit Missions Writing AddOn Adventures arrow_right.png