def NoEnemiesInArea (self,jp): if (self.adjsys.DestinationSystem()!=VS.getSystemFile()): return 0 if (self.ship_check_count>=len(self.attackers)): VS.setCompleteness(self.objective,1.0) return 1 un= self.attackers[self.ship_check_count] VS.adjustFGRelationModifier(self.younum,un.getFlightgroupName(),-.01); self.ship_check_count+=1 if (un.isNull() or (un.GetHullPercent()<.7 and self.defendee.getDistance(un)>7000)): return 0 else: VS.setObjective(self.objective,"Destroy the %s"%unit.getUnitFullName(un)) self.ship_check_count=0 return 0
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