def FriendlyLaunch(self): self.havelaunched=1 import launch L=launch.Launch() L.fg="Shadow" if(self.dyntype==""): import faction_ships self.dyntype=faction_ships.getRandomFighter(self.faction) L.type=self.dyntype L.dyntype=self.dyntype L.num=self.numenemies L.faction=self.faction L.minradius=3000 L.maxradius=4000 try: import faction_ships L.minradius*=faction_ships.launch_distance_factor L.maxradius*=faction_ships.launch_distance_factor except: pass you=VS.getPlayerX(self.cp) friendly=L.launch(you) import universe universe.greet(self.altGreetingText,friendly,you);
def LaunchAlly(self): import launch import faction_ships import universe L = launch.Launch() L.faction=self.friendlyfaction L.fg="Patrol_Wing" L.dynfg="" L.minradius=3000.0 L.maxradius=4000.0 try: L.minradius*=faction_ships.launch_distance_factor L.maxradius*=faction_ships.launch_distance_factor except: pass L.num=1 L.ai="default" L.type = faction_ships.getRandomCapitol(self.friendlyfaction) self.ally = L.launch(self.you) self.ally.setMissionRelevant() self.allyobj=VS.addObjective("Protect the %s"%unit.getUnitFullName(self.ally)) L.type = faction_ships.getRandomFighter(self.friendlyfaction) import vsrandom L.num=vsrandom.randrange(3,6) L.launch(self.you) universe.greet(self.allygreetingtext,self.ally,self.you)
def LaunchAlly(self): import launch import faction_ships import universe L = launch.Launch() L.faction=self.friendlyfaction L.fg="Patrol_Wing" L.dynfg="" L.minradius=3000.0 L.maxradius=4000.0 try: L.minradius*=faction_ships.launch_distance_factor L.maxradius*=faction_ships.launch_distance_factor except: pass L.num=1 L.ai="default" L.type = faction_ships.getRandomCapitol(self.friendlyfaction) self.allyobj=VS.addObjective("Protect the %s"%L.type) self.ally = L.launch(self.you) L.type = faction_ships.getRandomFighter(self.friendlyfaction) import vsrandom L.num=vsrandom.randrange(3,6) L.launch(self.you) universe.greet(self.allygreetingtext,self.ally,self.you)
def Execute(self): escort_mission.escort_mission.Execute(self) sys = self.escortee.getUnitSystemFile() if sys in self.alternatesystems: for i in range(len(self.alternatesystems)): if sys==self.alternatesystems[i]: import quest quest.removeQuest(self.cp,self.alternatevariable,i) quest.removeQuest(self.cp,self.var_to_set,-1) import VS import launch L = launch.Launch() L.fg="Escorts" L.faction=self.alternatefactions[i] L.dynfg=self.alternateflightgroups[i] L.type=self.alternatetypes[i] L.ai="default" L.num=6 L.minradius=3000.0 L.maxradius=4000.0 try: L.minradius*=faction_ships.launch_distance_factor L.minradius*=faction_ships.launch_distance_factor except: pass launched=L.launch(self.escortee) self.escortee.setFgDirective('f') self.escortee.setFlightgroupLeader(launched) self.escortee.setFactionName(self.alternatefactions[i]) import universe universe.greet(self.alternategreeting[i],launched,VS.getPlayerX(self.cp)) VS.terminateMission(1) return
def FriendlyLaunch(self): self.havelaunched = 1 import launch L = launch.Launch() L.fg = "Shadow" if (self.dyntype == ""): import faction_ships self.dyntype = faction_ships.getRandomFighter(self.faction) L.type = self.dyntype L.dyntype = self.dyntype L.num = self.numenemies L.faction = self.faction L.minradius = 3000 L.maxradius = 4000 try: import faction_ships L.minradius *= faction_ships.launch_distance_factor L.maxradius *= faction_ships.launch_distance_factor except: pass you = VS.getPlayerX(self.cp) friendly = L.launch(you) import universe universe.greet(self.altGreetingText, friendly, you)
def Execute(self): escort_mission.escort_mission.Execute(self) sys = self.escortee.getUnitSystemFile() if sys in self.alternatesystems: for i in range(len(self.alternatesystems)): if sys == self.alternatesystems[i]: import quest quest.removeQuest(self.cp, self.alternatevariable, i) quest.removeQuest(self.cp, self.var_to_set, -1) import VS import launch L = launch.Launch() L.fg = "Escorts" L.faction = self.alternatefactions[i] L.dynfg = self.alternateflightgroups[i] L.type = self.alternatetypes[i] L.ai = "default" L.num = 6 L.minradius = 3000.0 L.maxradius = 4000.0 try: L.minradius *= faction_ships.launch_distance_factor L.minradius *= faction_ships.launch_distance_factor except: pass launched = L.launch(self.escortee) self.escortee.setFgDirective('f') self.escortee.setFlightgroupLeader(launched) self.escortee.setFactionName(self.alternatefactions[i]) import universe universe.greet(self.alternategreeting[i], launched, VS.getPlayerX(self.cp)) VS.terminateMission(1) return
def Launch(self,you): if (self.havelaunched==0): if (type(self.numenemies)==type(1)): self.numenemies=(self.numenemies,) self.faction=(self.faction,) self.dyntype=(self.dyntype,) self.dynfg=(self.dynfg,) if (type(self.AdjustFaction)!=type( () ) and type (self.AdjustFaction)!=type([])): self.AdjustFaction=(self.AdjustFaction,) for i in xrange(len(self.faction)): numenemies=self.numenemies[i] faction=self.faction[i] for z in xrange(numenemies): AdjustFaction=self.AdjustFaction[-1] if (i<len(self.AdjustFaction)): AdjustFaction=self.AdjustFaction[i] dynfg="" if (len(self.dynfg)>i): dynfg=self.dynfg[i] dyntype="" if (len(self.dyntype)>i): dyntype=self.dyntype[i] print 'Ambush: Launch ships!' self.havelaunched=1 L=launch.Launch() L.fg="Shadow" if (dyntype==""): dyntype=faction_ships.getRandomFighter(faction) L.dynfg=dynfg L.type=dyntype L.num=1 L.fgappend="X" L.minradius=6000 L.maxradius=8000 try: L.minradius*=faction_ships.launch_distance_factor L.maxradius*=faction_ships.launch_distance_factor except: pass L.faction=faction enemy=L.launch(you) lead=enemy.getFlightgroupLeader() enemy.SetTarget(you) if (lead): lead.SetTarget(you) else: enemy.setFlightgroupLeader(enemy) enemy.setFgDirective("A.") self.enemy=lead rel=VS.GetRelation(faction,"privateer") if (AdjustFaction and rel>=0): VS.AdjustRelation(faction,"privateer",-.02-rel,1.0) rel=VS.GetRelation("privateer",faction) VS.AdjustRelation("privateer",faction,-.02-rel,1.0) if (i==len(self.faction)-1 and z==0): universe.greet(self.greetingText,enemy,you) #print "launchin" print 'Ambush: Ships have been launched. Exiting...'
def GenerateEnemies(self, jp, you): count = 0 VS.addObjective("Protect %s from %s" % (jp.getName(), self.faction)) self.objective = VS.addObjective( "Destroy All %s Hostiles" % self.faction) VS.setCompleteness(self.objective, 0.0) debug.info("quantity "+str(self.quantity)) while (count < self.quantity): L = launch.Launch() if self.dynatkfg == "": atkfg = "Shadow" else: atkfg = self.dynatkfg L.fg = atkfg L.dynfg = "" if count == 0: L.fgappend = "" else: L.fgappend = "_"+str(count) if (self.dynatktype == ''): L.type = faction_ships.getRandomFighter(self.faction) else: L.type = self.dynatktype L.ai = "default" L.num = 1 L.minradius = 20000.0 L.maxradius = 25000.0 try: L.minradius *= faction_ships.launch_distance_factor L.maxradius *= faction_ships.launch_distance_factor except: pass L.faction = self.faction launched = L.launch(you) if (count == 0): self.you.SetTarget(launched) if (1): launched.SetTarget(jp) else: launched.SetTarget(you) if (self.dedicatedattack): launched.setFgDirective('B') self.attackers += [launched] count += 1 if (self.respawn == 0 and len(self.attackers) > 0): self.respawn = 1 import universe universe.greet( self.greetingText, self.attackers[0], you, self.dyndeffg) else: VS.IOmessage(0, "escort mission", self.mplay, "Eliminate all %s ships here" % self.faction) VS.IOmessage(0, "escort mission", self.mplay, "You must protect %s." % jp.getName()) self.quantity = 0
def GenerateEnemies(self, jp, you): count = 0 VS.addObjective("Protect %s from %s" % (jp.getName(), self.faction)) self.objective = VS.addObjective("Destroy All %s Hostiles" % self.faction) VS.setCompleteness(self.objective, 0.0) debug.info("quantity " + str(self.quantity)) while (count < self.quantity): L = launch.Launch() if self.dynatkfg == "": atkfg = "Shadow" else: atkfg = self.dynatkfg L.fg = atkfg L.dynfg = "" if count == 0: L.fgappend = "" else: L.fgappend = "_" + str(count) if (self.dynatktype == ''): L.type = faction_ships.getRandomFighter(self.faction) else: L.type = self.dynatktype L.ai = "default" L.num = 1 L.minradius = 20000.0 L.maxradius = 25000.0 try: L.minradius *= faction_ships.launch_distance_factor L.maxradius *= faction_ships.launch_distance_factor except: pass L.faction = self.faction launched = L.launch(you) if (count == 0): self.you.SetTarget(launched) if (1): launched.SetTarget(jp) else: launched.SetTarget(you) if (self.dedicatedattack): launched.setFgDirective('B') self.attackers += [launched] count += 1 if (self.respawn == 0 and len(self.attackers) > 0): self.respawn = 1 import universe universe.greet(self.greetingText, self.attackers[0], you, self.dyndeffg) else: VS.IOmessage(0, "escort mission", self.mplay, "Eliminate all %s ships here" % self.faction) VS.IOmessage(0, "escort mission", self.mplay, "You must protect %s." % jp.getName()) self.quantity = 0
def GenerateEnemies(self, jp, you): VS.IOmessage(0, "escort mission", self.mplay, "You must protect %s." % unit.getUnitFullName(jp, True)) count = 0 jp.setMissionRelevant() VS.addObjective("Protect %s from the %s" % (unit.getUnitFullName(jp), self.faction.capitalize().replace("_", " "))) self.objective = VS.addObjective("Destroy All %s Hostiles" % self.faction) VS.setCompleteness(self.objective, 0.0) print("quantity " + str(self.quantity)) while (count < self.quantity): L = launch.Launch() L.fg = "Shadow" L.dynfg = self.dynatkfg if (self.dynatktype == ''): L.type = faction_ships.getRandomFighter(self.faction) else: L.type = self.dynatktype L.ai = "default" L.num = 1 L.minradius = 2000.0 L.maxradius = 4500.0 try: L.minradius *= faction_ships.launch_distance_factor L.maxradius *= faction_ships.launch_distance_factor except: pass L.faction = self.faction launched = L.launch(you) if (count == 0): self.you.SetTarget(launched) if (self.defend): launched.SetTarget(jp) else: launched.SetTarget(you) if (self.dedicatedattack): launched.setFgDirective('B') self.attackers += [launched] count += 1 if (self.respawn == 0 and len(self.attackers) > 0): self.respawn = 1 import universe universe.greet(self.greetingText, self.attackers[0], you) else: VS.IOmessage(0, "escort mission", self.mplay, "Eliminate all %s ships here" % self.faction) self.quantity = 0
def DeletePatrolPoint(self,num,nam): tmp=self.encounterprob if (self.engreetedyet!=1 or VS.GetGameTime()>self.enemygreetingtime+10): self.enemygreetingtime=VS.GetGameTime() self.engreetedyet+=1 if (len(self.patrolpoints)==1 and self.launchedyet): if (self.ally): pos= self.you.Position() pos=(pos[0],pos[1]+2*self.ally.rSize(),pos[2]+self.you.rSize()*2+2*self.ally.rSize()) self.ally.SetPosition(pos)#move him nearby to last nav point self.encounterprob=1.0 self.minships=self.lastnum self.maxships=self.lastnum elif(self.engreetedyet==2): import universe universe.greet(self.enemygreetingtext,None,self.you) self.encounterprob=1.0 cleansweep.cleansweep.DeletePatrolPoint(self,num,nam) self.encounterprob=tmp
def GenerateEnemies (self,jp,you): count=0 self.objectivezero=VS.addObjective ("Protect %s from %s" % (unit.getUnitFullName(jp),self.faction)) self.objective = VS.addObjective ("Destroy All %s Hostiles" % self.faction) VS.setCompleteness(self.objective,0.0) print "quantity "+str(self.quantity) while (count<self.quantity): L = launch.Launch() L.fg="Shadow";L.dynfg=self.dynatkfg; if (self.dynatktype==''): L.type=faction_ships.getRandomFighter(self.faction) else: L.type=self.dynatktype L.ai="default";L.num=1;L.minradius=20000.0;L.maxradius=25000.0 try: L.minradius*=faction_ships.launch_distance_factor L.maxradius*=faction_ships.launch_distance_factor except: pass L.faction=self.faction launched=L.launch(you) if (count==0): self.you.SetTarget(launched) if (1): launched.SetTarget (jp) else: launched.SetTarget (you) if (self.dedicatedattack): launched.setFgDirective('B') self.attackers += [ launched ] count+=1 VS.adjustFGRelationModifier(self.younum,launched.getFlightgroupName(),-2); if (self.respawn==0 and len(self.attackers)>0): self.respawn=1 import universe universe.greet(self.greetingText,self.attackers[0],you); else: VS.IOmessage (0,"escort mission",self.mplay,"Eliminate all %s ships here" % self.faction) VS.IOmessage (0,"escort mission",self.mplay,"You must protect %s." % unit.getUnitFullName(jp)) self.quantity=0
def RealSuccessMission(self): cleansweep.cleansweep.RealSuccessMission(self) if (not self.launchedpirate): self.launchedpirate = True import launch L = launch.Launch() L.faction = "pirates" L.fg = "Drake" L.dynfg = "" L.minradius = 1000.0 L.maxradius = 1500.0 L.ai = "default" L.num = 1 import faction_ships L.type = faction_ships.getRandomFighter("pirates") pirate = L.launch(self.you) import universe pirate.SetTarget(universe.getRandomJumppoint()) pirate.ActivateJumpDrive(0) universe.greet(self.pirategreeting)
def FriendlyLaunch(self): self.havelaunched=1 L=launch.Launch() L.fg="Shadow" if(self.dyntype==""): self.dyntype=faction_ships.getRandomFighter(self.faction) L.type=self.dyntype L.dyntype=self.dyntype L.num=self.numenemies L.faction=self.faction L.minradius=3000 L.maxradius=4000 try: L.minradius*=faction_ships.launch_distance_factor L.maxradius*=faction_ships.launch_distance_factor except: debug.debug("failed to set up minradius and maxradius for faction_ships.launch") pass you=VS.getPlayerX(self.cp) friendly=L.launch(you) universe.greet(self.altGreetingText,friendly,you);
def FriendlyLaunch(self): self.havelaunched = 1 L = launch.Launch() L.fg = "Shadow" if (self.dyntype == ""): self.dyntype = faction_ships.getRandomFighter(self.faction) L.type = self.dyntype L.dyntype = self.dyntype L.num = self.numenemies L.faction = self.faction L.minradius = 3000 L.maxradius = 4000 try: L.minradius *= faction_ships.launch_distance_factor L.maxradius *= faction_ships.launch_distance_factor except: debug.debug( "failed to set up minradius and maxradius for faction_ships.launch" ) pass you = VS.getPlayerX(self.cp) friendly = L.launch(you) universe.greet(self.altGreetingText, friendly, you)
def RealSuccessMission(self): cleansweep.cleansweep.RealSuccessMission(self) print "REAL SUCCESS" if (not self.launchedpirate): print "LAUNCHING PIRATE" self.launchedpirate=True import launch L= launch.Launch() L.faction="pirates" L.fg="Drake" L.dynfg="" L.minradius=500.0 L.maxradius=550.0 L.ai="default" L.num=1 import faction_ships L.type=faction_ships.getRandomFighter("pirates") pirate=L.launch(self.you) import universe universe.greet(self.pirategreeting,pirate,self.you) print pirate.getName() pirate.SetTarget(universe.getRandomJumppoint()) pirate.ActivateJumpDrive(0) pirate.SetVelocity((0,0,1000))
def Execute (self): isSig=0 if (self.you.isNull()): self.Lose (1) return if (self.arrived==3): if (not self.runaway): if (not self.istarget): quest_drone.drone.SetTarget(self.you) if quest_drone.drone: pos=quest_drone.drone.LocalPosition() yourpos=self.you.LocalPosition() if pos[0]<yourpos[0]-10000 or pos[0]>yourpos[0]+10000 or pos[1]<yourpos[1]-10000 or pos[1]>yourpos[1]+10000 or pos[2]<yourpos[2]-10000 or pos[2]>yourpos[2]+10000: quest_drone.drone.SetPosition((yourpos[0]-1000,yourpos[1]-4000,yourpos[2]+1000)) else: self.Win(self.you,1) return elif (self.arrived==2): #significant=self.adjsys.SignificantUnit() #if (significant.isNull ()): # debug.debug("sig null") # VS.terminateMission(0) # return if (1): if (1): newshipgood="broadsword"#faction_ships.getRandomFighter(self.goodfaction) #quest_drone.drone=launch.launch_wave_around_unit("Shadow",self.faction,self.newship,"default",4,3000.0,4000.0,significant) L = launch.Launch() L.fg="AlphaPrime" L.dynfg='' L.type = newshipgood L.faction = self.goodfaction L.ai = "default" L.num=4 L.minradius=5000.0 L.maxradius = 6000.0 try: L.minradius*=faction_ships.launch_distance_factor L.maxradius*=faction_ships.launch_distance_factor except: pass goodguysC=L.launch(self.you) L.num=1 L.type=faction_ships.getRandomCapitol(self.goodfaction); goodguysA=L.launch(self.you) if not quest_drone.drone: L = launch.Launch() L.fg="Shadow" L.dynfg='' L.type = self.newshipattack L.faction = self.attackfaction L.ai = "default" L.num=1 L.minradius=15000.0 L.maxradius = 15000.0 try: L.minradius*=faction_ships.launch_distance_factor L.maxradius*=faction_ships.launch_distance_factor except: pass quest_drone.drone=L.launch(self.you) if quest_drone.drone.getUnitSystemFile()!=VS.getSystemFile(): quest_drone.drone.JumpTo(VS.getSystemFile()) goodguysC.SetTarget(quest_drone.drone) goodguysA.SetTarget(quest_drone.drone) self.you.SetTarget(quest_drone.drone) self.obj=VS.addObjective("Destroy the %s ship." % (quest_drone.drone.getName ())) if (quest_drone.drone): self.arrived=3 else: debug.info("enemy null") VS.terminateMission(0) return #quest_drone.drone.SetHull(40.0) elif self.arrived==1: if VS.getSystemFile()==self.helpsystem: if (VS.GetGameTime()-self.jumpingtime>78): self.you.JumpTo(self.lastjump) self.jumpingtime=VS.GetGameTime()+10000000. elif self.helper: self.helper.DeactivateJumpDrive() self.helper.SetTarget(VS.Unit()) #self.helper.SetVelocity( (0,0,0) ) #self.helper.SetPosition( self.helperpos ) if (self.adjsys.Execute()): self.arrived=2 if (self.newshipattack==""): self.newshipattack=faction_ships.getRandomFighter(self.attackfaction) #self.adjsys=go_somewhere_significant(self.you,0,10000.0,0,'','',self.displayLocation) #localdestination=self.adjsys.SignificantUnit().getName() tmpfg="shadow" #VS.IOmessage (3,"defend mission",self.mplay,"Hunt the %s unit in the %s flightgroup in this system." % (self.newshipattack,tmpfg)) #if (self.runaway): #ADD OTHER JUMPING IF STATEMENT CODE HERE # VS.IOmessage (4,"defend mission",self.mplay,"Target is fleeing to the jump point!") # VS.IOmessage (5,"defend mission",self.mplay,"Target Destination appears to be %s" % (localdestination)) VS.IOmessage (1,"Admiral Reismann",self.mplay,"You're just in time for the massacre!") VS.IOmessage (5,"Admiral Reismann",self.mplay,"Cut the chatter and listen: This is Admiral Reismann. We'll hit the thing as soon as it arrives. Hold your position until it does. And, uh, feel free to join in. Reismann out.") VS.playSound("campaign/Reismann.wav",(0.,0.,0.),(0.,0.,0.)) else: if VS.getSystemFile()==self.helpsystem: debug.info("Launching helper ship!") if (self.newshiphelp==""): self.newshiphelp=faction_ships.getRandomFighter(self.helpfaction) L = launch.Launch() L.fg="Unknown" L.dynfg='' L.type = self.newshiphelp L.faction = self.helpfaction L.ai = "default" L.num=1 L.minradius=1500.0 L.maxradius = 1600.0 try: L.minradius*=faction_ships.launch_distance_factor L.maxradius*=faction_ships.launch_distance_factor except: pass self.helper=L.launch(self.you) self.helperpos=self.helper.Position() self.you.SetTarget(self.helper) universe.greet(self.greetingText,self.helper,self.you) whichmount=self.you.removeWeapon("Steltek",0,True) if (whichmount!=-1): self.you.upgrade('steltek_gun_boosted',whichmount,whichmount,True,True) self.jumpingtime=VS.GetGameTime() self.arrived=1
def Launch(self, you): if (self.havelaunched == 0): for i in range (len(self.faction)): faction = self.faction[i] if len(self.numenemies) > i: numenemies = self.numenemies[i] else: numenemies = self.numenemies[0] if type(self.AdjustFaction) != bool: try: if len(self.AdjustFaction) > i: self.AdjustFaction = self.AdjustFaction[i] else: self.AdjustFaction = self.AdjustFaction[0] except: AjdustFaction = True if len(self.fgname) > i: fgname = self.fgname[i] else: fgname = self.fgname[0] if fgname == "": fgname="Shadow" if len(self.dyntype) > i: dyntype = self.dyntype[i] else: dyntype = self.dyntype[0] for z in range(numenemies): debug.info('Ambush: Launch ships!') self.havelaunched = 1 import launch L = launch.Launch() L.fg = fgname L.dynfg = "" # dynfg tells launch to load flightgroup from SaveString if dyntype == "": import faction_ships dyntype = faction_ships.getRandomFighter(faction) L.type = dyntype L.num = 1 if z == 0: L.fgappend = "" else: L.fgappend = "_"+str(z) L.minradius = 6000 L.maxradius = 8000 try: import faction_ships L.minradius *= faction_ships.launch_distance_factor L.maxradius *= faction_ships.launch_distance_factor except: pass L.faction = faction import universe enemy = L.launch(you) lead = enemy.getFlightgroupLeader() enemy.SetTarget(you) if lead: lead.SetTarget(you) else: enemy.setFlightgroupLeader(enemy) enemy.setFgDirective("A.") self.enemy = lead rel = VS.GetRelation(faction, "privateer") if self.AdjustFaction and rel >= 0: VS.AdjustRelation(faction, "privateer", -.02 - rel, 1.0) rel = VS.GetRelation("privateer", faction) VS.AdjustRelation("privateer", faction, -.02 - rel, 1.0) if i == 0 and z==0: universe.greet(self.greetingText, enemy, you) debug.info('Ambush: Ships have been launched. Exiting...')
def Execute(self): isSig = 0 if (self.you.isNull()): self.Lose(1) return if (self.arrived == 2): if (not self.runaway): if (not self.istarget): if (self.enemy): curun = VS.getUnit(self.curiter) self.curiter += 1 if (curun == self.enemy): self.enemy.SetTarget(self.you) elif (curun.isNull()): self.curiter = 0 else: if (VS.GetGameTime() > self.firsttime + 2.5 and self.enemy): self.firsttime += 1000000 self.AdjLocation() if (self.enemy.isNull()): self.Win(self.you, 1) return elif (self.arrived == 1): significant = self.adjsys.SignificantUnit() if (significant.isNull()): print "sig null" VS.terminateMission(0) return else: if (self.you.getSignificantDistance(significant) < self.adjsys.distfrombase): if (self.newship == ""): self.newship = faction_ships.getRandomFighter( self.faction) #self.enemy=launch.launch_wave_around_unit("Shadow",self.faction,self.newship,"default",1+self.difficulty,3000.0,4000.0,significant) L = launch.Launch() L.fg = "Shadow" L.dynfg = self.dynfg L.type = self.newship L.faction = self.faction L.ai = "default" L.num = 1 + self.difficulty L.minradius = 3000.0 L.maxradius = 4000.0 try: L.minradius *= faction_ships.launch_distance_factor L.maxradius *= faction_ships.launch_distance_factor except: pass self.enemy = L.launch(significant) self.enemy.SetTarget(self.you) self.enemy.setFgDirective('B.') self.you.SetTarget(self.enemy) universe.greet(self.greetingText, self.enemy, self.you) str_faction = self.faction.split('_')[0] quest.playSoundCockpit('sounds/missions/' + str_faction + '_it-appears-we-have.ogg') self.obj = VS.addObjective( "Destroy %s." % (unit.getUnitFullName(self.enemy))) if (self.enemy): if (self.runaway): self.enemy.SetTarget( significant ) #CHANGE TO SetTarget ==>NOT setTarget<== self.enemy.ActivateJumpDrive(0) self.firsttime = VS.GetGameTime() #self.enemy.SetPosAndCumPos(Vector.Add(self.you.Position(),Vector.Vector(0,0,self.you.rSize()*1.2))) self.LaunchedEnemies(significant) self.arrived = 2 else: print "enemy null" VS.terminateMission(0) return else: if (self.adjsys.Execute()): self.arrived = 1 if (self.newship == "" and self.dynfg == ''): self.newship = faction_ships.getRandomFighter(self.faction) self.adjsys = go_somewhere_significant(self.you, self.dockable_unit, 10000.0, 0, '', '', self.displayLocation) if not self.displayLocation: VS.addObjective("Search/Destroy " + self.faction.capitalize() + " mark") localdestination = unit.getUnitFullName( self.adjsys.SignificantUnit(), True) tmpfg = self.dynfg if len(tmpfg) == 0: tmpfg = "shadow" VS.IOmessage( 3, "bounty mission", self.mplay, "Hunt the %s unit in the %s flightgroup in this system." % (self.newship, tmpfg)) if (self.runaway): #ADD OTHER JUMPING IF STATEMENT CODE HERE VS.IOmessage(4, "bounty mission", self.mplay, "Target is fleeing to the jump point!") VS.IOmessage( 5, "bounty mission", self.mplay, "Target Destination appears to be %s" % (localdestination)) elif (self.displayLocation): VS.IOmessage(4, "bounty mission", self.mplay, "Scanners detect bounty target!") VS.IOmessage( 5, "bounty mission", self.mplay, "Coordinates appear near %s" % (localdestination)) else: print "Location " + str(self.displayLocation) VS.IOmessage( 4, "bounty mission", self.mplay, "[Computer] Mission description indicates bounty target may be in this system." )
def Launch(self, you): if (self.havelaunched == 0): for i in range(len(self.faction)): faction = self.faction[i] if len(self.numenemies) > i: numenemies = self.numenemies[i] else: numenemies = self.numenemies[0] if type(self.AdjustFaction) != bool: try: if len(self.AdjustFaction) > i: self.AdjustFaction = self.AdjustFaction[i] else: self.AdjustFaction = self.AdjustFaction[0] except: AjdustFaction = True if len(self.fgname) > i: fgname = self.fgname[i] else: fgname = self.fgname[0] if fgname == "": fgname = "Shadow" if len(self.dyntype) > i: dyntype = self.dyntype[i] else: dyntype = self.dyntype[0] for z in range(numenemies): debug.info('Ambush: Launch ships!') self.havelaunched = 1 import launch L = launch.Launch() L.fg = fgname L.dynfg = "" # dynfg tells launch to load flightgroup from SaveString if dyntype == "": import faction_ships dyntype = faction_ships.getRandomFighter(faction) L.type = dyntype L.num = 1 if z == 0: L.fgappend = "" else: L.fgappend = "_" + str(z) L.minradius = 6000 L.maxradius = 8000 try: import faction_ships L.minradius *= faction_ships.launch_distance_factor L.maxradius *= faction_ships.launch_distance_factor except: pass L.faction = faction import universe enemy = L.launch(you) lead = enemy.getFlightgroupLeader() enemy.SetTarget(you) if lead: lead.SetTarget(you) else: enemy.setFlightgroupLeader(enemy) enemy.setFgDirective("A.") self.enemy = lead rel = VS.GetRelation(faction, "privateer") if self.AdjustFaction and rel >= 0: VS.AdjustRelation(faction, "privateer", -.02 - rel, 1.0) rel = VS.GetRelation("privateer", faction) VS.AdjustRelation("privateer", faction, -.02 - rel, 1.0) if i == 0 and z == 0: universe.greet(self.greetingText, enemy, you) debug.info('Ambush: Ships have been launched. Exiting...')
def Launch(self, you): if (self.havelaunched == 0): if (type(self.numenemies) == type(1)): self.numenemies = (self.numenemies, ) self.faction = (self.faction, ) self.dyntype = (self.dyntype, ) self.dynfg = (self.dynfg, ) if (type(self.AdjustFaction) != type(()) and type(self.AdjustFaction) != type([])): self.AdjustFaction = (self.AdjustFaction, ) for i in range(len(self.faction)): numenemies = self.numenemies[i] faction = self.faction[i] for z in range(numenemies): AdjustFaction = self.AdjustFaction[-1] if (i < len(self.AdjustFaction)): AdjustFaction = self.AdjustFaction[i] dynfg = "" if (len(self.dynfg) > i): dynfg = self.dynfg[i] dyntype = "" if (len(self.dyntype) > i): dyntype = self.dyntype[i] print('Ambush: Launch ships!') self.havelaunched = 1 L = launch.Launch() L.fg = "Shadow" if (dyntype == ""): dyntype = faction_ships.getRandomFighter(faction) L.dynfg = dynfg L.type = dyntype L.num = 1 L.fgappend = "X" L.minradius = 6000 L.maxradius = 8000 try: L.minradius *= faction_ships.launch_distance_factor L.maxradius *= faction_ships.launch_distance_factor except: pass L.faction = faction enemy = L.launch(you) lead = enemy.getFlightgroupLeader() enemy.SetTarget(you) if (lead): lead.SetTarget(you) else: enemy.setFlightgroupLeader(enemy) enemy.setFgDirective("A.") self.enemy = lead rel = VS.GetRelation(faction, "privateer") if (AdjustFaction and rel >= 0): VS.AdjustRelation(faction, "privateer", -.02 - rel, 1.0) rel = VS.GetRelation("privateer", faction) VS.AdjustRelation("privateer", faction, -.02 - rel, 1.0) if (i == len(self.faction) - 1 and z == 0): universe.greet(self.greetingText, enemy, you) #print "launchin" print('Ambush: Ships have been launched. Exiting...')
def Execute (self): isSig=0 if (self.you.isNull()): self.Lose (1) return if (self.arrived==2): if (not self.runaway): if (not self.istarget): if (self.enemy): curun=VS.getUnit(self.curiter) self.curiter+=1 if (curun==self.enemy): self.enemy.SetTarget(self.you) elif (curun.isNull()): self.curiter=0 else: if (VS.GetGameTime()>self.firsttime+2.5 and self.enemy): self.firsttime+=1000000 self.AdjLocation() if (self.enemy.isNull()): self.Win(self.you,1) return elif (self.arrived==1): significant=self.adjsys.SignificantUnit() if (significant.isNull ()): print "sig null" VS.terminateMission(0) return else: if (self.you.getSignificantDistance(significant)<self.adjsys.distfrombase): if (self.newship==""): self.newship=faction_ships.getRandomFighter(self.faction) #self.enemy=launch.launch_wave_around_unit("Shadow",self.faction,self.newship,"default",1+self.difficulty,3000.0,4000.0,significant) L = launch.Launch() L.fg="Shadow" L.dynfg=self.dynfg L.type = self.newship L.faction = self.faction L.ai = "default" L.num=1+self.difficulty L.minradius=3000.0 L.maxradius = 4000.0 try: L.minradius*=faction_ships.launch_distance_factor L.maxradius*=faction_ships.launch_distance_factor except: pass self.enemy=L.launch(significant) self.enemy.SetTarget(self.you) self.enemy.setFgDirective('B.') self.you.SetTarget(self.enemy) import universe universe.greet(self.greetingText,self.enemy,self.you) self.obj=VS.addObjective("Destroy %s." % (unit.getUnitFullName(self.enemy))) if (self.enemy): if (self.runaway): self.enemy.SetTarget(significant) #CHANGE TO SetTarget ==>NOT setTarget<== self.enemy.ActivateJumpDrive(0) self.firsttime=VS.GetGameTime() #self.enemy.SetPosAndCumPos(Vector.Add(self.you.Position(),Vector.Vector(0,0,self.you.rSize()*1.2))) self.LaunchedEnemies(significant) self.arrived=2 else: print "enemy null" VS.terminateMission(0) return else: if (self.adjsys.Execute()): self.arrived=1 if (self.newship=="" and self.dynfg==''): self.newship=faction_ships.getRandomFighter(self.faction) self.adjsys=go_somewhere_significant(self.you,self.dockable_unit,10000.0,0,'','',self.displayLocation) if not self.displayLocation: VS.addObjective("Search/Destroy "+self.faction.capitalize()+" mark"); localdestination=unit.getUnitFullName(self.adjsys.SignificantUnit(),True) tmpfg=self.dynfg if len(tmpfg)==0: tmpfg="shadow" VS.IOmessage (3,"bounty mission",self.mplay,"Hunt the %s unit in the %s flightgroup in this system." % (self.newship,tmpfg)) if (self.runaway): #ADD OTHER JUMPING IF STATEMENT CODE HERE VS.IOmessage (4,"bounty mission",self.mplay,"Target is fleeing to the jump point!") VS.IOmessage (5,"bounty mission",self.mplay,"Target Destination appears to be %s" % (localdestination)) elif (self.displayLocation): VS.IOmessage (4,"bounty mission",self.mplay,"Scanners detect bounty target!") VS.IOmessage (5,"bounty mission",self.mplay,"Coordinates appear near %s" % (localdestination)) else: print "Location "+str(self.displayLocation) VS.IOmessage (4,"bounty mission",self.mplay,"[Computer] Mission description indicates bounty target may be in this system.")
def Execute(self): isSig = 0 if (self.you.isNull()): self.Lose(1) return if (self.arrived == 3): if (not self.runaway): if (not self.istarget): quest_drone.drone.SetTarget(self.you) if quest_drone.drone: pos = quest_drone.drone.LocalPosition() yourpos = self.you.LocalPosition() if pos[0] < yourpos[0] - 10000 or pos[0] > yourpos[ 0] + 10000 or pos[1] < yourpos[1] - 10000 or pos[ 1] > yourpos[1] + 10000 or pos[2] < yourpos[ 2] - 10000 or pos[2] > yourpos[2] + 10000: quest_drone.drone.SetPosition( (yourpos[0] - 1000, yourpos[1] - 4000, yourpos[2] + 1000)) else: self.Win(self.you, 1) return elif (self.arrived == 2): #significant=self.adjsys.SignificantUnit() #if (significant.isNull ()): # debug.debug("sig null") # VS.terminateMission(0) # return if (1): if (1): newshipgood = "broadsword" #faction_ships.getRandomFighter(self.goodfaction) #quest_drone.drone=launch.launch_wave_around_unit("Shadow",self.faction,self.newship,"default",4,3000.0,4000.0,significant) L = launch.Launch() L.fg = "AlphaPrime" L.dynfg = '' L.type = newshipgood L.faction = self.goodfaction L.ai = "default" L.num = 4 L.minradius = 5000.0 L.maxradius = 6000.0 try: L.minradius *= faction_ships.launch_distance_factor L.maxradius *= faction_ships.launch_distance_factor except: pass goodguysC = L.launch(self.you) L.num = 1 L.type = faction_ships.getRandomCapitol(self.goodfaction) goodguysA = L.launch(self.you) if not quest_drone.drone: L = launch.Launch() L.fg = "Shadow" L.dynfg = '' L.type = self.newshipattack L.faction = self.attackfaction L.ai = "default" L.num = 1 L.minradius = 15000.0 L.maxradius = 15000.0 try: L.minradius *= faction_ships.launch_distance_factor L.maxradius *= faction_ships.launch_distance_factor except: pass quest_drone.drone = L.launch(self.you) if quest_drone.drone.getUnitSystemFile( ) != VS.getSystemFile(): quest_drone.drone.JumpTo(VS.getSystemFile()) goodguysC.SetTarget(quest_drone.drone) goodguysA.SetTarget(quest_drone.drone) self.you.SetTarget(quest_drone.drone) self.obj = VS.addObjective("Destroy the %s ship." % (quest_drone.drone.getName())) if (quest_drone.drone): self.arrived = 3 else: debug.info("enemy null") VS.terminateMission(0) return #quest_drone.drone.SetHull(40.0) elif self.arrived == 1: if VS.getSystemFile() == self.helpsystem: if (VS.GetGameTime() - self.jumpingtime > 78): self.you.JumpTo(self.lastjump) self.jumpingtime = VS.GetGameTime() + 10000000. elif self.helper: self.helper.DeactivateJumpDrive() self.helper.SetTarget(VS.Unit()) #self.helper.SetVelocity( (0,0,0) ) #self.helper.SetPosition( self.helperpos ) if (self.adjsys.Execute()): self.arrived = 2 if (self.newshipattack == ""): self.newshipattack = faction_ships.getRandomFighter( self.attackfaction) #self.adjsys=go_somewhere_significant(self.you,0,10000.0,0,'','',self.displayLocation) #localdestination=self.adjsys.SignificantUnit().getName() tmpfg = "shadow" #VS.IOmessage (3,"defend mission",self.mplay,"Hunt the %s unit in the %s flightgroup in this system." % (self.newshipattack,tmpfg)) #if (self.runaway): #ADD OTHER JUMPING IF STATEMENT CODE HERE # VS.IOmessage (4,"defend mission",self.mplay,"Target is fleeing to the jump point!") # VS.IOmessage (5,"defend mission",self.mplay,"Target Destination appears to be %s" % (localdestination)) VS.IOmessage(1, "Admiral Reismann", self.mplay, "You're just in time for the massacre!") VS.IOmessage( 5, "Admiral Reismann", self.mplay, "Cut the chatter and listen: This is Admiral Reismann. We'll hit the thing as soon as it arrives. Hold your position until it does. And, uh, feel free to join in. Reismann out." ) VS.playSound("campaign/Reismann.wav", (0., 0., 0.), (0., 0., 0.)) else: if VS.getSystemFile() == self.helpsystem: debug.info("Launching helper ship!") if (self.newshiphelp == ""): self.newshiphelp = faction_ships.getRandomFighter( self.helpfaction) L = launch.Launch() L.fg = "Unknown" L.dynfg = '' L.type = self.newshiphelp L.faction = self.helpfaction L.ai = "default" L.num = 1 L.minradius = 1500.0 L.maxradius = 1600.0 try: L.minradius *= faction_ships.launch_distance_factor L.maxradius *= faction_ships.launch_distance_factor except: pass self.helper = L.launch(self.you) self.helperpos = self.helper.Position() self.you.SetTarget(self.helper) universe.greet(self.greetingText, self.helper, self.you) whichmount = self.you.removeWeapon("Steltek", 0, True) if (whichmount != -1): self.you.upgrade('steltek_gun_boosted', whichmount, whichmount, True, True) self.jumpingtime = VS.GetGameTime() self.arrived = 1