def Execute (self):
     if (VS.getSystemName()==self.system and self.player and self.shipyard):
         if (self.stage==1 and VS.GetGameTime()>=self.timer):
             if (self.shipyard.getSignificantDistance(self.player) > 20000):
                 print('shipy ret')
                 print("distance" + str(self.shipyard.getSignificantDistance(self.player)))
                 return 1
             else:
                 print('killing')
                 pos = self.shipyard.Position()
                 size = 10*self.shipyard.rSize()
                 VS.playAnimation("explosion_orange.ani",pos,size)
                 pos = (pos[0]+.5*size,pos[1],pos[2])
                 VS.playAnimation("explosion_orange.ani",pos,size)
                 pos = (pos[0]-size,pos[1],pos[2])
                 VS.playAnimation("explosion_orange.ani",pos,size)
                 VS.playSound("explosion.wav",pos,(1,0,0))
                 self.shipyard.DealDamageToHull ((10,0,0),self.shipyard.GetHull()*.9)
                 self.timer = VS.GetGameTime()+10
                 self.stage = 2
         if (self.stage==2 and VS.GetGameTime()>=self.timer):
             VS.IOmessage(0,unit.getUnitFullName(self.shipyard),"all",self.msgColor[0]+"Large Explosion detected... standby...%#@*")
             text = "NAVAL SHIPYARDS HIT BY BOMB\\\Disaster struck the Confederate Naval Shipyards orbiting Alpha Centauri hours ago, when a powerful explosive device detonated, crippling a fleet carrier that was nearing completion. "
             text += "At least a dozen casualties were reported with an unknown number of injured, and salvage crews are still working hard to clear the area of wreckage. "
             text += "A team from the CSP (Confederate Security Police) arrived at the shipyards mere hours after the incident, and an investigation has been launched to determine who the perpetrators of this attack were, whether they were human terrorists or agents of an alien power."
             news.publishNews(text)
             self.stage = 99
         if (self.stage==99 and not VS.getSystemName()==self.system):
             self.stage += 1 # don't enter this loop anymore
             self.playernum = -1
             self.name = "quest_shipyardbomb"
             self.removeQuest()
             return 0
     return 1
Пример #2
0
    def Execute (self):
        if (self.player and self.station):
            # launches the particpating actors
            if (self.stage==1 and VS.GetGameTime()>self.timer and self.station.getDistance(self.player)<50000):
                self.stageLaunchActors()
                self.stage = 2

            # checks to see if the self.player is within 10km of the station to initiate the dispute
            if (self.stage==2 and VS.GetGameTime()>self.timer and self.station.getDistance(self.player)<15000):
                self.stageDockingDispute()
                self.talktime = VS.GetGameTime()
                self.stage = 3

            # play the talk animation
            if (self.stage==3 and VS.GetGameTime()<self.timer and VS.GetGameTime()>=self.anitime):
                # check which animation to play
                for index in range (len(self.sequence)):
                    if (VS.GetGameTime()-self.talktime>=self.sequence[index][0] and VS.GetGameTime()-self.talktime<=self.sequence[index][0]+self.sequence[index][1]):
                        # play the animation
                        self.player.commAnimation(self.animations[self.sequence[index][2]][0])
                        # this is how long one animation takes
                        self.anitime = VS.GetGameTime()+2
            if (self.stage==3 and VS.GetGameTime()>=self.timer):
                self.stage = 4

            # get the merchant to attack
            if (self.stage==4 and VS.GetGameTime()>self.timer):
                # the two ships start to attack each other
                self.merchant.SetTarget(self.socialist)
                VS.AdjustRelation(self.merchant.getFactionName(),self.socialist.getFactionName(),-5,1)
                self.merchant.LoadAIScript("default")
                # attack directive - no ai change, no target change
                self.merchant.setFgDirective("A.")
                self.timer = VS.GetGameTime()+5
                self.stage = 5

            # get the socialist to attack
            if (self.stage==5 and VS.GetGameTime()>self.timer):
                # the privateer gets involved...   or does he?
                VS.IOmessage (0,"[Lenin's Mercy]","privateer",self.socColor+"Mayday! We are under attack! Privateer, please help us...  we are no match for them. We have wounded on board!")
                VS.IOmessage (6,"[VulCorp Transport A-5]","privateer",self.merColor+"Privateer, if you look the other way... you will be duly compensated.")
                self.animations = [["com_dispute_socialist.ani",2],["com_dispute_merchant.ani",2]]
                self.sequence = [[0,6,0],[6,4,1]]
                self.talktime = VS.GetGameTime()
                VS.AdjustRelation(self.socialist.getFactionName(),self.merchant.getFactionName(),-5,1)
                self.socialist.SetTarget(self.merchant)
                self.socialist.LoadAIScript("default")
                self.socialist.setFgDirective("A.")
                self.timer = VS.GetGameTime()+10
                self.stage = 6

            # play the talk animation
            if (self.stage==6 and VS.GetGameTime()<self.timer and VS.GetGameTime()>=self.anitime):
                for index in range (len(self.sequence)):
                    if (VS.GetGameTime()-self.talktime>=self.sequence[index][0] and VS.GetGameTime()-self.talktime<=self.sequence[index][0]+self.sequence[index][1]):
                        self.player.commAnimation(self.animations[self.sequence[index][2]][0])
                        self.anitime = VS.GetGameTime()+2
            if (self.stage==6 and VS.GetGameTime()>=self.timer):
                self.stage = 7

            # we need to refresh the ai during battle since it lasts for only 7 seconds
            if (self.stage==7 and VS.GetGameTime()>self.timer):
                self.merchant.LoadAIScript("default")
                self.socialist.LoadAIScript("default")
                self.timer = VS.GetGameTime()+2

            # evaluate the conflict result
            if (self.stage==7 and self.merchant.isNull()):
                VS.IOmessage (0,"[VulCorp Transport A-5]","all",self.merColor+"Oh nooooo...!!!!!")
                self.player.commAnimation("com_dispute_merchant.ani")
                self.stage = 11
            if (self.stage==7 and self.socialist.isNull()):
                VS.IOmessage (0,"[Lenin's Mercy]","all",self.socColor+"Liberte! Egalite!! Fraternite...!!!!!")
                self.player.commAnimation("com_dispute_socialist.ani")
                self.stage = 21

            # if the merchant has died, give player the socialist reward
            if (self.stage==11 and VS.GetGameTime()>self.timer):
                self.socialist.PrimeOrders()
                VS.IOmessage (0,"[Lenin's Mercy]","privateer",self.socColor+"Thank you, Privateer! The Interstellar Socialist Organization is in your debt. We are getting our wounded to the base's medical facility.")
                VS.IOmessage (5,"[Lenin's Mercy]","privateer",self.socColor+"We have no money... but we are transmitting you the coordinates of the cargo we dumped to make room for the attack victims. Do with it what you will.")
                VS.IOmessage (10,"[Lenin's Mercy]","privateer",self.socColor+"You have made a friend with the ISO today. Have a safe journey.")
                self.animations = [["com_dispute_socialist.ani",2]]
                self.sequence = [[0,15,0]]
                self.talktime = VS.GetGameTime()
                # launches various types of cargo as reward
                # launch_wave_around_unit (fgname, faction, type, ai, nr_ships, minradius, maxradius, my_unit,logo='',useani=1,skipdj=0)
                self.cargo = launch.launch_wave_around_unit("Cargo",'neutral','iron_ore.cargo',"default",2,3000,6000,self.player)
                self.cargo = launch.launch_wave_around_unit("Cargo",'neutral','tungsten_ore.cargo',"default",2,3000,6000,self.player)
                self.cargo = launch.launch_wave_around_unit("Cargo",'neutral','generic_cargo',"default",16,3000,6000,self.player)
                # reputation with ISO goes up. Not sure of the numbers
                VS.AdjustRelation(self.player.getFactionName(),self.socialist.getFactionName(),1,5)
                # publish news
                text = "PRIVATEER SAVES SHIPLOAD OF WOUNDED\\\Today, an unprecedented dispute about landing priorities took place close to a station in the Regallis system of Sol sector. "
                text += "A merchant was delivering a priority shipment to a station in the system while an ISO transport vessel requested emergency landing having twelve rescued passengers on board who were previously wounded in a pirate attack. "
                text += "A privateer approaching that base at the same time, and assisting the dispute, reacted to the situation before security forces could arrive at the scene and promptly removed the capitalist bloodsucker, thus saving many lives. "
                text += "Presently, the injured are being taken care of at the medical facilities of the station with two heavily wounded remaining under intensive care."
                news.publishNews(text)
                # set next stage conditions
                self.timer = VS.GetGameTime()+15
                self.winner = self.socialist
                self.stage = 12

            # play the talk animation
            if (self.stage==12 and VS.GetGameTime()<self.timer and VS.GetGameTime()>=self.anitime):
                for index in range (len(self.sequence)):
                    if (VS.GetGameTime()-self.talktime>=self.sequence[index][0] and VS.GetGameTime()-self.talktime<=self.sequence[index][0]+self.sequence[index][1]):
                        self.player.commAnimation(self.animations[self.sequence[index][2]][0])
                        self.anitime = VS.GetGameTime()+2
            if (self.stage==12 and VS.GetGameTime()>=self.timer):
                self.stage = 30

            # if the merchant ship is still alive
            if (self.stage==21 and VS.GetGameTime()>self.timer):
                self.merchant.PrimeOrders()
                # if the merchant is still friends with the self.player, the merchant gives him a nice chunk of cash
                if (5 > -.1):
                    VS.IOmessage (0,"[VulCorp Transport A-5]","privateer",self.merColor+"Privateer, thank you for your cooperation.")
                    VS.IOmessage (3,"[VulCorp Transport A-5]","privateer",self.merColor+"We will be able to make a killing on this shipment thanks to you. Here are 15000 credits for your trouble.")
                    self.animations = [["com_dispute_merchant.ani",2]]
                    self.sequence = [[0,8,0]]
                    self.talktime = VS.GetGameTime()
                    self.player.addCredits(15000)
                    # rep with merchants goes up
                    VS.AdjustRelation(self.player.getFactionName(),self.merchant.getFactionName(),.1,.5)
                    # publish news
                    text = "MALICIOUS MERCHANT MASSACRES MARXIST MERCY MISSION\\\Today, an unprecedented dispute about landing priorities took place close to a station in the Regallis system of Sol sector. "
                    text += "A merchant was delivering a priority shipment to a station in the system while an ISO transport vessel requested emergency landing having twelve rescued passengers on board who were previously wounded in a pirate attack. "
                    text += "Before security forces could arrive at the scene the merchant pilot promptly applied his own justice scheme thus reducing the other vessel cum content to space dust."
                    news.publishNews(text)
                    # set next stage conditions
                    self.timer = VS.GetGameTime()+8
                    self.winner = self.merchant
                    self.stage = 22

            # play the talk animation
            if (self.stage==22 and VS.GetGameTime()<self.timer and VS.GetGameTime()>=self.anitime):
                for index in range (len(self.sequence)):
                    if (VS.GetGameTime()-self.talktime>=self.sequence[index][0] and VS.GetGameTime()-self.talktime<=self.sequence[index][0]+self.sequence[index][1]):
                        self.player.commAnimation(self.animations[self.sequence[index][2]][0])
                        self.anitime = VS.GetGameTime()+2
            if (self.stage==22 and VS.GetGameTime()>=self.timer):
                self.stage = 30

            # let the remaining ship approach the station and dock
            if (self.stage==30 and VS.GetGameTime()>self.timer):
                self.timer = VS.GetGameTime()+5
                #if (not self.station.isDocked(self.winner)):
                if (not self.winner.isNull()):
                    # performDockingOperations is unusable
                    # 1st it lets the ship fly through the stations
                    # 2nd it doesn't dock the unit
                    #self.winner.performDockingOperations(self.station,1)
                    unit.approachAndDock(self.winner,self.station)
                else:
                    self.stage = 99

            if (self.stage==99 and VS.GetGameTime()>self.timer):
                self.playernum = -1
                self.name = "quest_dispute"
                self.removeQuest()
                self.stage += 1 # don't enter this loop anymore
                return 0
        return 1
Пример #3
0
 def Execute(self):
     if (self.player):
         #print str(self.player.Position())
         # launch the actors
         if (self.stage <= self.groups and VS.GetGameTime() >= self.timer):
             #print "group: " +str(self.stage)
             self.names = fg_util.GetRandomFGNames(self.groups, "confed")
             shiptype = faction_ships.getRandomCapitolInt(
                 faction_ships.confed)
             #print "group/name: " + str(self.stage) + "/"+names[self.stage-1]
             # launch capital ships
             number = vsrandom.randrange(2, 4)
             #print ">capital/type: " +str(number)+"/"+shiptype
             location = Vector.Add(self.object.Position(),
                                   (vsrandom.uniform(-10000, 10000),
                                    vsrandom.uniform(-10000, 10000),
                                    vsrandom.uniform(-10000, 10000)))
             offset = (vsrandom.uniform(1000,
                                        2000), vsrandom.uniform(1000, 2000),
                       vsrandom.uniform(1000, 2000))
             for i in range(number):
                 #self.capital += [launch.launch_wave_around_unit(names[self.stage-1],'confed',shiptype,'sitting_duck',1,5000,20000,self.object)]
                 # launch(name,type,faction,unittype,ai,nr,nrwaves,pos,squadlogo)
                 pos = Vector.Add(location, Vector.Scale(offset, i))
                 self.capital += [
                     VS.launch(self.names[self.stage - 1], shiptype,
                               'confed', 'unit', 'sitting_duck', 1, 1, pos,
                               '')
                 ]
             # launch fighters
             number = number * vsrandom.randrange(3, 6)
             # test: Lancelot, Schroedinger, Quicksilver, Convolution
             shiptype = faction_ships.getRandomFighterInt(
                 faction_ships.confed)
             #print ">fighters/type: " + str(number) + "/" + shiptype
             ship = self.capital[0]
             for i in range(number):
                 self.fighter += [
                     launch.launch_wave_around_unit(
                         self.names[self.stage - 1], 'confed', shiptype,
                         'sitting_duck', 1, 1000, 2000, ship)
                 ]
             # change orders for capital ships
             for ship in self.capital:
                 ship.PrimeOrders()
                 unit.faceTaget(ship, self.object)
             # change orders for fighter ships
             for ship in self.fighter:
                 #unit.faceTaget(ship, self.capital[0])
                 ship.PrimeOrders()
                 #ship.SetTarget(self.capital[0])
                 ship.SetTarget(self.object)
                 #ship.UnFire()
                 #ship.setFgDirective("E.") # escort
                 ship.LoadAIScript("modules/ai_escortpatrol.py")
             # time between spawning the groups
             self.timer = VS.GetGameTime()  #+10
             self.stage += 1
         if (self.stage == self.groups + 1
                 and VS.GetGameTime() > self.timer):
             self.stage = 10
         # publish news
         if (self.stage == 10 and VS.GetGameTime() > self.timer):
             text = "JUMP POINT BLOCKADE IN " + self.system + " SYSTEM\\\Intelligence has uncovered Aeran plans to invade Confederation space."
             text += "As a preventive measure " + str(
                 self.groups
             ) + " flight groups were dispatched and stationed near the Nethuuleil jump point. "
             text += "Multiple capital vessels are guarding the jump point while a multitude of fighter escorts is patrolling nearby space."
             news.publishNews(text)
             self.timer = VS.GetGameTime() + 5
             self.stage = 11
         #make some random chatter
         if (self.stage == 11 and VS.GetGameTime() > self.timer):
             # select two pilots to chatter
             flightgroup = 1  #vsrandom.randrange(1,self.groups)
             numchatters = 0
             chatters = []
             while (numchatters < 2):
                 chatter = vsrandom.randrange(0, len(self.fighter) - 1)
                 if (self.fighter[chatter].getFlightgroupName() ==
                         self.names[flightgroup - 1]):
                     chatters += [chatter]
                     numchatters += 1
             VS.IOmessage(
                 0, unit.getUnitFullName(self.fighter[chatters[0]]), "all",
                 self.msgColor[0] + "... lousy bar on our mothership?")
             VS.IOmessage(
                 5, unit.getUnitFullName(self.fighter[chatters[1]]), "all",
                 self.msgColor[1] +
                 "Yeah, bad lighting, and no bar company besides your dull face."
             )
             VS.IOmessage(
                 10, unit.getUnitFullName(self.fighter[chatters[0]]), "all",
                 self.msgColor[0] +
                 "The drinks selection is not the best I have seen.")
             VS.IOmessage(
                 15, unit.getUnitFullName(self.fighter[chatters[1]]), "all",
                 self.msgColor[1] +
                 "And this bartender droid really gets on my nerves.")
             VS.IOmessage(
                 20, unit.getUnitFullName(self.fighter[chatters[1]]), "all",
                 self.msgColor[1] +
                 "He never stops talking for an instant.")
             VS.IOmessage(
                 25, unit.getUnitFullName(self.fighter[chatters[0]]), "all",
                 self.msgColor[0] + "Guess, we've got to live with that.")
             VS.IOmessage(30,
                          unit.getUnitFullName(self.fighter[chatters[1]]),
                          "all", self.msgColor[1] + "Yeah.")
             self.timer = VS.GetGameTime() + 240
             self.stage = 12
         if (self.stage == 12 and VS.GetGameTime() > self.timer):
             # select two pilots to chatter
             flightgroup = 2  #vsrandom.randrange(1,self.groups)
             numchatters = 0
             chatters = []
             while (numchatters < 2):
                 chatter = vsrandom.randrange(0, len(self.fighter) - 1)
                 if (self.fighter[chatter].getFlightgroupName() ==
                         self.names[flightgroup - 1]):
                     chatters += [chatter]
                     numchatters += 1
             VS.IOmessage(0,
                          unit.getUnitFullName(self.fighter[chatters[0]]),
                          "all", self.msgColor[0] + "Phil?")
             VS.IOmessage(10,
                          unit.getUnitFullName(self.fighter[chatters[1]]),
                          "all", self.msgColor[1] + "What's up, buddy?")
             VS.IOmessage(
                 15, unit.getUnitFullName(self.fighter[chatters[0]]), "all",
                 self.msgColor[0] +
                 "The rumor is the Aera are planning an invasion.")
             VS.IOmessage(
                 25, unit.getUnitFullName(self.fighter[chatters[1]]), "all",
                 self.msgColor[1] +
                 "Maybe no rumor anymore. Probably it's all over the news now."
             )
             VS.IOmessage(
                 35, unit.getUnitFullName(self.fighter[chatters[0]]), "all",
                 self.msgColor[0] +
                 "That's why we are here? Will we have to fight?")
             VS.IOmessage(40,
                          unit.getUnitFullName(self.fighter[chatters[1]]),
                          "all", self.msgColor[1] + "Calm down, youngling.")
             VS.IOmessage(
                 45, unit.getUnitFullName(self.fighter[chatters[1]]), "all",
                 self.msgColor[1] + "The war hasn't quite started yet.")
             VS.IOmessage(
                 50, unit.getUnitFullName(self.fighter[chatters[1]]), "all",
                 self.msgColor[1] +
                 "I tell ya. This operation is to prepare the worlds for the war."
             )
             VS.IOmessage(55,
                          unit.getUnitFullName(self.fighter[chatters[1]]),
                          "all",
                          self.msgColor[1] + "All staged by the higherups.")
             VS.IOmessage(
                 65, unit.getUnitFullName(self.fighter[chatters[0]]), "all",
                 self.msgColor[0] +
                 "You think so? And what if you're not right? Will you take care of my 'lil sister if I die?"
             )
             VS.IOmessage(
                 75, unit.getUnitFullName(self.fighter[chatters[1]]), "all",
                 self.msgColor[1] +
                 "Ho, ho. Now stop that blubber. Nobody's gonna die here.")
             VS.IOmessage(
                 80, unit.getUnitFullName(self.fighter[chatters[1]]), "all",
                 self.msgColor[1] +
                 "Just stick to your orders and by dinner time we'll have a big jar of Pilsner and a nice long talk."
             )
             self.timer = VS.GetGameTime() + 300
             self.stage = 13
         # just a temporary backup
         if (self.stage == 99):
             #for ship in self.fighter:
             #    ship = VS.getUnit(i)
             #    if (ship.getFlightgroupName()==names[flightgroup]):
             #        print "shipname: " + ship.getFullName()
             #        #ship.setFgDirective("E.") # escort
             #        #VS.PythonAI.XMLScript("++evade.xml")
             self.stage = 98
         #if (self.stage==99 and not VS.getSystemName()==self.system):
         if (not VS.getSystemName() == self.system):
             self.stage += 1  # don't enter this loop anymore
             self.playernum = -1
             self.name = "quest_capital"
             self.removeQuest()
             return 0
Пример #4
0
    def Execute (self):
        if (self.player and self.station):
            # launches the particpating actors
            if (self.stage==1 and VS.GetGameTime()>self.timer and self.station.getDistance(self.player)<50000):
                self.stageLaunchActors()
                self.stage = 2

            # checks to see if the self.player is within 10km of the station to initiate the dispute
            if (self.stage==2 and VS.GetGameTime()>self.timer and self.station.getDistance(self.player)<15000):
                self.stageDockingDispute()
                self.talktime = VS.GetGameTime()
                self.stage = 3

            # play the talk animation
            if (self.stage==3 and VS.GetGameTime()<self.timer and VS.GetGameTime()>=self.anitime):
                # check which animation to play
                for index in range (len(self.sequence)):
                    if (VS.GetGameTime()-self.talktime>=self.sequence[index][0] and VS.GetGameTime()-self.talktime<=self.sequence[index][0]+self.sequence[index][1]):
                        # play the animation
                        self.player.commAnimation(self.animations[self.sequence[index][2]][0])
                        # this is how long one animation takes
                        self.anitime = VS.GetGameTime()+2
            if (self.stage==3 and VS.GetGameTime()>=self.timer):
                self.stage = 4

            # get the merchant to attack
            if (self.stage==4 and VS.GetGameTime()>self.timer):
                # the two ships start to attack each other
                self.merchant.SetTarget(self.socialist)
                VS.AdjustRelation(self.merchant.getFactionName(),self.socialist.getFactionName(),-5,1)
                self.merchant.LoadAIScript("default")
                # attack directive - no ai change, no target change
                self.merchant.setFgDirective("A.")
                self.timer = VS.GetGameTime()+5
                self.stage = 5

            # get the socialist to attack
            if (self.stage==5 and VS.GetGameTime()>self.timer):
                # the privateer gets involved...   or does he?
                VS.IOmessage (0,"[Lenin's Mercy]","privateer",self.socColor+"Mayday! We are under attack! Privateer, please help us...  we are no match for them. We have wounded on board!")
                VS.IOmessage (6,"[VulCorp Transport A-5]","privateer",self.merColor+"Privateer, if you look the other way... you will be duly compensated.")
                self.animations = [["com_dispute_socialist.ani",2],["com_dispute_merchant.ani",2]]
                self.sequence = [[0,6,0],[6,4,1]]
                self.talktime = VS.GetGameTime()
                VS.AdjustRelation(self.socialist.getFactionName(),self.merchant.getFactionName(),-5,1)
                self.socialist.SetTarget(self.merchant)
                self.socialist.LoadAIScript("default")
                self.socialist.setFgDirective("A.")
                self.timer = VS.GetGameTime()+10
                self.stage = 6

            # play the talk animation
            if (self.stage==6 and VS.GetGameTime()<self.timer and VS.GetGameTime()>=self.anitime):
                for index in range (len(self.sequence)):
                    if (VS.GetGameTime()-self.talktime>=self.sequence[index][0] and VS.GetGameTime()-self.talktime<=self.sequence[index][0]+self.sequence[index][1]):
                        self.player.commAnimation(self.animations[self.sequence[index][2]][0])
                        self.anitime = VS.GetGameTime()+2
            if (self.stage==6 and VS.GetGameTime()>=self.timer):
                self.stage = 7

            # we need to refresh the ai during battle since it lasts for only 7 seconds
            if (self.stage==7 and VS.GetGameTime()>self.timer):
                self.merchant.LoadAIScript("default")
                self.socialist.LoadAIScript("default")
                self.timer = VS.GetGameTime()+2

            # evaluate the conflict result
            if (self.stage==7 and self.merchant.isNull()):
                VS.IOmessage (0,"[VulCorp Transport A-5]","all",self.merColor+"Oh nooooo...!!!!!")
                self.player.commAnimation("com_dispute_merchant.ani")
                self.stage = 11
            if (self.stage==7 and self.socialist.isNull()):
                VS.IOmessage (0,"[Lenin's Mercy]","all",self.socColor+"Liberte! Egalite!! Fraternite...!!!!!")
                self.player.commAnimation("com_dispute_socialist.ani")
                self.stage = 21

            # if the merchant has died, give player the socialist reward
            if (self.stage==11 and VS.GetGameTime()>self.timer):
                self.socialist.PrimeOrders()
                VS.IOmessage (0,"[Lenin's Mercy]","privateer",self.socColor+"Thank you, Privateer! The Interstellar Socialist Organization is in your debt. We are getting our wounded to the base's medical facility.")
                VS.IOmessage (5,"[Lenin's Mercy]","privateer",self.socColor+"We have no money... but we are transmitting you the coordinates of the cargo we dumped to make room for the attack victims. Do with it what you will.")
                VS.IOmessage (10,"[Lenin's Mercy]","privateer",self.socColor+"You have made a friend with the ISO today. Have a safe journey.")
                self.animations = [["com_dispute_socialist.ani",2]]
                self.sequence = [[0,15,0]]
                self.talktime = VS.GetGameTime()
                # launches various types of cargo as reward
                # launch_wave_around_unit (fgname, faction, type, ai, nr_ships, minradius, maxradius, my_unit,logo='',useani=1,skipdj=0)
                self.cargo = launch.launch_wave_around_unit("Cargo",'neutral','iron_ore.cargo',"default",2,3000,6000,self.player)
                self.cargo = launch.launch_wave_around_unit("Cargo",'neutral','tungsten_ore.cargo',"default",2,3000,6000,self.player)
                self.cargo = launch.launch_wave_around_unit("Cargo",'neutral','generic_cargo',"default",16,3000,6000,self.player)
                # reputation with ISO goes up. Not sure of the numbers
                VS.AdjustRelation(self.player.getFactionName(),self.socialist.getFactionName(),1,5)
                # publish news
                text = "PRIVATEER SAVES SHIPLOAD OF WOUNDED\\\Today, an unprecedented dispute about landing priorities took place close to a station in the Regallis system of Sol sector. "
                text += "A merchant was delivering a priority shipment to a station in the system while an ISO transport vessel requested emergency landing having twelve rescued passengers on board who were previously wounded in a pirate attack. "
                text += "A privateer approaching that base at the same time, and assisting the dispute, reacted to the situation before security forces could arrive at the scene and promptly removed the capitalist bloodsucker, thus saving many lives. "
                text += "Presently, the injured are being taken care of at the medical facilities of the station with two heavily wounded remaining under intensive care."
                news.publishNews(text)
                # set next stage conditions
                self.timer = VS.GetGameTime()+15
                self.winner = self.socialist
                self.stage = 12

            # play the talk animation
            if (self.stage==12 and VS.GetGameTime()<self.timer and VS.GetGameTime()>=self.anitime):
                for index in range (len(self.sequence)):
                    if (VS.GetGameTime()-self.talktime>=self.sequence[index][0] and VS.GetGameTime()-self.talktime<=self.sequence[index][0]+self.sequence[index][1]):
                        self.player.commAnimation(self.animations[self.sequence[index][2]][0])
                        self.anitime = VS.GetGameTime()+2
            if (self.stage==12 and VS.GetGameTime()>=self.timer):
                self.stage = 30

            # if the merchant ship is still alive
            if (self.stage==21 and VS.GetGameTime()>self.timer):
                self.merchant.PrimeOrders()
                # if the merchant is still friends with the self.player, the merchant gives him a nice chunk of cash
                if (5 > -.1):
                    VS.IOmessage (0,"[VulCorp Transport A-5]","privateer",self.merColor+"Privateer, thank you for your cooperation.")
                    VS.IOmessage (3,"[VulCorp Transport A-5]","privateer",self.merColor+"We will be able to make a killing on this shipment thanks to you. Here are 15000 credits for your trouble.")
                    self.animations = [["com_dispute_merchant.ani",2]]
                    self.sequence = [[0,8,0]]
                    self.talktime = VS.GetGameTime()
                    self.player.addCredits(15000)
                    # rep with merchants goes up
                    VS.AdjustRelation(self.player.getFactionName(),self.merchant.getFactionName(),.1,.5)
                    # publish news
                    text = "MALICIOUS MERCHANT MASSACRES MARXIST MERCY MISSION\\\Today, an unprecedented dispute about landing priorities took place close to a station in the Regallis system of Sol sector. "
                    text += "A merchant was delivering a priority shipment to a station in the system while an ISO transport vessel requested emergency landing having twelve rescued passengers on board who were previously wounded in a pirate attack. "
                    text += "Before security forces could arrive at the scene the merchant pilot promptly applied his own justice scheme thus reducing the other vessel cum content to space dust."
                    news.publishNews(text)
                    # set next stage conditions
                    self.timer = VS.GetGameTime()+8
                    self.winner = self.merchant
                    self.stage = 22

            # play the talk animation
            if (self.stage==22 and VS.GetGameTime()<self.timer and VS.GetGameTime()>=self.anitime):
                for index in range (len(self.sequence)):
                    if (VS.GetGameTime()-self.talktime>=self.sequence[index][0] and VS.GetGameTime()-self.talktime<=self.sequence[index][0]+self.sequence[index][1]):
                        self.player.commAnimation(self.animations[self.sequence[index][2]][0])
                        self.anitime = VS.GetGameTime()+2
            if (self.stage==22 and VS.GetGameTime()>=self.timer):
                self.stage = 30

            # let the remaining ship approach the station and dock
            if (self.stage==30 and VS.GetGameTime()>self.timer):
                self.timer = VS.GetGameTime()+5
                #if (not self.station.isDocked(self.winner)):
                if (not self.winner.isNull()):
                    # performDockingOperations is unusable
                    # 1st it lets the ship fly through the stations
                    # 2nd it doesn't dock the unit
                    #self.winner.performDockingOperations(self.station,1)
                    unit.approachAndDock(self.winner,self.station)
                else:
                    self.stage = 99

            if (self.stage==99 and VS.GetGameTime()>self.timer):
                self.playernum = -1
                self.name = "quest_dispute"
                self.removeQuest()
                self.stage += 1 # don't enter this loop anymore
                return 0
        return 1
Пример #5
0
 def Execute (self):
     if (self.player):
         #print str(self.player.Position())
         # launch the actors
         if (self.stage<=self.groups and VS.GetGameTime()>=self.timer):
             #print "group: " +str(self.stage)
             self.names = fg_util.GetRandomFGNames(self.groups,"confed")
             shiptype = faction_ships.getRandomCapitolInt(faction_ships.confed)
             #print "group/name: " + str(self.stage) + "/"+names[self.stage-1]
             # launch capital ships
             number = vsrandom.randrange(2,4)
             #print ">capital/type: " +str(number)+"/"+shiptype
             location = Vector.Add (self.object.Position(),(vsrandom.uniform(-10000,10000),
                                    vsrandom.uniform(-10000,10000),
                                    vsrandom.uniform(-10000,10000)))
             offset = (vsrandom.uniform(1000,2000),vsrandom.uniform(1000,2000),vsrandom.uniform(1000,2000))
             for i in range(number):
                 #self.capital += [launch.launch_wave_around_unit(names[self.stage-1],'confed',shiptype,'sitting_duck',1,5000,20000,self.object)]
                 # launch(name,type,faction,unittype,ai,nr,nrwaves,pos,squadlogo)
                 pos = Vector.Add (location,Vector.Scale(offset,i))
                 self.capital += [VS.launch(self.names[self.stage-1],shiptype,'confed','unit','sitting_duck',1,1,pos,'')]
             # launch fighters
             number = number*vsrandom.randrange(3,6)
             # test: Lancelot, Schroedinger, Quicksilver, Convolution
             shiptype = faction_ships.getRandomFighterInt(faction_ships.confed)
             #print ">fighters/type: " + str(number) + "/" + shiptype
             ship = self.capital[0]
             for i in range(number):
                 self.fighter += [launch.launch_wave_around_unit(self.names[self.stage-1],'confed',shiptype,'sitting_duck',1,1000,2000,ship)]
             # change orders for capital ships
             for ship in self.capital:
                 ship.PrimeOrders()
                 unit.faceTaget(ship, self.object)
             # change orders for fighter ships
             for ship in self.fighter:
                 #unit.faceTaget(ship, self.capital[0])
                 ship.PrimeOrders()
                 #ship.SetTarget(self.capital[0])
                 ship.SetTarget(self.object)
                 #ship.UnFire()
                 #ship.setFgDirective("E.") # escort
                 ship.LoadAIScript("modules/ai_escortpatrol.py")
             # time between spawning the groups
             self.timer = VS.GetGameTime() #+10
             self.stage += 1
         if (self.stage==self.groups+1 and VS.GetGameTime()>self.timer):
             self.stage = 10
         # publish news
         if (self.stage==10 and VS.GetGameTime()>self.timer):
             text = "JUMP POINT BLOCKADE IN " + self.system + " SYSTEM\\\Intelligence has uncovered Aeran plans to invade Confederation space."
             text += "As a preventive measure " + str(self.groups) + " flight groups were dispatched and stationed near the Nethuuleil jump point. "
             text += "Multiple capital vessels are guarding the jump point while a multitude of fighter escorts is patrolling nearby space."
             news.publishNews(text)
             self.timer = VS.GetGameTime()+5
             self.stage = 11
         #make some random chatter
         if (self.stage==11 and VS.GetGameTime()>self.timer):
             # select two pilots to chatter
             flightgroup = 1 #vsrandom.randrange(1,self.groups)
             numchatters = 0
             chatters = []
             while (numchatters<2):
                 chatter = vsrandom.randrange(0,len(self.fighter)-1)
                 if (self.fighter[chatter].getFlightgroupName()==self.names[flightgroup-1]):
                     chatters += [chatter]
                     numchatters += 1
             VS.IOmessage (0,unit.getUnitFullName(self.fighter[chatters[0]]),"all",self.msgColor[0]+"... lousy bar on our mothership?")
             VS.IOmessage (5,unit.getUnitFullName(self.fighter[chatters[1]]),"all",self.msgColor[1]+"Yeah, bad lighting, and no bar company besides your dull face.")
             VS.IOmessage (10,unit.getUnitFullName(self.fighter[chatters[0]]),"all",self.msgColor[0]+"The drinks selection is not the best I have seen.")
             VS.IOmessage (15,unit.getUnitFullName(self.fighter[chatters[1]]),"all",self.msgColor[1]+"And this bartender droid really gets on my nerves.")
             VS.IOmessage (20,unit.getUnitFullName(self.fighter[chatters[1]]),"all",self.msgColor[1]+"He never stops talking for an instant.")
             VS.IOmessage (25,unit.getUnitFullName(self.fighter[chatters[0]]),"all",self.msgColor[0]+"Guess, we've got to live with that.")
             VS.IOmessage (30,unit.getUnitFullName(self.fighter[chatters[1]]),"all",self.msgColor[1]+"Yeah.")
             self.timer = VS.GetGameTime()+240
             self.stage = 12
         if (self.stage==12 and VS.GetGameTime()>self.timer):
             # select two pilots to chatter
             flightgroup = 2 #vsrandom.randrange(1,self.groups)
             numchatters = 0
             chatters = []
             while (numchatters<2):
                 chatter = vsrandom.randrange(0,len(self.fighter)-1)
                 if (self.fighter[chatter].getFlightgroupName()==self.names[flightgroup-1]):
                     chatters += [chatter]
                     numchatters += 1
             VS.IOmessage (0,unit.getUnitFullName(self.fighter[chatters[0]]),"all",self.msgColor[0]+"Phil?")
             VS.IOmessage (10,unit.getUnitFullName(self.fighter[chatters[1]]),"all",self.msgColor[1]+"What's up, buddy?")
             VS.IOmessage (15,unit.getUnitFullName(self.fighter[chatters[0]]),"all",self.msgColor[0]+"The rumor is the Aera are planning an invasion.")
             VS.IOmessage (25,unit.getUnitFullName(self.fighter[chatters[1]]),"all",self.msgColor[1]+"Maybe no rumor anymore. Probably it's all over the news now.")
             VS.IOmessage (35,unit.getUnitFullName(self.fighter[chatters[0]]),"all",self.msgColor[0]+"That's why we are here? Will we have to fight?")
             VS.IOmessage (40,unit.getUnitFullName(self.fighter[chatters[1]]),"all",self.msgColor[1]+"Calm down, youngling.")
             VS.IOmessage (45,unit.getUnitFullName(self.fighter[chatters[1]]),"all",self.msgColor[1]+"The war hasn't quite started yet.")
             VS.IOmessage (50,unit.getUnitFullName(self.fighter[chatters[1]]),"all",self.msgColor[1]+"I tell ya. This operation is to prepare the worlds for the war.")
             VS.IOmessage (55,unit.getUnitFullName(self.fighter[chatters[1]]),"all",self.msgColor[1]+"All staged by the higherups.")
             VS.IOmessage (65,unit.getUnitFullName(self.fighter[chatters[0]]),"all",self.msgColor[0]+"You think so? And what if you're not right? Will you take care of my 'lil sister if I die?")
             VS.IOmessage (75,unit.getUnitFullName(self.fighter[chatters[1]]),"all",self.msgColor[1]+"Ho, ho. Now stop that blubber. Nobody's gonna die here.")
             VS.IOmessage (80,unit.getUnitFullName(self.fighter[chatters[1]]),"all",self.msgColor[1]+"Just stick to your orders and by dinner time we'll have a big jar of Pilsner and a nice long talk.")
             self.timer = VS.GetGameTime()+300
             self.stage = 13
         # just a temporary backup
         if (self.stage==99):
             #for ship in self.fighter:
             #    ship = VS.getUnit(i)
             #    if (ship.getFlightgroupName()==names[flightgroup]):
             #        print "shipname: " + ship.getFullName()
             #        #ship.setFgDirective("E.") # escort
             #        #VS.PythonAI.XMLScript("++evade.xml")
             self.stage = 98
         #if (self.stage==99 and not VS.getSystemName()==self.system):
         if (not VS.getSystemName()==self.system):
             self.stage += 1 # don't enter this loop anymore
             self.playernum = -1
             self.name = "quest_capital"
             self.removeQuest()
             return 0