//------------------------------------------------ // rescue.script // Brandon Reinhart //------------------------------------------------ /* - Spawn rescue ship. */ //------------------------------------------------ // Includes //------------------------------------------------ include library.space_create; include library.space_quest; include library.space_utils; include library.space_crafting; include library.space_transition; include library.utils; include library.ship_ai; include library.prose; //------------------------------------------------ // Inherits //------------------------------------------------ inherits space.quest_logic.recovery; //------------------------------------------------ // Constants //------------------------------------------------ // Strings const string_id SID_ABANDONED_RESCUE = new string_id( "space/quest", "rescue_abandoned" ); //------------------------------------------------ // OnAttach //------------------------------------------------ trigger OnAttach() { // Set up quest specific objvars. string questName = getStringObjVar( self, space_quest.QUEST_NAME ); string questType = getStringObjVar( self, space_quest.QUEST_TYPE ); obj_id player = getObjIdObjVar( self, space_quest.QUEST_OWNER ); if ( (questName == null) || (questType == null) ) { // Failed to find basic quest info. return SCRIPT_OVERRIDE; } string qTable = "datatables/spacequest/"+questType+"/"+questName+".iff"; dictionary questInfo = dataTableGetRow( qTable, 0 ); if ( questInfo == null ) { // Failed to find quest info. sendSystemMessageTestingOnly( player, "Debug: Failed to open quest table "+qTable ); return SCRIPT_OVERRIDE; } // Determine the amount of time to elapse before arrival. setObjVar( self, "targetArrivalDelay", questInfo.getInt("targetArrivalDelay") ); // Determine the amount of time to elapse before conversion. setObjVar( self, "targetRecoverTime", questInfo.getInt("targetRecoverTime") ); // Determine the type of ship being rescued. string targetShip = questInfo.getString("targetShipType"); if ( targetShip != null ) setObjVar( self, "targetShipType", targetShip ); // Get attack info. int numAttackShipLists = questInfo.getInt( "numAttackShipLists" ); setObjVar( self, "numAttackShipLists", numAttackShipLists ); for ( int i=0; i 25.f ) setShipEngineSpeedMaximum( ship, 23.f + rand()*5.f ); // Disable the ship. dictionary outp = new dictionary(); outp.put( "objShip", space_transition.getContainingShip( player ) ); messageTo( ship, "disableSelf", outp, 1.f, false ); // Set the pilot's appearance. string rescueAppearance = getStringObjVar( self, "rescueAppearance" ); if ( rescueAppearance != null ) { setObjVar( ship, "convo.appearance", rescueAppearance ); } // Move the waypoint? // This is a HACK. messageTo( self, "updateTargetWaypoint", null, 1.f, false ); /* // Set up the ship's patrol path. transform[] translist = getPathTransforms( self, true ); ship_ai.unitAddPatrolPath( ship, translist ); dictionary outparams = new dictionary(); outparams.put( "quest", self ); outparams.put( "loc", getLocationObjVar( self, "last_loc" ) ); outparams.put( "player", player ); outparams.put( "dest", "escape" ); messageTo( ship, "registerDestination", outparams, 1.f, false ); */ /* // Warp in support ships. string[] shipTypes = getStringArrayObjVar( self, "escortShips" ); obj_id[] escorts = new obj_id[shipTypes.length]; for ( int i=0; i