def __init__(self): playa = VS.getPlayer() if (playa): confed = faction_ships.factions[faction_ships.confed] pirates = faction_ships.factions[faction_ships.pirates] illustrious = launch.launch_wave_around_unit( 'Illustrious', confed, faction_ships.getRandomCapitol(confed), 'default', 1, 1000, 4000, playa) launch.launch_wave_around_unit( 'Illustrious', confed, faction_ships.getRandomCapitol(confed), 'default', 2, 1000, 2000, illustrious) launch.launch_wave_around_unit( 'Illustrious', confed, faction_ships.getRandomFighter(confed), 'default', 4, 100, 200, illustrious) launch.launch_wave_around_unit( 'SlaverGuild', pirates, faction_ships.getRandomFighter(pirates), 'default', 4, 100, 200, illustrious) launch.launch_wave_around_unit( 'SlaverGuild', pirates, faction_ships.getRandomCapitol(pirates), 'default', 2, 100, 200, illustrious) VS.IOmessage( 3, "game", "all", "[Computer] Scans show the remnants of the Slaver Guild being cleaned up by Special Forces." )
def __init__(self): self.system = VS.getSystemName() playa = VS.getPlayer() self.msgColor = ("#9999FF", "#FF9999") if (playa): confed = faction_ships.factions[faction_ships.confed] pirates = faction_ships.factions[faction_ships.pirates] illustrious = launch.launch_wave_around_unit( 'Illustrious', confed, faction_ships.getRandomCapitol(confed), 'default', 1, 1000, 4000, playa) launch.launch_wave_around_unit( 'Illustrious', confed, faction_ships.getRandomCapitol(confed), 'default', 2, 1000, 2000, illustrious) launch.launch_wave_around_unit( 'Illustrious', confed, faction_ships.getRandomFighter(confed), 'default', 4, 100, 200, illustrious) launch.launch_wave_around_unit( 'SlaverGuild', pirates, faction_ships.getRandomFighter(pirates), 'default', 4, 100, 200, illustrious) launch.launch_wave_around_unit( 'SlaverGuild', pirates, faction_ships.getRandomCapitol(pirates), 'default', 2, 100, 200, illustrious) VS.IOmessage( 3, "[Computer]", "privateer", self.msgColor[0] + "Scans show the remnants of the Slaver Guild being cleaned up by Special Forces." )
def __init__ (self): playa = VS.getPlayer() if (playa): confed = faction_ships.factions[faction_ships.confed] pirates = faction_ships.factions[faction_ships.pirates] illustrious=launch.launch_wave_around_unit ('Illustrious',confed,faction_ships.getRandomCapitol(confed),'default',1,1000,4000,playa) launch.launch_wave_around_unit ('Illustrious',confed,faction_ships.getRandomCapitol(confed),'default',2,1000,2000,illustrious) launch.launch_wave_around_unit ('Illustrious',confed,faction_ships.getRandomFighter(confed),'default',4,100,200,illustrious) launch.launch_wave_around_unit ('SlaverGuild',pirates,faction_ships.getRandomFighter(pirates),'default',4,100,200,illustrious) launch.launch_wave_around_unit ('SlaverGuild',pirates,faction_ships.getRandomCapitol(pirates),'default',2,100,200,illustrious) VS.IOmessage (3,"game","all","[Computer] Scans show the remnants of the Slaver Guild being cleaned up by Special Forces.")
def __init__ (self): self.system = VS.getSystemName() playa = VS.getPlayer() self.msgColor = ("#9999FF","#FF9999") if (playa): confed = faction_ships.factions[faction_ships.confed] pirates = faction_ships.factions[faction_ships.pirates] illustrious=launch.launch_wave_around_unit ('Illustrious',confed,faction_ships.getRandomCapitol(confed),'default',1,1000,4000,playa) launch.launch_wave_around_unit ('Illustrious',confed,faction_ships.getRandomCapitol(confed),'default',2,1000,2000,illustrious) launch.launch_wave_around_unit ('Illustrious',confed,faction_ships.getRandomFighter(confed),'default',4,100,200,illustrious) launch.launch_wave_around_unit ('SlaverGuild',pirates,faction_ships.getRandomFighter(pirates),'default',4,100,200,illustrious) launch.launch_wave_around_unit ('SlaverGuild',pirates,faction_ships.getRandomCapitol(pirates),'default',2,100,200,illustrious) VS.IOmessage (3,"[Computer]","privateer",self.msgColor[0]+"Scans show the remnants of the Slaver Guild being cleaned up by Special Forces.")
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 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 launch_wave_around(fg, faction, ai, nr_ships, capship, radius, myunit, garbage_collection_distance, logo, skipdj=0): pos = whereTo(radius, myunit) debug.debug("before" + str(nr_ships)) (nr_ships, pos) = look_for(fg, faction, nr_ships, myunit, pos, garbage_collection_distance) debug.debug("after " + str(nr_ships)) while (nr_ships > 0): type = "" if (capship): type = faction_ships.getRandomCapitol(faction) else: type = faction_ships.getRandomFighter(faction) pos = LaunchNext(fg, faction, type, ai, pos, logo) nr_ships -= 1 if (not skipdj): dj_lib.PlayMusik(0, dj_lib.HOSTILE_NEWLAUNCH_DISTANCE)
def Execute(self): if (VS.getPlayer()): iter = 0 for base in self.fac: if (base.getDistance(VS.getPlayer()) < 0): if (VS.GetGameTime() - self.delay > 10): self.delay = VS.GetGameTime() type = faction_ships.getRandomFighter( self.facnames[iter]) if (iter >= len(self.facnames) / 2): type = faction_ships.getRandomCapitol( self.facnames[iter]) launch.launch_wave_around_unit( "Shadow_" + self.facnames[iter], self.facnames[iter], type, "default", 1, 200, 250, VS.getPlayer(), '', 0) VS.getPlayer().upgrade("tungsten", 0, 0, 1, 0) VS.getPlayer().upgrade("tungsten_hull", 0, 0, 1, 0) else: VS.IOmessage( 0, "spawner", "all", "Going to spawn " + self.facnames[iter] + "starships in %d seconds at." % (10 - (VS.GetGameTime() - self.delay))) iter += 1
def Execute(self): if (VS.getPlayer()): iter = 0 for base in self.fac: if (base.getDistance(VS.getPlayer()) < 0): if (VS.GetGameTime() - self.delay > 4): self.delay = VS.GetGameTime() facname = self.facnames[iter] if (facname == "random"): facname = self.facnames[vsrandom.randrange( 0, len(self.facnames))] type = faction_ships.getRandomFighter(facname) if (iter >= len(self.facnames) / 2): type = faction_ships.getRandomCapitol(facname) tmp = launch.launch_wave_around_unit( "Shadow_" + facname, facname, type, "default", 1, 200, 250, VS.getPlayer(), '', 0) # tmp.upgrade("basic_armor",0,0,1,0) # tmp.upgrade("shield_4_Level1",0,0,1,0) # tmp.upgrade("reactor_level_2",0,0,1,0) # tmp.upgrade("add_ablative_hull_coating",0,0,1,0) # tmp.upgrade("add_sublimative_hull_coating",0,0,1,0) VS.getPlayer().upgrade("tungsten", 0, 0, 1, 0) VS.getPlayer().upgrade("tungsten_hull", 0, 0, 1, 0) else: VS.IOmessage( 0, "spawner", "all", "Going to spawn " + self.facnames[iter] + "starships in %d seconds at." % (10 - (VS.GetGameTime() - self.delay))) iter += 1
def GenerateDefendee(self): import escort_mission escort_mission.escort_num += 1 L = launch.Launch() if self.dyndeffg == "": deffg = "Escort" L.fgappend = "_"+str(escort_mission.escort_num) else: deffg = self.dyndeffg L.fgappend = "" L.fg = deffg L.dynfg = "" L.faction = self.protectivefaction if (self.dyndeffg == '' and self.dyndeftype == ''): L.type = faction_ships.getRandomFighter(self.protectivefaction) else: L.type = self.dyndeftype L.ai = "default" L.num = 1 L.minradius = 2.0*self.you.rSize() L.maxradius = 3.0*self.you.rSize() L.forcetype = True escortee = L.launch(self.you) escortee.upgrade("jump_drive", 0, 0, 0, 1) escortee.setFlightgroupLeader(self.you) escortee.setFgDirective('F') return escortee
def __init__ (self, creds, faction, quantity, category, returntobase, var_when_done=''): Director.Mission.__init__ (self) self.newship="" self.mplay="all" self.obj=0 self.enemy=VS.Unit() self.curiter=0 self.content="" self.quantity=quantity self.arrived=0 self.faction = faction self.cred=creds self.category=category self.donevar=var_when_done sysfile = VS.getSystemFile() self.newship=faction_ships.getRandomFighter('merchant') self.you=VS.getPlayer() self.pos=self.you.Position() self.gosig=go_somewhere_significant(self.you,0,10000.) self.mplay=universe.getMessagePlayer(self.you) if (self.you): VS.IOmessage (0,"plunder mission",self.mplay,"Your mission is to destroy a %s merchant unit." % (self.newship)) VS.IOmessage (1,"plunder mission",self.mplay,"It is orbiting around the %s planet in the system." % (unit.getUnitFullName(self.gosig.SignificantUnit()))) VS.IOmessage (2,"plunder mission",self.mplay,"After it is destroyed, pick up all %s cargo that got ejected."%self.category) VS.IOmessage (3,"plunder mission",self.mplay,"Then return to a %s base with your cargo. #00ff00Good luck!"%self.faction) else: print("aboritng plunder constructor...") VS.terminateMission (0)
def getFgLeaderType(fgname, faction): #debug.debug("wah " +str(ShipsInFG(fgname,faction))) l = ShipsInFG(fgname, faction) if (len(l)): if (len(l[0])): return l[0][0] return faction_ships.getRandomFighter(faction)
def setupFriendly(self, around): L = launch.Launch() L.fg = self.friendlyfg L.dynfg = self.friendlydynfg if self.friendlydyntype == '': self.friendlydyntype = faction_ships.getRandomFighter( self.friendlyfaction) L.type = self.friendlydyntype L.faction = self.friendlyfaction L.ai = "default" L.num = self.friendlynum L.minradius = 0 L.maxradius = self.mindist try: L.minradius *= faction_ships.launch_distance_factor L.maxradius *= faction_ships.launch_distance_factor except: pass friendly = L.launch(around) self.enemy.setCombatRole("FIGHTER") flead = friendly.getFlightgroupLeader() flead.SetTarget(self.enemy) flead.Threaten(self.enemy, 1) self.enemy.Threaten(flead, 1) friendly.setFgDirective('A.') friendly.DeactivateJumpDrive()
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 setupFriendly (self, around): L = launch.Launch() L.fg=self.friendlyfg L.dynfg=self.friendlydynfg if self.friendlydyntype=='': self.friendlydyntype=faction_ships.getRandomFighter(self.friendlyfaction) L.type = self.friendlydyntype L.faction = self.friendlyfaction L.ai = "default" L.num=self.friendlynum L.minradius=0 L.maxradius=self.mindist try: L.minradius*=faction_ships.launch_distance_factor L.maxradius*=faction_ships.launch_distance_factor except: pass friendly=L.launch(around) self.enemy.setCombatRole("FIGHTER") flead = friendly.getFlightgroupLeader() flead.SetTarget(self.enemy) flead.Threaten(self.enemy,1) self.enemy.Threaten(flead,1) friendly.setFgDirective('A.') friendly.DeactivateJumpDrive()
def launch_new_wave(self): un = VS.getPlayer() if (vsrandom.randrange(0,4)==0): if (un): currentsystem = VS.getSystemFile() numadj=VS.GetNumAdjacentSystems(currentsystem) if (numadj): cursys=VS.GetAdjacentSystem(currentsystem,vsrandom.randrange(0,numadj)) else: cursys = 'enigma_sector/heavens_gate' debug.info("TJ: jumping to "+cursys) un.JumpTo(cursys) else: debug.info("TJ: jumping to [ERROR: you are null]") side = vsrandom.randrange(0,2) faction="confed" ai = vsrandom.randrange(0,6) if (0 and ai==0): ai = "printhello.py" else: ai = "default" if (side==0): faction=faction_ships.get_enemy_of("confed") else: faction=faction_ships.get_friend_of("confed") launched = launch.launch_wave_around_unit ("Shadow",faction,faction_ships.getRandomFighter(faction),ai,vsrandom.randrange(1,10),100.0,2000.0,VS.getPlayer(),'') if (vsrandom.randrange(0,10)==0): launch.launch_wave_around_unit ("ShadowCap",faction,faction_ships.getRandomCapitol(faction),ai,1,2000.0,4000.0,VS.getPlayer(),'')
def GenerateDefendee(self): import escort_mission escort_mission.escort_num += 1 L = launch.Launch() if self.dyndeffg == "": deffg = "Escort" L.fgappend = "_" + str(escort_mission.escort_num) else: deffg = self.dyndeffg L.fgappend = "" L.fg = deffg L.dynfg = "" L.faction = self.protectivefaction if (self.dyndeffg == '' and self.dyndeftype == ''): L.type = faction_ships.getRandomFighter(self.protectivefaction) else: L.type = self.dyndeftype L.ai = "default" L.num = 1 L.minradius = 2.0 * self.you.rSize() L.maxradius = 3.0 * self.you.rSize() L.forcetype = True escortee = L.launch(self.you) escortee.upgrade("jump_drive", 0, 0, 0, 1) escortee.setFlightgroupLeader(self.you) escortee.setFgDirective('F') return escortee
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 getFgLeaderType(fgname,faction): #debug.debug("wah " +str(ShipsInFG(fgname,faction))) l = ShipsInFG(fgname,faction) if (len(l)): if (len(l[0])): return l[0][0]; return faction_ships.getRandomFighter(faction)
def setupEnemy (self): if not self.started: print('Tail Error checking: '+self.directions[0]) print('Tail Error checking: '+self.directions[0].lower()) if self.started: return True elif self.directions[0].lower().find(VS.getPlayerX(self.cp).getUnitSystemFile().lower())!=-1: L = launch.Launch() L.fg=self.enemyfg L.dynfg=self.enemydynfg if self.enemydyntype=='': self.enemydyntype=faction_ships.getRandomFighter(self.enemyfaction) L.type = self.enemydyntype L.faction = self.enemyfaction L.ai = "default" L.num=self.enemynum L.minradius=self.mindist L.maxradius=self.startdist try: L.minradius*=faction_ships.launch_distance_factor L.maxradius*=faction_ships.launch_distance_factor except: pass self.enemy=L.launch(VS.getPlayerX(self.cp)) self.enemy.upgrade("jump_drive",0,0,0,1) self.relation = self.enemy.getRelation(VS.getPlayerX(self.cp)) self.enemy.setCombatRole("INERT") self.updateEnemyObjective() VS.IOmessage (0,"[Mission Computer]","all","Target %s detected! Proceed as per mission instructions."%self.enemy.getFullname()) self.objref=VS.addObjective("Follow the %s until it broadcasts the signal"%self.enemy.getFullname()) self.started=True return True print("now NOT set up!") return False
def AddFighterTo(fgname,fac,isNew=False): sys = VS.getSystemFile() #print 'add fighter' import generate_dyn_universe numsystems = generate_dyn_universe.systemcount[fac] if (VS.GetGalaxyFaction(sys)!=fac): try: homeworlds=faction_ships.production_centers except: homeworlds=faction_ships.homeworlds if fac in homeworlds: if type(homeworlds[fac])==type(""): sys=homeworlds[fac] else: sys=homeworlds[fac][vsrandom.randrange(0,len(homeworlds[fac]))] numfighters = int(generate_dyn_universe.XProductionRate(fac,faction_ships.fighterProductionRate)*numsystems) try: if fac in faction_ships.staticFighterProduction: numfighters+=faction_ships.staticFighterProduction[fac] except: pass if (numfighters<1): if (vsrandom.uniform(0,1)<numfighters): numfighters=1 #print "Generating "+str(numfighters)+ " fighters for "+fac+" at "+sys if isNew: fgk=fg_util.AllFGsInSystem(fac,sys) if len(fgk): fgname=fgk[vsrandom.randrange(0,len(fgk))] stat=6 if fac in faction_ships.fightersPerFG: stat=faction_ships.fightersPerFG[fac] elif "default" in faction_ships.fightersPerFG: stat=faction_ships.fightersPerFG["default"] if fg_util.NumShipsInFG(fgname,fac)+numfighters<=numfighters+stat: isNew=False if isNew: fgname=generate_dyn_universe.GetNewFGName(fac) if numfighters>=1: fg_util.AddShipsToFG (fgname,fac,((faction_ships.getRandomFighter(fac),int(numfighters)),),sys) numcapships = generate_dyn_universe.XProductionRate(fac,faction_ships.capitalProductionRate)*numsystems if (numcapships<1): if (vsrandom.uniform(0,1)>numcapships): return numcapships=1 sys = fg_util.FGSystem(fgname,fac) if (1 or VS.GetGalaxyFaction(sys)!=fac): try: homeworlds=faction_ships.production_centers except: homeworlds=faction_ships.homeworlds if fac in homeworlds: if type(homeworlds[fac])==type(""): sys=homeworlds[fac] else: sys=homeworlds[fac][vsrandom.randrange(0,len(homeworlds[fac]))] cap =faction_ships.getRandomCapitol(fac) #print "Generating "+str(numcapships)+ " capship "+cap+" for "+fac+" at "+sys fg_util.AddShipsToFG(fgname,fac,((cap,int(numcapships)),),sys)
def getFgLeaderType(fgname,faction): # print "wah " +str(ShipsInFG(fgname,faction)) l = ShipsInFG(fgname,faction) if (len(l)): if (len(l[0])): return l[0][0]; import faction_ships return faction_ships.getRandomFighter(faction)
def AddFighterTo(fgname,fac,isNew=False): sys = VS.getSystemFile() #debug.debug('add fighter') numsystems = generate_dyn_universe.systemcount[fac] if (VS.GetGalaxyFaction(sys)!=fac): try: homeworlds=faction_ships.production_centers except: homeworlds=faction_ships.homeworlds if fac in homeworlds: if type(homeworlds[fac])==type(""): sys=homeworlds[fac] else: sys=homeworlds[fac][vsrandom.randrange(0,len(homeworlds[fac]))] numfighters = int(generate_dyn_universe.XProductionRate(fac,faction_ships.fighterProductionRate)*numsystems) try: if fac in faction_ships.staticFighterProduction: numfighters+=faction_ships.staticFighterProduction[fac] except: pass if (numfighters<1): if (vsrandom.uniform(0,1)<numfighters): numfighters=1 #debug.debug("Generating "+str(numfighters)+ " fighters for "+fac+" at "+sys) if isNew: fgk=fg_util.FGsInSystem(fac,sys) if len(fgk): fgname=fgk[vsrandom.randrange(0,len(fgk))] stat=6 if fac in faction_ships.fightersPerFG: stat=faction_ships.fightersPerFG[fac] elif "default" in faction_ships.fightersPerFG: stat=faction_ships.fightersPerFG["default"] if fg_util.NumShipsInFG(fgname,fac)+numfighters<=numfighters+stat: isNew=False if isNew: fgname=generate_dyn_universe.GetNewFGName(fac) if numfighters>=1: fg_util.AddShipsToFG (fgname,fac,((faction_ships.getRandomFighter(fac),int(numfighters)),),sys) numcapships = generate_dyn_universe.XProductionRate(fac,faction_ships.capitalProductionRate)*numsystems if (numcapships<1): if (vsrandom.uniform(0,1)>numcapships): return numcapships=1 sys = fg_util.FGSystem(fgname,fac) if (1 or VS.GetGalaxyFaction(sys)!=fac): try: homeworlds=faction_ships.production_centers except: homeworlds=faction_ships.homeworlds if fac in homeworlds: if type(homeworlds[fac])==type(""): sys=homeworlds[fac] else: sys=homeworlds[fac][vsrandom.randrange(0,len(homeworlds[fac]))] cap =faction_ships.getRandomCapitol(fac) #debug.debug("Generating "+str(numcapships)+ " capship "+cap+" for "+fac+" at "+sys) fg_util.AddShipsToFG(fgname,fac,((cap,int(numcapships)),),sys)
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 punish (you,faction,difficulty): VS.AdjustRelation(you.getFactionName(),faction,difficulty*-.01,1) if (difficulty>=2): VS.IOmessage (0,"mission",getMessagePlayer(you),"#ff0000Your idiocy will be punished.") VS.IOmessage (0,"mission",getMessagePlayer(you),"#ff0000You had better run for what little life you have left.") for i in range(difficulty): un=faction_ships.getRandomFighter(faction) newunit=launch.launch_wave_around_unit("shadow", faction, un, "default", 1, 200.0,400.0,you) newunit.setFgDirective("B") newunit.SetTarget(you)
def DeletePatrolPoint(self, num, nam): import vsrandom if (vsrandom.random() < self.encounterprob): import faction_ships fac = self.faction if (type(fac) is list or type(fac) is tuple): fac = fac[vsrandom.randrange(0, len(fac))] dynfg = "" import fg_util import VS allfg = fg_util.AllFGsInSystem(fac, VS.getSystemFile()) if (len(allfg)): dynfg = allfg[vsrandom.randrange(0, len(allfg))] for i in range(vsrandom.randrange(self.minships, self.maxships + 1)): import launch L = launch.Launch() if self.fgname == "": fgname = "Patrol" else: fgname = self.fgname L.fg = fgname L.dynfg = dynfg if (vsrandom.random() < self.capshipprob): L.type = faction_ships.getRandomCapitol(fac) else: L.type = faction_ships.getRandomFighter(fac) L.ai = "default" L.faction = fac L.num = 1 L.minradius = 3000.0 L.maxradius = 4000.0 if i == 0: L.fgappend = "" else: L.fgappend = "_" + str(i) try: L.minradius *= faction_ships.launch_distance_factor L.maxradius *= faction_ships.launch_distance_factor except: pass if (self.patrolpoints[num]): newun = L.launch(self.patrolpoints[num]) if (self.forceattack): lead = newun.getFlightgroupLeader() if (lead): lead.SetTarget(self.you) else: newun.setFlightgroupLeader(newun) newun.SetTarget(self.you) newun.setFgDirective("A.") self.Track(newun) patrol.patrol.DeletePatrolPoint(self, num, nam)
def makeAdversary(self, faction, num): self.adv = [] playa = VS.getPlayer() if (playa): for i in range(num): self.adv += [ launch.launch_wave_around_unit( "Shadow", faction, faction_ships.getRandomFighter(faction), "default", 1, playa.rSize() + 500, playa.rSize() + 2000, playa, "") ]
def DeletePatrolPoint(self,num,nam): import vsrandom if (vsrandom.random()<self.encounterprob): import faction_ships fac=self.faction if (type(fac) is list or type(fac) is tuple): fac = fac[vsrandom.randrange(0,len(fac))] dynfg="" import fg_util import VS allfg=fg_util.AllFGsInSystem(fac,VS.getSystemFile()) if (len(allfg)): dynfg = allfg[vsrandom.randrange(0,len(allfg))] for i in range(vsrandom.randrange(self.minships,self.maxships+1)): import launch L=launch.Launch() if self.fgname=="": fgname="Patrol" else: fgname = self.fgname L.fg = fgname L.dynfg=dynfg if (vsrandom.random()<self.capshipprob): L.type=faction_ships.getRandomCapitol(fac) else: L.type=faction_ships.getRandomFighter(fac) L.ai="default" L.faction=fac L.num=1 L.minradius=3000.0 L.maxradius=4000.0 if i == 0: L.fgappend="" else: L.fgappend="_"+str(i) try: L.minradius*=faction_ships.launch_distance_factor L.maxradius*=faction_ships.launch_distance_factor except: pass if (self.patrolpoints[num]): newun=L.launch(self.patrolpoints[num]) if (self.forceattack): lead=newun.getFlightgroupLeader() if (lead): lead.SetTarget(self.you) else: newun.setFlightgroupLeader(newun) newun.SetTarget(self.you) newun.setFgDirective("A.") self.Track(newun) patrol.patrol.DeletePatrolPoint(self,num,nam)
def __init__(self, price, factionname, numships, difficulty): Director.Mission.__init__(self) self.price = price self.faction = factionname self.you = VS.getPlayer() self.numships = numships self.diff = difficulty self.adjsys = go_somewhere_significant(self.you, 0, 5000, 0) self.wingship = faction_ships.getRandomFighter(factionname) nam = "[%s]" % self.wingship self.adjsys.Print("Hello I'm waiting for your arrival at %s", self.wingship) VS.IOmessage(1, self.wingship, "all", "Once you meet me") VS.IOmessage(2, self.wingship, "all", "I will obey your commands until our contracts expire.")
def launch_wave_around ( fg, faction, ai, nr_ships, capship, radius, myunit, garbage_collection_distance,logo): pos = whereTo(radius, myunit) debug.info("launch_wave_around: before"+str(nr_ships)) (nr_ships,pos) = look_for (fg,faction,nr_ships,myunit,pos,garbage_collection_distance) debug.info("launch_wave_around: after "+str(nr_ships)) while (nr_ships>0): type="" if (capship): type = faction_ships.getRandomCapitol(faction) else: type = faction_ships.getRandomFighter(faction) pos = LaunchNext (fg,faction,type, ai, pos,logo) nr_ships-=1
def launch_new_wave(self): side = vsrandom.randrange(0, 2) faction = "confed" ai = vsrandom.randrange(0, 2) if (ai == 0): ai = "printhello.py" else: ai = "default" if (side == 0): faction = faction_ships.get_enemy_of("confed") else: faction = faction_ships.get_friend_of("confed") launched = launchShip(faction_ships.getRandomFighter(faction), faction)
def launch_new_wave(self): side = vsrandom.randrange(0,2) faction="confed" ai = vsrandom.randrange(0,2) if (ai==0): ai = "printhello.py" else: ai = "default" if (side==0): faction=faction_ships.get_enemy_of("confed") else: faction=faction_ships.get_friend_of("confed") launched = launchShip(faction_ships.getRandomFighter(faction),faction);
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 makeAdversary(self, faction, num): self.adv = [] playa = VS.getPlayer() if (playa): for i in range(num): self.adv += [launch.launch_wave_around_unit("Shadow", faction, faction_ships.getRandomFighter(faction), "default", 1, playa.rSize()+500, playa.rSize()+2000, playa, "")]
def __init__ (self, factionname, missiondifficulty, our_dist_from_jump, dist_from_jump, distance_from_base, creds, enemy_time, numsysaway, jumps=(), var_to_set='', fgname='', dyntype=''): Director.Mission.__init__(self); self.you = VS.getPlayer(); self.role= "ESCORTCAP" self.gametime=VS.GetGameTime() self.adjsys=go_to_adjacent_systems(self.you, numsysaway,jumps) self.var_to_set = var_to_set; debug.debug("e") self.adjsys.Print("You should start in the system named %s","Then jump to %s","Finally, jump to %s, your final destination","escort mission",1) debug.debug("f") self.distfrombase=distance_from_base debug.debug("g") self.faction=factionname global escort_num escort_num+=1 #self.escortee = launch.launch_wave_around_unit("Escort"+str(escort_num), # self.faction, # faction_ships.getRandomFighter("merchant"), # "default", # 1, # self.you.rSize(), # 2.0*self.you.rSize(), # self.you, # "") L=launch.Launch() if fgname == "": L.fg = "Escort" L.fgappend = "_"+str(escort_num) else: L.fg = fgname L.fgappend = "" L.faction=self.faction if (dyntype==''): L.type = faction_ships.getRandomFighter("merchant") else: L.type = dyntype L.forcetype=True L.dynfg = "" L.ai = "default" L.num=1 L.minradius = 2.0*self.you.rSize() L.maxradius = 3.0*self.you.rSize() self.escortee=L.launch(self.you) self.escortee.upgrade("jump_drive",0,0,0,1) self.you.SetTarget(self.escortee) debug.debug("h") self.escortee.setFlightgroupLeader(self.you) debug.debug("dd") self.difficulty=missiondifficulty self.creds = creds
def punish(you, faction, difficulty): VS.AdjustRelation(you.getFactionName(), faction, difficulty * -.01, 1) if (difficulty >= 2): VS.IOmessage(0, "mission", getMessagePlayer(you), "#ff0000Your idiocy will be punished.") VS.IOmessage( 0, "mission", getMessagePlayer(you), "#ff0000You had better run for what little life you have left.") for i in range(difficulty): un = faction_ships.getRandomFighter(faction) newunit = launch.launch_wave_around_unit("shadow", faction, un, "default", 1, 200.0, 400.0, you) newunit.setFgDirective("B") newunit.SetTarget(you)
def launch_new_wave(self): side = vsrandom.randrange(0,2) faction="confed" ai = vsrandom.randrange(0,8) if (0 and ai==0): ai = "printhello.py" else: ai = "default" if (side==0): faction=faction_ships.get_enemy_of("confed") else: faction="merchant" launched = launch.launch_wave_around_unit ("Shadow",faction,faction_ships.getRandomFighter(faction),ai,vsrandom.randrange(1,5),100.0,2000.0,VS.getPlayer(),'') if (vsrandom.randrange(0,10)==0 or faction=="luddites"): launch.launch_wave_around_unit ("ShadowCap"+str(vsrandom.randrange(0,10)),faction,faction_ships.getRandomCapitol(faction),ai,1,2000.0,4000.0,VS.getPlayer(),'')
def launch_wave_around ( fg, faction, ai, nr_ships, capship, radius, myunit, garbage_collection_distance,logo,skipdj=0): pos = whereTo(radius, myunit) debug.debug("before"+str(nr_ships)) (nr_ships,pos) = look_for (fg,faction,nr_ships,myunit,pos,garbage_collection_distance) debug.debug("after "+str(nr_ships)) while (nr_ships>0): type="" if (capship): type = faction_ships.getRandomCapitol(faction) else: type = faction_ships.getRandomFighter(faction) pos = LaunchNext (fg,faction,type, ai, pos,logo) nr_ships-=1 if (not skipdj): dj_lib.PlayMusik(0,dj_lib.HOSTILE_NEWLAUNCH_DISTANCE)
def __init__(self, creds, faction, quantity, category, returntobase, var_when_done=''): Director.Mission.__init__(self) self.newship = "" self.mplay = "all" self.obj = 0 self.enemy = VS.Unit() self.curiter = 0 self.content = "" self.quantity = quantity self.arrived = 0 self.faction = faction self.cred = creds self.category = category self.donevar = var_when_done sysfile = VS.getSystemFile() self.newship = faction_ships.getRandomFighter('merchant') self.you = VS.getPlayer() self.pos = self.you.Position() self.gosig = go_somewhere_significant(self.you, 0, 10000.) self.mplay = universe.getMessagePlayer(self.you) if (self.you): VS.IOmessage( 0, "plunder mission", self.mplay, "Your mission is to destroy a %s merchant unit." % (self.newship)) VS.IOmessage( 1, "plunder mission", self.mplay, "It is orbiting around the %s planet in the system." % (unit.getUnitFullName(self.gosig.SignificantUnit()))) VS.IOmessage( 2, "plunder mission", self.mplay, "After it is destroyed, pick up all %s cargo that got ejected." % self.category) VS.IOmessage( 3, "plunder mission", self.mplay, "Then return to a %s base with your cargo. #00ff00Good luck!" % self.faction) else: print "aboritng plunder constructor..." VS.terminateMission(0)
def Execute (self): if (VS.getPlayer()): iter=0 for base in self.fac: if (base.getDistance(VS.getPlayer())<0): if (VS.GetGameTime()-self.delay>10): self.delay=VS.GetGameTime() type=faction_ships.getRandomFighter(self.facnames[iter]) if (iter>=len(self.facnames)/2): type=faction_ships.getRandomCapitol(self.facnames[iter]) launch.launch_wave_around_unit("Shadow_"+self.facnames[iter],self.facnames[iter],type,"default",1,200,250,VS.getPlayer(),'',0) VS.getPlayer().upgrade("tungsten",0,0,1,0) VS.getPlayer().upgrade("tungsten_hull",0,0,1,0) else: VS.IOmessage(0,"spawner","all","Going to spawn "+self.facnames[iter]+"starships in %d seconds at."%(10-(VS.GetGameTime()-self.delay))) iter+=1
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 LaunchedEnemies(self, significant): bounty.bounty.LaunchedEnemies(self, significant) import launch L = launch.Launch() if self.helperfg == "": L.fg = "Shadow" else: L.fg = self.helperfg L.dynfg = "" L.faction = self.faction if type(self.helpertype) == type("") or len(self.helpertype) < 2: L.type = self.helpertype else: L.type = self.helpertype[0] L.faction = self.helpertype[1] if L.type == "": L.type = faction_ships.getRandomFighter(L.faction) L.ai = "default" L.num = self.numhelpers 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 if (self.numhelpers): tempship = L.launch(significant) tempship.SetTarget(self.you) for u in self.upgrades: args = (u, 0, 0, False) if (type(u) is list or type(u) is tuple): if (len(u) > 3): args = u elif (len(u) > 2): args = (u[0], u[1], u[2], False) elif (len(u) > 1): args = (u[0], u[1], 0, False) else: args = (u[0], 0, 0, False) self.enemy.upgrade(str(args[0]), int(args[1]), int(args[2]), 1, args[3])
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 LaunchedEnemies(self,significant): bounty.bounty.LaunchedEnemies(self,significant) import launch L = launch.Launch() if self.helperfg == "": L.fg = "Shadow" else: L.fg = self.helperfg L.dynfg = "" L.faction = self.faction if type(self.helpertype)==type("") or len(self.helpertype) < 2: L.type = self.helpertype else: L.type = self.helpertype[0] L.faction=self.helpertype[1] if L.type=="": L.type=faction_ships.getRandomFighter(L.faction) L.ai = "default" L.num=self.numhelpers 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 if (self.numhelpers): tempship=L.launch(significant) tempship.SetTarget(self.you) for u in self.upgrades: args=(u,0,0,False) if (type(u) is list or type (u) is tuple): if (len(u)>3): args=u elif (len(u)>2): args=(u[0],u[1],u[2],False) elif (len(u)>1): args=(u[0],u[1],0,False) else: args=(u[0],0,0,False) self.enemy.upgrade(str(args[0]),int(args[1]),int(args[2]),1,args[3])
def setupEnemy(self): if not self.started: print 'Tail Error checking: ' + self.directions[0] print 'Tail Error checking: ' + self.directions[0].lower() if self.started: return True elif self.directions[0].lower().find( VS.getPlayerX(self.cp).getUnitSystemFile().lower()) != -1: L = launch.Launch() L.fg = self.enemyfg L.dynfg = self.enemydynfg if self.enemydyntype == '': self.enemydyntype = faction_ships.getRandomFighter( self.enemyfaction) L.type = self.enemydyntype L.faction = self.enemyfaction L.ai = "default" L.num = self.enemynum L.minradius = self.mindist L.maxradius = self.startdist try: L.minradius *= faction_ships.launch_distance_factor L.maxradius *= faction_ships.launch_distance_factor except: pass self.enemy = L.launch(VS.getPlayerX(self.cp)) self.enemy.upgrade("jump_drive", 0, 0, 0, 1) self.relation = self.enemy.getRelation(VS.getPlayerX(self.cp)) self.enemy.setCombatRole("INERT") self.updateEnemyObjective() VS.IOmessage( 0, "[Mission Computer]", "all", "Target %s detected! Proceed as per mission instructions." % self.enemy.getFullname()) self.objref = VS.addObjective( "Follow the %s until it broadcasts the signal" % self.enemy.getFullname()) self.started = True return True print "now NOT set up!" return False
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): if (VS.getPlayer()): iter=0 for base in self.fac: if (base.getDistance(VS.getPlayer())<0): if (VS.GetGameTime()-self.delay>4): self.delay=VS.GetGameTime() facname = self.facnames[iter] if (facname=="random"): facname=self.facnames[vsrandom.randrange(0,len(self.facnames))] type=faction_ships.getRandomFighter(facname) if (iter>=len(self.facnames)/2): type=faction_ships.getRandomCapitol(facname) tmp=launch.launch_wave_around_unit("Shadow_"+facname,facname,type,"default",1,200,250,VS.getPlayer(),'',0) # tmp.upgrade("basic_armor",0,0,1,0) # tmp.upgrade("shield_4_Level1",0,0,1,0) # tmp.upgrade("reactor_level_2",0,0,1,0) # tmp.upgrade("add_ablative_hull_coating",0,0,1,0) # tmp.upgrade("add_sublimative_hull_coating",0,0,1,0) VS.getPlayer().upgrade("tungsten",0,0,1,0) VS.getPlayer().upgrade("tungsten_hull",0,0,1,0) else: VS.IOmessage(0,"spawner","all","Going to spawn "+self.facnames[iter]+"starships in %d seconds at."%(10-(VS.GetGameTime()-self.delay))) iter+=1
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
"Good day, stranger. I do not know you, and I do not wish to know you. However, in the face of our mutual situation, perhaps you could come to an agreement with Rowenna of the ISO. Talk to her. But before you leave, talk to me. I may have an offer that you simply cannot refuse." ) else: fixers.DestroyActiveButtons() if (fixers.checkSaveValue(playernum, "iso_mission1", 0)): Base.Message( "Excellent! You accepted the mission. I will offer you 38,000 credits to do one thing: destroy that vessel. You should have help from a few of my elite force; however, I expect the ISO to put up a fight, so be wary and beware. I trust you will accept my offer, my young....friend" ) elif (fixers.checkSaveValue(playernum, "iso_mission1", 1) or fixers.checkSaveValue(playernum, "iso_evil2", -1) or fixers.checkSaveValue(playernum, "iso_evil3", -1) or fixers.checkSaveValue(playernum, "iso_evil4", -1)): Base.Message( "There is only one thing I despise more than a member of the Interplanetary Socialist Organization: and that is one of their mercenary lapdogs. You are not worth the breath I have wasted on you. Leave now, if you dare. My forces will destroy your starship and leave your corpse to boil in vacuum." ) type = faction_ships.getRandomFighter("confed") fgname = "IntelSecElite" fixers.setSaveValue(playernum, "decided_iso_good", 1) launch.launch_wave_around_unit(fgname, "confed", type, "default", 1, 80, 100, playa).SetTarget(playa) launch.launch_wave_around_unit(fgname, "confed", type, "default", 1, 80, 100, playa).SetTarget(playa) launch.launch_wave_around_unit(fgname, "confed", type, "default", 1, 80, 100, playa).SetTarget(playa) launch.launch_wave_around_unit(fgname, "confed", type, "default", 1, 80, 100, playa).SetTarget(playa) launch.launch_wave_around_unit(fgname, "confed", type, "default", 1, 80, 100, playa).SetTarget(playa) elif (fixers.checkSaveValue(playernum, "iso_mission1", -1) and fixers.checkSaveValue(playernum, "iso_evil2", 0)): msg = ''
def Execute(self): isSig = 0 if (self.you.isNull()): self.Lose(1) return if (self.arrived == 3): self.gosig.Execute() cargquant = self.you.GetCargo(self.content).GetQuantity() if cargquant < self.quantity: # print "ohnooohnoohno!!!!!!!" VS.IOmessage( 0, "plunder mission", self.mplay, 'Not enough of %s cargo... Get more until you have %d.' % (self.quantity)) VS.setCompleteness(self.obj, 0.) elif self.you.isDocked(self.gosig.SignificantUnit( )) or self.gosig.SignificantUnit().isDocked(self.you): # print "du hast gewonnen!" self.you.removeCargo(self.content, self.quantity, 1) self.Win(self.you, 1) # else: # print 'hihohohiho' elif (self.arrived == 2): cargquant = self.you.GetCargo(self.content).GetQuantity() VS.setCompleteness(self.obj, float(cargquant) / float(self.quantity)) if cargquant == self.quantity: self.arrived = 3 self.gosig = go_somewhere_significant(self.you, 1, 3000., 1, "pirates") self.gosig.SignificantUnit().setCombatRole("INERT") VS.IOmessage( 0, "plunder mission", self.mplay, 'Give all of your cargo to the %s unit.' % (unit.getUnitFullName(self.gosig.SignificantUnit()))) elif (self.arrived == 1): if (self.enemy): self.pos = self.enemy.Position() curun = VS.getUnit(self.curiter) self.curiter += 1 if (curun == self.enemy): self.enemy.SetTarget(self.you) elif (curun.isNull()): self.curiter = 0 if (self.enemy.isNull()): VS.setCompleteness(self.obj, 1.) self.arrived = 2 self.enemy = [] for i in range(self.quantity * 2): launch.launch_wave_around_area("shadow", "upgrades", "generic_cargo", "sitting_duck", 1, 5., 10., self.pos, '', 0).setName(self.content) self.obj = VS.addObjective("Pick up %d %s cargo" % (self.quantity, self.content)) VS.IOmessage( 0, "plunder mission", self.mplay, 'You must now pick up at least %d of the %s cargo.' % (self.quantity, self.content)) else: significant = self.gosig.SignificantUnit() if (significant.isNull()): print "sig null" VS.terminateMission(0) return else: if (self.you.getSignificantDistance(significant) < 10000.0): if (self.newship == ""): self.newship = faction_ships.getRandomFighter( 'merchant') carg = VS.getRandCargo(self.quantity, self.category) if (carg.GetQuantity() == 0): carg = VS.getRandCargo( self.quantity, "") #oh no... could be starships... self.content = carg.GetContent() carg.SetQuantity(self.quantity * 2) self.enemy = launch.launch_wave_around_unit( "shadow", "merchant", self.newship, "default", 1, 200.0, 500.0, self.you) self.enemy.addCargo(carg) VS.setCompleteness(self.gosig.obj, 1.) VS.IOmessage( 0, "plunder mission", self.mplay, 'You must now destroy the %s ship.' % self.newship) VS.IOmessage( 0, "plunder mission", self.mplay, 'That fighter contains the wanted %s cargo in its hold.' % self.content) self.obj = VS.addObjective( "Destroy the %s ship." % (unit.getUnitFullName(self.enemy))) if (self.enemy): self.arrived = 1 else: print "enemy null" VS.terminateMission(0) return