def Execute (self): ## if (VS.getGameTime()>mission_time): ## VS.IOmessage (0,"cargo mission",self.mplay,"You Have failed to deliver your cargo in a timely manner.") ## VS.IOmessage (0,"cargo mission",self.mplay,"The cargo is no longer of need to us.") ## if (you): ## takeCargoAndTerminate(you,0) ## return if (self.you.isNull() or (self.arrived and self.base.isNull())): VS.IOmessage (0,"cargo mission",self.mplay,"#ff0000You were unable to deliver cargo. Mission failed.") self.SetVar(-1) VS.terminateMission(0) return if (not self.adjsys.Execute() and not (self.arrived and self.base and self.base.isDocked(self.you))): return if (self.arrived): self.adjsys.Execute=self.adjsys.HaveArrived if (self.base.isDocked(self.you) or (self.base.getDistance(self.you)<=1 and not self.knownBases())): self.takeCargoAndTerminate(self.you,1) return else: self.arrived=1 tempfac=self.faction if vsrandom.random()<=.5: tempfac='' self.adjsys=go_somewhere_significant(self.you,1,100,not self.capship,tempfac) capstr="planet" dockstr="land" if tempfac=='': dockstr="dock" capstr="ship" self.adjsys.Print("You must visit the %%s %s" % (capstr),"cargo mission",", docked around the %s",0) VS.IOmessage(0,"cargo mission",self.mplay,"Once there, %s and we will transport the cargo off of your ship." % (dockstr)) self.base=self.adjsys.SignificantUnit() self.role=self.base.getCombatRole() self.base.setCombatRole("INERT")
def Execute(self): if (self.you.isNull() or (self.arrived and self.defendee.isNull())): VS.IOmessage( 0, "defend", self.mplay, "#ff0000You were unable to arrive in time to help. Mission failed." ) self.SetVarValue(-1) VS.terminateMission(0) return if (not self.adjsys.Execute()): return if (not self.arrived): self.arrived = 1 tempfaction = '' if (self.defend_base): tempfaction = self.protectivefaction if (tempfaction == ''): tempfaction = faction_ships.get_enemy_of(self.faction) self.adjsys = go_somewhere_significant( self.you, self.defend_base or self.defend, self.distance_from_base, self.defend, tempfaction, self.dyndeffg, 1, not self.defend_base) self.adjsys.Print("You must visit the %s", "defend", "near the %s", 0) self.defendee = self.adjsys.SignificantUnit() else: if (self.defendee.isNull()): if (self.defend): self.FailMission(you) else: self.SuccessMission() return else: if (self.quantity > 0): self.GenerateEnemies(self.defendee, self.you) if (self.ship_check_count == 0 and self.dedicatedattack): if (self.targetiter >= len(self.attackers)): self.targetiter = 0 else: un = self.attackers[self.targetiter] if (not un.isNull()): if (self.defend): # if (not un.isNull() if (un.getName() in faction_ships.isBomber): if (self.quantity >= faction_ships. isBomber[un.getName()]): un.SetTarget(self.defendee) else: un.setFgDirective('b') else: un.setFgDirective('b') else: un.SetTarget(self.you) self.targetiter = self.targetiter + 1 if (self.NoEnemiesInArea(self.defendee)): if (self.waves > 0): self.quantity = self.savedquantity self.waves -= 1 else: self.SuccessMission()
def Execute (self): if (self.you.isNull() or (self.arrived and self.defendee.isNull())): VS.IOmessage (0,"defend",self.mplay,"#ff0000You were unable to arrive in time to help. Mission failed.") self.SetVarValue(-1) VS.terminateMission(0) return global running_defend_missions if running_defend_missions[self.key]!=self.run_def_mis: print "ABORTING DEFEND MISSION WITH PARAMS "+self.key+" because another is running " VS.terminateMission(1) return running_defend_missions[self.key]+=1 self.run_def_mis+=1 if (not self.adjsys.Execute()): return if (not self.arrived): self.arrived=1 tempfaction='' if (self.defend_base): tempfaction=self.protectivefaction if (tempfaction==''): tempfaction = faction_ships.get_enemy_of(self.faction) self.adjsys=go_somewhere_significant (self.you,self.defend_base or self.defend,self.distance_from_base,self.defend,tempfaction,self.dyndeffg,1,not self.defend_base) self.adjsys.Print ("You must visit the %s","defend","near the %s", 0) self.defendee=self.adjsys.SignificantUnit() else: if (self.defendee.isNull ()): if (self.defend): self.FailMission(you) else: self.SuccessMission() return else: if (self.quantity>0): self.GenerateEnemies (self.defendee,self.you) if (self.ship_check_count==0 and self.dedicatedattack): if (self.targetiter>=len(self.attackers)): self.targetiter=0 else: un = self.attackers[self.targetiter] if (not un.isNull()): if (self.defend):# if (not un.isNull() if (un.getName() in faction_ships.isBomber): if (self.quantity >= faction_ships.isBomber[un.getName()]): un.SetTarget (self.defendee) else: un.setFgDirective('b') else: un.setFgDirective('b') else: un.SetTarget (self.you) self.targetiter=self.targetiter+1 if (self.NoEnemiesInArea (self.defendee)): if (self.waves>0): self.quantity=self.savedquantity self.waves-=1 else: self.SuccessMission()
def Execute(self): if (self.successdelay): if (self.defendee.getUnitSystemFile() != self.you.getUnitSystemFile() or VS.GetGameTime() - self.successdelay > 120): if (self.defendee): self.PayMission() else: self.FailMission() return # nothing more happens inside this control if (self.you.isNull() or (self.launchedfriend and self.defendee.isNull())): VS.IOmessage( 0, "escort mission", self.mplay, "#ff0000You were unable to arrive in time to help. Mission failed." ) self.SetVarValue(-1) VS.terminateMission(0) return if (not self.adjsys.Execute()): return if (not self.arrived): self.arrived = 1 if (self.launchedfriend == 0 and not self.incoming): self.defendee = self.GenerateDefendee() self.launchedfriend = 1 self.adjsys = go_somewhere_significant(self.you, 0, self.distance_from_base, 0) self.adjsys.Print("You must visit the %s", "escort mission", "docked around the %s", 0) self.jp = self.adjsys.SignificantUnit() else: if (self.launchedfriend == 0): self.defendee = self.GenerateDefendee() self.launchedfriend = 1 if (self.defendee.isNull()): self.FailMission(you) return else: self.defendee.setFlightgroupLeader(self.you) if (VS.GetGameTime() - self.gametime > 10): self.defendee.setFgDirective('F') if (self.quantity > 0): self.GenerateEnemies(self.defendee, self.you) if (self.ship_check_count == 0 and self.dedicatedattack): if (self.targetiter >= len(self.attackers)): self.targetiter = 0 else: un = self.attackers[self.targetiter] if (not un.isNull()): un.SetTarget(self.defendee) self.targetiter = self.targetiter + 1 if (self.NoEnemiesInArea(self.defendee)): if (self.waves > 0): self.quantity = self.savedquantity self.waves -= 1 else: self.SuccessMission()
def Execute(self): if (self.successdelay): if (self.defendee.getUnitSystemFile() != self.you.getUnitSystemFile() or VS.GetGameTime()-self.successdelay > 120): if (self.defendee): self.PayMission() else: self.FailMission() return # nothing more happens inside this control if (self.you.isNull() or (self.launchedfriend and self.defendee.isNull())): VS.IOmessage(0, "escort mission", self.mplay, "#ff0000You were unable to arrive in time to help. Mission failed.") self.SetVarValue(-1) VS.terminateMission(0) return if (not self.adjsys.Execute()): return if (not self.arrived): self.arrived = 1 if (self.launchedfriend == 0 and not self.incoming): self.defendee = self.GenerateDefendee() self.launchedfriend = 1 self.adjsys = go_somewhere_significant( self.you, 0, self.distance_from_base, 0) self.adjsys.Print("You must visit the %s", "escort mission", "docked around the %s", 0) self.jp = self.adjsys.SignificantUnit() else: if (self.launchedfriend == 0): self.defendee = self.GenerateDefendee() self.launchedfriend = 1 if (self.defendee.isNull()): self.FailMission(you) return else: self.defendee.setFlightgroupLeader(self.you) if (VS.GetGameTime()-self.gametime > 10): self.defendee.setFgDirective('F') if (self.quantity > 0): self.GenerateEnemies(self.defendee, self.you) if (self.ship_check_count == 0 and self.dedicatedattack): if (self.targetiter >= len(self.attackers)): self.targetiter = 0 else: un = self.attackers[self.targetiter] if (not un.isNull()): un.SetTarget(self.defendee) self.targetiter = self.targetiter+1 if (self.NoEnemiesInArea(self.defendee)): if (self.waves > 0): self.quantity = self.savedquantity self.waves -= 1 else: self.SuccessMission()
def Execute(self): if (VS.GetGameTime() - self.gametime > 10): self.escortee.setFgDirective('F') if self.you.isNull(): VS.IOmessage( 0, "escort", self.mplay, "#ff0000You were to protect your escort. Mission failed.") VS.terminateMission(0) return self.escortee.setFlightgroupLeader(self.you) #print 'name: '+self.escortee.getFlightgroupLeader().getName() #self.escortee.SetVelocity(self.you.GetVelocity()) if (self.escortee.isNull()): VS.IOmessage( 0, "escort", self.mplay, "#ff0000You were to protect your escort. Mission failed.") universe.punish(self.you, self.faction, self.difficulty) if (self.var_to_set != ''): quest.removeQuest(self.you.isPlayerStarship(), self.var_to_set, -1) VS.terminateMission(0) return if (not self.adjsys.Execute()): if (self.arrived): self.adjsys.SignificantUnit().setSpeed(0.0) self.adjsys.SignificantUnit().SetVelocity((0.0, 0.0, 0.0)) return if (not self.arrived): self.arrived = 1 self.adjsys = go_somewhere_significant( self.you, 1, self.distfrombase + 15 * self.escortee.rSize(), self.difficulty <= 1, self.faction) self.role = self.adjsys.SignificantUnit().getCombatRole() self.adjsys.SignificantUnit().setCombatRole("INERT") self.adjsys.Print("You must escort your starship to the %s", "defend", "docked around the %s", 0) elif (self.you.getDistance(self.escortee) < 2000): self.you.addCredits(self.creds) VS.AdjustRelation(self.you.getFactionName(), self.faction, self.difficulty * .01, 1) VS.IOmessage( 0, "escort", self.mplay, "#00ff00Excellent work! You have completed this mission!") self.escortee.setFgDirective('b') self.escortee.setFlightgroupLeader(self.escortee) self.escortee.performDockingOperations( self.adjsys.SignificantUnit(), 0) self.adjsys.SignificantUnit().setCombatRole(self.role) if (self.var_to_set != ''): quest.removeQuest(self.you.isPlayerStarship(), self.var_to_set, 1) VS.terminateMission(1)
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 Execute(self): ## if (VS.getGameTime()>mission_time): ## VS.IOmessage (0,"cargo mission",self.mplay,"You Have failed to deliver your cargo in a timely manner.") ## VS.IOmessage (0,"cargo mission",self.mplay,"The cargo is no longer of need to us.") ## if (you): ## takeCargoAndTerminate(you,0) ## return if (self.you.isNull() or (self.arrived and self.base.isNull())): VS.IOmessage( 0, "cargo mission", self.mplay, "#ff0000You were unable to deliver cargo. Mission failed.") self.SetVar(-1) VS.terminateMission(0) return if (not self.adjsys.Execute() and not (self.arrived and self.base and self.base.isDocked(self.you))): return if (self.arrived): self.adjsys.Execute = self.adjsys.HaveArrived if (self.base.isDocked(self.you)): self.takeCargoAndTerminate(self.you, 1) return else: self.arrived = 1 tempfac = self.faction if vsrandom.random() <= .5: tempfac = '' baseonly = not self.capship self.adjsys = go_somewhere_significant(self.you, 1, 100, baseonly, tempfac) capstr = "planet" dockstr = "land" if tempfac == '': dockstr = "dock" capstr = "ship" self.adjsys.Print("You must visit the %%s %s" % (capstr), "cargo mission", ", docked around the %s", 0) VS.IOmessage( 0, "cargo mission", self.mplay, "Once there, %s and we will transport the cargo off of your ship." % (dockstr)) self.base = self.adjsys.SignificantUnit() self.role = self.base.getCombatRole() self.base.setCombatRole("INERT")
def Execute (self): if (VS.GetGameTime()-self.gametime>10): self.escortee.setFgDirective('F') if self.you.isNull(): VS.IOmessage (0,"escort",self.mplay,"#ff0000You were to protect your escort. Mission failed.") VS.terminateMission(0) return self.escortee.setFlightgroupLeader(self.you) #print 'name: '+self.escortee.getFlightgroupLeader().getName() #self.escortee.SetVelocity(self.you.GetVelocity()) if (self.escortee.isNull()): VS.IOmessage (0,"escort",self.mplay,"#ff0000You were to protect your escort. Mission failed.") universe.punish(self.you,self.faction,self.difficulty) if (self.var_to_set!=''): quest.removeQuest (self.you.isPlayerStarship(),self.var_to_set,-1) VS.terminateMission(0) return if (not self.adjsys.Execute()): if (self.arrived): self.adjsys.SignificantUnit().setSpeed(0.0) self.adjsys.SignificantUnit().SetVelocity((0.0,0.0,0.0)) return if (not self.arrived): self.arrived=1 self.adjsys=go_somewhere_significant (self.you,1,self.distfrombase+15*self.escortee.rSize(),self.difficulty<=1,self.faction) self.role = self.adjsys.SignificantUnit().getCombatRole() self.adjsys.SignificantUnit().setCombatRole("INERT"); self.adjsys.Print ("You must escort your starship to the %s","defend","docked around the %s", 0) elif (self.you.getDistance(self.escortee)<2000): self.you.addCredits(self.creds) VS.AdjustRelation(self.you.getFactionName(),self.faction,self.difficulty*.01,1) VS.IOmessage (0,"escort",self.mplay,"#00ff00Excellent work! You have completed this mission!") self.escortee.setFgDirective('b') self.escortee.setFlightgroupLeader(self.escortee) self.escortee.performDockingOperations(self.adjsys.SignificantUnit(),0) self.adjsys.SignificantUnit().setCombatRole(self.role); if (self.var_to_set!=''): quest.removeQuest (self.you.isPlayerStarship(),self.var_to_set,1) VS.terminateMission(1)