Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
escort_local Class Reference
Inheritance diagram for escort_local:

Public Member Functions

def __init__
 
def SetVarValue
 
def SuccessMission
 
def PayMission
 
def FailMission
 
def NoEnemiesInArea
 
def GenerateEnemies
 
def GenerateDefendee
 
def Execute
 
def initbriefing
 
def loopbriefing
 
def endbriefing
 

Data Fields

 greetingText
 
 dedicatedattack
 
 arrived
 
 todock
 
 launchedfriend
 
 protectivefaction
 
 var_to_set
 
 quantity
 
 mplay
 
 gametime
 
 waves
 
 incoming
 
 dynatkfg
 
 dynatktype
 
 dyndeffg
 
 dyndeftype
 
 attackers
 
 objective
 
 targetiter
 
 ship_check_count
 
 faction
 
 jp
 
 cred
 
 savedquantity
 
 distance_from_base
 
 defendee
 
 difficulty
 
 you
 
 respawn
 
 successdelay
 
 objectivezero
 
 adjsys
 

Detailed Description

Definition at line 12 of file escort_local.py.

Constructor & Destructor Documentation

def __init__ (   self,
  factionname,
  numsystemsaway,
  enemyquantity,
  waves,
  distance_from_base,
  creds,
  incoming,
  protectivefactionname = '',
  jumps = (),
  var_to_set = '',
  dynamic_flightgroup = '',
  dynamic_type = '',
  dynamic_defend_fg = '',
  dynamic_defend_type = '',
  greetingText = ['Escort: give up while you still can...',
  If,
  you,
  let,
  us,
  ravage,
  our,
  target,
  then,
  we,
  grant,
  you,
  passage,
  today 
)

Definition at line 13 of file escort_local.py.

13 
14  def __init__ (self,factionname,numsystemsaway, enemyquantity, waves, distance_from_base, creds, incoming, protectivefactionname='',jumps=(),var_to_set='',dynamic_flightgroup='',dynamic_type='', dynamic_defend_fg='',dynamic_defend_type='',greetingText=['Escort: give up while you still can...','If you let us ravage our target then we grant you passage today.']):
15  Director.Mission.__init__(self)
16  self.greetingText=greetingText
18  if (VS.GetRelation(factionname,protectivefactionname)>=0.0):
20  self.arrived=0
21  self.todock=VS.Unit()
23  self.protectivefaction = protectivefactionname
24  self.var_to_set=var_to_set
25  self.quantity=0
26  self.mplay="all"
27  self.gametime=VS.GetGameTime()
28  self.waves=waves
29  self.incoming=incoming
30  self.dynatkfg = dynamic_flightgroup
31  self.dynatktype = dynamic_type
32  self.dyndeffg = dynamic_defend_fg
33  self.dyndeftype = dynamic_defend_type
34  self.attackers = []
35  self.objective= 0
36  self.targetiter = 0
38  self.faction = factionname
39  self.jp=VS.Unit()
40  self.cred=creds
41  self.quantity=enemyquantity
42  self.savedquantity=enemyquantity
43  self.distance_from_base=distance_from_base
44  self.defendee=VS.Unit()
45  self.difficulty=1
46  self.you=VS.getPlayer()
47  self.respawn=0
48  name = self.you.getName ()
49  self.successdelay=0
50  self.objectivezero=0
52  self.adjsys = go_to_adjacent_systems(self.you,numsystemsaway,jumps)
53  VS.IOmessage (0,"escort mission",self.mplay,"Your mission is as follows:")
54  self.adjsys.Print("You are in the %s system,","Proceed swiftly to %s.","Your arrival point is %s.","escort mission",1)

Member Function Documentation

def endbriefing (   self)

Definition at line 233 of file escort_local.py.

234  def endbriefing(self):
235  print "ending briefing"
236 
def Execute (   self)

Definition at line 178 of file escort_local.py.

References directions_mission.adjsys, bounty.adjsys, defend.adjsys, escort_local.adjsys, cargo_mission.adjsys, defend.arrived, escort_local.arrived, directions_mission.arrived, bounty.arrived, cargo_mission.arrived, defend.attackers, escort_local.attackers, defend.dedicatedattack, escort_local.dedicatedattack, defend.defendee, escort_local.defendee, defend.distance_from_base, escort_local.distance_from_base, defend.FailMission(), escort_local.FailMission(), escort_local.gametime, escort_local.GenerateDefendee(), defend.GenerateEnemies(), escort_local.GenerateEnemies(), escort_local.incoming, escort_local.jp, escort_local.launchedfriend, defend.mplay, bounty.mplay, escort_local.mplay, directions_mission.mplay, cargo_mission.mplay, defend.NoEnemiesInArea(), escort_local.NoEnemiesInArea(), escort_local.PayMission(), defend.quantity, escort_local.quantity, cargo_mission.quantity, defend.savedquantity, escort_local.savedquantity, defend.SetVarValue(), escort_local.SetVarValue(), defend.ship_check_count, escort_local.ship_check_count, escort_local.successdelay, cleansweep.SuccessMission(), defend.SuccessMission(), escort_local.SuccessMission(), defend.targetiter, escort_local.targetiter, escort_local.todock, defend.waves, escort_local.waves, directions_mission.you, go_to_adjacent_systems.you, bounty.you, defend.you, escort_local.you, and cargo_mission.you.

179  def Execute (self):
180  if (self.successdelay):
181  if (self.defendee.getUnitSystemFile()!=self.you.getUnitSystemFile() or VS.GetGameTime()-self.successdelay>120 or (self.incoming and self.todock.isNull()==False and self.you.isNull()==False and self.you.getDistance(self.todock)<330)):
182  if (self.defendee):
183  self.PayMission()
184  else:
185  self.FailMission()
186  return #nothing more happens inside this control
187  if (self.you.isNull() or (self.launchedfriend and self.defendee.isNull())):
188  VS.IOmessage (0,"escort mission",self.mplay,"#ff0000You were unable to arrive in time to help. Mission failed.")
189  self.SetVarValue(-1)
190  VS.terminateMission(0)
191  return
192  if (not self.adjsys.Execute()):
193  return
194  if (not self.arrived):
195  self.arrived=1
196  if (self.launchedfriend==0 and not self.incoming):
197  self.defendee=self.GenerateDefendee()
198  self.launchedfriend=1
199  self.adjsys=go_somewhere_significant (self.you,0,self.distance_from_base,0)
200  self.adjsys.Print ("You must visit the %s","escort mission","docked around the %s", 0)
201  self.jp=self.adjsys.SignificantUnit()
202  else:
203  if (self.launchedfriend==0):
204  self.defendee=self.GenerateDefendee()
205  self.launchedfriend=1
206  if (self.defendee.isNull ()):
207  self.FailMission(you)
208  return
209  else:
210  self.defendee.setFlightgroupLeader(self.you)
211  if (VS.GetGameTime()-self.gametime>10):
212  self.defendee.setFgDirective('F')
213  if (self.quantity>0):
214  self.GenerateEnemies (self.defendee,self.you)
215  if (self.ship_check_count==0 and self.dedicatedattack):
216  if (self.targetiter>=len(self.attackers)):
217  self.targetiter=0
218  else:
219  un = self.attackers[self.targetiter]
220  if (not un.isNull()):
221  un.SetTarget (self.defendee)
222  self.targetiter=self.targetiter+1
223  if (self.NoEnemiesInArea (self.defendee)):
224  if (self.waves>0):
225  self.quantity=self.savedquantity
226  self.waves-=1
227  else:
self.SuccessMission()
def FailMission (   self)

Definition at line 90 of file escort_local.py.

References bounty.cred, defend.cred, escort_local.cred, cargo_mission.cred, SystemInformation.faction, ambush.faction, bounty.faction, defend.faction, ShipTracker.faction, escort_local.faction, cargo_mission.faction, go_to_adjacent_systems.faction, Launch.faction, ClearFactionRecord.faction, PushRelation.faction, PopRelation.faction, LaunchWingmen.faction, ChangeSystemOwner.faction, ChangeShipOwners.faction, defend.mplay, bounty.mplay, escort_local.mplay, directions_mission.mplay, cargo_mission.mplay, defend.SetVarValue(), and escort_local.SetVarValue().

90 
91  def FailMission (self):
92  self.you.addCredits (-self.cred)
93  VS.AdjustRelation(self.you.getFactionName(),self.faction,-.02,1)
94  self.SetVarValue(-1)
95  VS.IOmessage (0,"escort mission",self.mplay,"You Allowed the base you were to protect to be destroyed.")
96  VS.IOmessage (0,"escort mission",self.mplay,"You are a failure to your race!")
97  VS.IOmessage (1,"escort mission",self.mplay,"We have contacted your bank and informed them of your failure to deliver on credit. They have removed a number of your credits for this inconvenience. Let this serve as a lesson.")
VS.terminateMission(0)
def GenerateDefendee (   self)

Definition at line 154 of file escort_local.py.

References defend.dyndeffg, escort_local.dyndeffg, escort_local.dyndeftype, faction_ships.getRandomFighter(), defend.protectivefaction, escort_local.protectivefaction, locale.str(), directions_mission.you, go_to_adjacent_systems.you, bounty.you, defend.you, escort_local.you, and cargo_mission.you.

155  def GenerateDefendee(self):
156  L=launch.Launch()
157  L.fg ="Escort"
158  L.faction=self.protectivefaction
159  if (self.dyndeffg=='' and self.dyndeftype==''):
161  else:
162  L.type = self.dyndeftype
163  L.dynfg = self.dyndeffg
164  import escort_mission
165  escort_mission.escort_num+=1
166  L.fgappend = str(escort_mission.escort_num)
167  L.ai = "default"
168  L.num=1
169  L.minradius = 2.0*self.you.rSize()
170  L.maxradius = 3.0*self.you.rSize()
171  L.forcetype=True
172  escortee=L.launch(self.you)
173  escortee.upgrade("jump_drive",0,0,0,1)
174  escortee.setFlightgroupLeader(self.you)
175  escortee.setFgDirective('F')
176  escortee.setMissionRelevant()
177  return escortee
def GenerateEnemies (   self,
  jp,
  you 
)

Definition at line 113 of file escort_local.py.

References defend.attackers, escort_local.attackers, defend.dedicatedattack, escort_local.dedicatedattack, defend.dynatkfg, escort_local.dynatkfg, defend.dynatktype, escort_local.dynatktype, ambush.faction, SystemInformation.faction, bounty.faction, defend.faction, ShipTracker.faction, escort_local.faction, cargo_mission.faction, go_to_adjacent_systems.faction, Launch.faction, ClearFactionRecord.faction, PushRelation.faction, PopRelation.faction, LaunchWingmen.faction, ChangeSystemOwner.faction, ChangeShipOwners.faction, faction_ships.getRandomFighter(), unit.getUnitFullName(), universe.greet(), escort_local.greetingText, defend.greetingText, ambush.greetingText, bounty.greetingText, defend.mplay, bounty.mplay, escort_local.mplay, directions_mission.mplay, cargo_mission.mplay, defend.objective, escort_local.objective, escort_local.objectivezero, defend.quantity, escort_local.quantity, cargo_mission.quantity, defend.respawn, escort_local.respawn, and locale.str().

114  def GenerateEnemies (self,jp,you):
115  count=0
116  self.objectivezero=VS.addObjective ("Protect %s from %s" % (unit.getUnitFullName(jp),self.faction))
117  self.objective = VS.addObjective ("Destroy All %s Hostiles" % self.faction)
118  VS.setCompleteness(self.objective,0.0)
119  print "quantity "+str(self.quantity)
120  while (count<self.quantity):
121  L = launch.Launch()
122  L.fg="Shadow";L.dynfg=self.dynatkfg;
123  if (self.dynatktype==''):
125  else:
126  L.type=self.dynatktype
127  L.ai="default";L.num=1;L.minradius=20000.0;L.maxradius=25000.0
128  try:
129  L.minradius*=faction_ships.launch_distance_factor
130  L.maxradius*=faction_ships.launch_distance_factor
131  except:
132  pass
133  L.faction=self.faction
134  launched=L.launch(you)
135  if (count==0):
136  self.you.SetTarget(launched)
137 
138  if (1):
139  launched.SetTarget (jp)
140  else:
141  launched.SetTarget (you)
142  if (self.dedicatedattack):
143  launched.setFgDirective('B')
144  self.attackers += [ launched ]
145  count+=1
146  if (self.respawn==0 and len(self.attackers)>0):
147  self.respawn=1
148  import universe
149  universe.greet(self.greetingText,self.attackers[0],you);
150  else:
151  VS.IOmessage (0,"escort mission",self.mplay,"Eliminate all %s ships here" % self.faction)
152  VS.IOmessage (0,"escort mission",self.mplay,"You must protect %s." % unit.getUnitFullName(jp))
153 
self.quantity=0
def initbriefing (   self)

Definition at line 228 of file escort_local.py.

229  def initbriefing(self):
print "ending briefing"
def loopbriefing (   self)

Definition at line 230 of file escort_local.py.

231  def loopbriefing(self):
232  print "loop briefing"
Briefing.terminate();
def NoEnemiesInArea (   self,
  jp 
)

Definition at line 98 of file escort_local.py.

References defend.attackers, escort_local.attackers, unit.getUnitFullName(), defend.objective, escort_local.objective, defend.ship_check_count, and escort_local.ship_check_count.

98 
99  def NoEnemiesInArea (self,jp):
100  if (self.adjsys.DestinationSystem()!=VS.getSystemFile()):
101  return 0
102  if (self.ship_check_count>=len(self.attackers)):
103  VS.setCompleteness(self.objective,1.0)
104  return 1
105  un= self.attackers[self.ship_check_count]
106  self.ship_check_count+=1
107  if (un.isNull() or (un.GetHullPercent()<.7 and self.defendee.getDistance(un)>7000)):
108  return 0
109  else:
110  VS.setObjective(self.objective,"Destroy the %s"%unit.getUnitFullName(un))
111  self.ship_check_count=0
112  return 0
def PayMission (   self)

Definition at line 82 of file escort_local.py.

References bounty.cred, defend.cred, escort_local.cred, cargo_mission.cred, SystemInformation.faction, ambush.faction, bounty.faction, defend.faction, ShipTracker.faction, escort_local.faction, cargo_mission.faction, go_to_adjacent_systems.faction, Launch.faction, ClearFactionRecord.faction, PushRelation.faction, PopRelation.faction, LaunchWingmen.faction, ChangeSystemOwner.faction, ChangeShipOwners.faction, defend.mplay, escort_local.mplay, bounty.mplay, directions_mission.mplay, cargo_mission.mplay, defend.SetVarValue(), and escort_local.SetVarValue().

82 
83  def PayMission(self):
84  VS.AdjustRelation(self.you.getFactionName(),self.faction,.03,1)
85  self.SetVarValue(1)
86  if (self.cred>0):
87  self.you.addCredits (self.cred)
88  VS.IOmessage(0,"escort mission",self.mplay,"Excellent work pilot! Your effort has thwarted the foe!")
89  VS.IOmessage(0,"escort mission",self.mplay,"You have been rewarded for your effort as agreed.")
VS.terminateMission(1)
def SetVarValue (   self,
  value 
)

Definition at line 55 of file escort_local.py.

References defend.var_to_set, escort_local.var_to_set, bounty.var_to_set, and cargo_mission.var_to_set.

55 
56  def SetVarValue (self,value):
57  if (self.var_to_set!=''):
quest.removeQuest (self.you.isPlayerStarship(),self.var_to_set,value)
def SuccessMission (   self)

Definition at line 58 of file escort_local.py.

References defend.defendee, escort_local.defendee, unit.getSignificant(), unit.getUnitFullName(), escort_local.incoming, escort_local.objectivezero, vsrandom.randrange(), escort_local.successdelay, and escort_local.todock.

58 
59  def SuccessMission (self):
60  self.defendee.setFgDirective('b')
61  self.defendee.setFlightgroupLeader(self.defendee)
62  if (self.incoming):
63  import unit
65  if (un.getName()==self.defendee.getName()):
67  if (un.getName()==self.defendee.getName()):
69  if (un.getName()==self.defendee.getName()):
71  if (un.getName()==self.defendee.getName()):
73  if (un.getName()!=self.defendee.getName()):
74  self.defendee.performDockingOperations(un,0)
75  #print "docking with "+un.getName()
76  self.todock=un
77  VS.setObjective (self.objectivezero,"Escort To %s" % unit.getUnitFullName(un))
78  else:
79  self.defendee.ActivateJumpDrive(0)
80  self.defendee.SetTarget(self.adjsys.SignificantUnit())
81  self.successdelay=VS.GetGameTime()+1

Field Documentation

adjsys

Definition at line 51 of file escort_local.py.

arrived

Definition at line 19 of file escort_local.py.

attackers

Definition at line 33 of file escort_local.py.

cred

Definition at line 39 of file escort_local.py.

dedicatedattack

Definition at line 16 of file escort_local.py.

defendee

Definition at line 43 of file escort_local.py.

difficulty

Definition at line 44 of file escort_local.py.

distance_from_base

Definition at line 42 of file escort_local.py.

dynatkfg

Definition at line 29 of file escort_local.py.

dynatktype

Definition at line 30 of file escort_local.py.

dyndeffg

Definition at line 31 of file escort_local.py.

dyndeftype

Definition at line 32 of file escort_local.py.

faction

Definition at line 37 of file escort_local.py.

gametime

Definition at line 26 of file escort_local.py.

greetingText

Definition at line 15 of file escort_local.py.

incoming

Definition at line 28 of file escort_local.py.

jp

Definition at line 38 of file escort_local.py.

launchedfriend

Definition at line 21 of file escort_local.py.

mplay

Definition at line 25 of file escort_local.py.

objective

Definition at line 34 of file escort_local.py.

objectivezero

Definition at line 49 of file escort_local.py.

protectivefaction

Definition at line 22 of file escort_local.py.

quantity

Definition at line 24 of file escort_local.py.

respawn

Definition at line 46 of file escort_local.py.

savedquantity

Definition at line 41 of file escort_local.py.

ship_check_count

Definition at line 36 of file escort_local.py.

successdelay

Definition at line 48 of file escort_local.py.

targetiter

Definition at line 35 of file escort_local.py.

todock

Definition at line 20 of file escort_local.py.

var_to_set

Definition at line 23 of file escort_local.py.

waves

Definition at line 27 of file escort_local.py.

you

Definition at line 45 of file escort_local.py.


The documentation for this class was generated from the following file: