Shadowrun: Awakened 29 September 2011 - Build 871
mission1.py
Go to the documentation of this file.
00001 global game, character, currenttarget
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 #List of top-level sub-objectives
00012 subs = []
00013 
00014 #Get list of areas in current level
00015 areas = game.areas
00016 
00017 #If areas has items and character exists
00018 if areas and character:
00019     #Create new area objective
00020     objArea = object('Sra.Obj_Area', game)
00021     objArea.Tag = 'AreaObjective'
00022     #Specify that character is the who for the objective
00023     #objArea.WhoIds = [character.uniqueID]
00024     objArea.FactionName = 'Lonestar'
00025     #Specify that the first area is the target area
00026     objArea.AreaIds = [areas[0].ID]
00027     #add to sub-objective list
00028     subs.append(objArea)
00029 
00030 #Create new counter objective - means something must happen X times
00031 objCount = object('Sra.Obj_Counter', game)
00032 objCount.Tag = 'DoThis5Times'
00033 #Set the required times it must happen
00034 objCount.CountTarget = 5
00035 subs.append(objCount)
00036 
00037 #Create new talkto objective - means someone must talk to a given npc
00038 objTalk = object('Sra.Obj_TalkTo', game)
00039 objTalk.tag = 'TalkToTarget'
00040 objTalk.FactionName = 'Red_Team'
00041 #If player is targeting someone, set that npc in the objective
00042 if currenttarget:
00043     objTalk.npcId = currenttarget.uniqueID
00044 else:
00045     print 'No NPC targeted, TalkTo objective is generic'
00046 #Set counter objective's sub-objectives to the talkto objective
00047 objCount.subObjectives = [objTalk]
00048 
00049 objDie = object('Sra.Obj_Kill', game)
00050 objDie.FactionName = 'Red_Team'
00051 objDie.KOAcceptable = True
00052 
00053 objNot = object('Sra.Obj_Not', game)
00054 objNot.subObjectives = [objDie]
00055 subs.append(objNot)
00056 
00057 #Set root objective's sub-objectives to our list
00058 obj.subobjectives = subs

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