Shadowrun: Awakened 29 September 2011 - Build 871
seqmission.py
Go to the documentation of this file.
00001 global game, character
00002 
00003 #Add a new mission
00004 m = game.addmission()
00005 
00006 #Create the top objective - the root of the tree
00007 obj = object('Sra.MissionObjective', game)
00008 obj.tag = 'SuperMission'
00009 m.objectivetree = obj
00010 
00011 #Create new counter objective - means something must happen X times
00012 objSequence = object('Sra.Obj_Sequence', game)
00013 objSequence.Tag = 'DoTheseInOrder'
00014 
00015 #List of sequence sub-objectives
00016 subs = []
00017 
00018 #If areas has items and character exists
00019 if game.areas and character:
00020     charID = character.uniqueID
00021     for area in game.areas:
00022         #Create new area objective
00023         objArea = object('Sra.Obj_Area', game)
00024         objArea.Tag = 'AreaObjective'
00025         #Specify that character is the who for the objective
00026         objArea.WhoIds = [charID]
00027         #Specify that the first area is the target area
00028         objArea.AreaIds = [area.ID]
00029         #add to sub-objective list
00030         subs.append(objArea)
00031         
00032 objSequence.subObjectives = subs
00033 
00034 def customTest(self, source, eventName, params):
00035     #print self.Tag, source.uniqueid, eventName, str(params)
00036     #print self.ExtraInfo
00037     if self.ExtraInfo['count'] > 0:
00038         self.ExtraInfo['count'] = self.ExtraInfo['count'] - 1
00039         return 'Incomplete'
00040     return 'Complete'
00041 
00042 #Create a custom objective with customTest as the callback
00043 customObj = object('Sra.Obj_Custom')
00044 customObj.EventNames = ['Entered', 'Exited']
00045 customObj.Callback = customTest
00046 customObj.ExtraInfo = {'count': 3, 'val2': 'a value'}
00047 
00048 #Create an inventory object
00049 objInventory = object('Sra.Obj_Inventory')
00050 objInventory.WhoID = character.uniqueID
00051 objInventory.ItemID = 'Red_Ball'
00052 objInventory.EventName = 'DropItem'
00053 
00054 #Set root objective's sub-objectives to our list
00055 obj.subobjectives = [objSequence, customObj, objInventory]

Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.

GNU Lesser General Public License 3 Sourceforge.net