MCP not deploying AT ALL?


(Pytox) #1

This is my script file of wake island map, I have a problem that my spawns do not work correctly and also MCP doesn’t deploy after I build bridge, hopefully someone here can fix it??
I made it work once but lost working .script file :frowning:

// Build the bridge
  // ----------------------------
  
 #define OBJECTIVE_WAKE_BUILD_BRIDGE	                0 

 // Capture Outpost before barrier ( Launch SSM but shield generator stops it )
 // ----------------------------
  
#define OBJECTIVE_WAKE_CAPTURE_OUTPOST	                1

  // HACK SHIELD GENERATOR
  // ----------------------------
  
#define OBJECTIVE_WAKE_HACK_OBJECTIVE			2

  // Destroy the stroggifier.
  // ----------------------------
  
 #define OBJECTIVE_WAKE_DESTROY_STROGGIFIER	       3
  
object mapObject_Wake: mapObject_Default {

    // ----------------------------
	
  	void		InitObjectives();

  	void		CompleteObjective( float index, entity p );


  	void		StartFirstObjective();
    	void        	StartSecondObjective();
	
  // ----------------------------
  
  	void		OnConstructionComplete( entity obj );
  	void		OnDestructionComplete( entity obj );
    void		OnServiceDoorDestroyed();

  // ----------------------------
	
	void		OnBridgeBuilt();

  // ----------------------------
	
	void		OnDeviceDestroyed();
	
  // ----------------------------
  	
	void		OnGuardTower1Built();
  	void		OnGuardTower1Destroyed();
  	boolean		guardTower1Built;
   
   // ----------------------------
  	
	void		OnTimeLimitHit();
  	void		OnOutpostCaptured();
  	void		FireScudThread();
	void		ScudExploded( entity scud );
  	
  // ----------------------------
  
  	handle		GetObjectiveMessage( float index );
	
  // ----------------------------
  
    void		OnMCPSpawned( entity obj );
  	void		OnMCPDestroyed( entity obj, vector newLocation, vector newAngles );
    void		ClearMCPData();
  	void		OnMCPDelivered( entity obj );
	
  // ----------------------------
  
    float		mainObjectiveIndex;
        
  // ----------------------------
  
    entity      scudTrigger;
	
  // ----------------------------
  
    void        StartShieldObjective();
    void        OnShieldDestroyedScud( entity trigger );
    void        OnShieldHacked();
    void        OnShieldDeployed( entity obj, entity trigger );
    void        OnHackComplete( entity obj );
    void        OnHackObjective();
	
  // ----------------------------
	  
 	handle		GetObjectiveMessage( float index );
  	float		mainObjectiveIndex;

  // ----------------------------

  	entity		stroggBaseTerritory;
  	entity		gdfmcpTerritory	;
  	entity		gdfBaseTerritory;
  	entity      	stroggBase2Territory;
	entity      	stroggNorthTerritory;
	entity 		westTerritory;
	
	entity		bridgeConstruction;	

  	entity		stroggBaseSpawn;
	entity		west_spawn;
	entity		strogg_generator_spawn;
	entity		north_spawn_master;	
	entity		gdf_base_spawn_master;
	entity 		capturable_spawn_gdf;
	entity		bridge_spawn;
	
	entity		gdf_capturable_spawn2;
	
	entity		gdf_base_trojan_1;
	entity		gdf_base_husky_1;
	entity		gdf_base_husky_2;
	entity		gdf_base_badger_1;

	entity		stroggship_strogg_spawn_1;
	entity		stroggship_strogg_spawn_2;
	
	entity		stroggship_gdf_capturablespawn_1;
	
  	entity		objective1Marker;

  	entity		securityControls;
  	entity		serviceDoor;

  	entity		serviceDoorDestroyed;
  	entity		serviceHatch;

  	entity		guardTower1;
  	entity		guardTower1Construction;

  	entity		noplant_serviceDoor;
  	entity		noplant_securityControls;

  	entity 		endCameraA;
  	entity 		endCameraB;

	entity		mcpRoute;
  	entity		mcpCaller;
	entity      	ssm_target;	
	entity	    	currentMCP;
	entity	    	objective1;
	
	entity		mcp_gate2;
	
	entity		gate_destroyed;
        
	entity		func_door_gdf_breakable;
	entity		func_door_gdf_slave;
	entity		func_door_gdf_slave_2;
	entity		func_door_gdf_slave_3;
                
	entity		gdf_aagun;
	entity		gdf_apgun;
	entity		gdf_apgun2;
	entity		gdf_apgun3;

	entity      device;
   	entity	    shieldCaller;

  	cvar 		debug_script;
  }

   mapObject_Base Wake_MapScript() {
  	return new mapObject_Wake;
  }

  void mapObject_Wake::InitObjectives() {
  	gameRules.setWinningTeam( gdfTeam );
  	gdfTeam.SetRespawnWait( 20 );
  	stroggTeam.SetRespawnWait( 20 );
  	CreateRespawnTimeThread( stroggTeam );


  // ----------------------------

  	stroggBaseTerritory			= worldspawn.getEntityKey( "script_strogg_base_territory" );
  	gdfmcpTerritory	                 	= worldspawn.getEntityKey( "script_gdf_mcp_deployzone" );
  	gdfBaseTerritory			= worldspawn.getEntityKey( "script_gdf_base_territory" );
    	stroggBase2Territory                    = worldspawn.getEntityKey( "script_strogg_base2_territory" );
    	stroggNorthTerritory                    = worldspawn.getEntityKey( "script_strogg_north_territory" );
	westTerritory 				=worldspawn.getEntityKey( "script_west_village_territory" );
	
	bridgeConstruction		= worldspawn.getEntityKey( "script_bridge_materials" );

  	stroggBaseSpawn				= worldspawn.getEntityKey( "script_strogg_base_spawn" );

	west_spawn					= worldspawn.getEntityKey( "script_west_spawn" );
	bridge_spawn					= worldspawn.getEntityKey( "script_bridge_spawn" );
	strogg_generator_spawn		= worldspawn.getEntityKey( "script_strogg_generator_spawn" );
	north_spawn_master			= worldspawn.getEntityKey( "script_north_spawn_master" );
	gdf_base_spawn_master		= worldspawn.getEntityKey( "script_gdf_base_spawn_master" );
	capturable_spawn_gdf		=worldspawn.getEntityKey( "script_capturable_spawn_gdf_1" );		
	
	gdf_capturable_spawn2		= worldspawn.getEntityKey( "script_gdf_capturable_spawn2");
	
	gdf_base_trojan_1			=worldspawn.getEntityKey( "script_gdf_base_trojan_1" );
	gdf_base_husky_1			=worldspawn.getEntityKey( "script_gdf_base_husky_1" );
	gdf_base_husky_2			=worldspawn.getEntityKey( "script_gdf_base_husky_2" );
	gdf_base_badger_1			=worldspawn.getEntityKey( "script_gdf_base_badger_1" );
	
	stroggship_strogg_spawn_1 	= worldspawn.getEntityKey( "script_stroggship_strogg_spawn_1" );
	stroggship_strogg_spawn_2 	= worldspawn.getEntityKey( "script_stroggship_strogg_spawn_2" );
	
	stroggship_gdf_capturablespawn_1 = worldspawn.getEntityKey( "stroggship_gdf_capturablespawn_1" );

  	objective1Marker			= worldspawn.getEntityKey( "script_security_controls_marker" );
	
 	mcp_gate2					= worldspawn.getEntityKey("script_mcp_gate2");
	
  	securityControls			= worldspawn.getEntityKey( "script_security_controls" );
  	serviceDoor					= worldspawn.getEntityKey( "script_service_door" );
  
  	serviceDoorDestroyed		= worldspawn.getEntityKey( "script_service_door_destroyed" );
  	serviceHatch				= worldspawn.getEntityKey( "script_service_room_hatch" );
  
  	guardTower1					= worldspawn.getEntityKey( "script_guard_tower_1_object" );
  	guardTower1Construction		= worldspawn.getEntityKey( "script_guard_tower_1" );

  	noplant_serviceDoor			= worldspawn.getEntityKey( "script_noplant_service_door" );
  	noplant_securityControls	= worldspawn.getEntityKey( "script_noplant_security_controls" );
  
  	endCameraA					= worldspawn.getEntityKey( "script_end_camera_a" );
  	endCameraB					= worldspawn.getEntityKey( "script_end_camera_b" );
  
    	mcpRoute			= worldspawn.getEntityKey( "script_mcp_route" );
  	mcpCaller			= worldspawn.getEntityKey( "script_mcp_caller" );
  	ssm_target          = worldspawn.getEntityKey( "script_ssm_target" );
  	objective1		    = worldspawn.getEntityKey( "script_obj1_marker" );
	
    	shieldCaller                    = worldspawn.getEntityKey( "script_shieldgen_caller" );
    	        
    	gdf_aagun	= worldspawn.getEntityKey("script_gdf_aagun");
	gdf_apgun	= worldspawn.getEntityKey("script_gdf_apgun");
	gdf_apgun2	= worldspawn.getEntityKey("script_gdf_apgun2");
	gdf_apgun3	= worldspawn.getEntityKey("script_gdf_apgun3");
	
	gate_destroyed = worldspawn.getEntityKey("script_gates_destroyed");
	
	func_door_gdf_breakable = worldspawn.getEntityKey("script_mop_func_door_gdf_breakable");
	func_door_gdf_slave = worldspawn.getEntityKey("script_mop_func_door_gdf_slave");
	func_door_gdf_slave_2 = worldspawn.getEntityKey("script_mop_func_door_gdf_slave_2");
	func_door_gdf_slave_3 = worldspawn.getEntityKey("script_mop_func_door_gdf_slave_3");
  
  	debug_script				= sys.getCVar( "bot_debugMapScript", "1" );
  
  	CreateDeployTasks();
  
  // ==========================================

	westTerritory.setGameTeam( stroggTeam);
     	stroggBaseTerritory.setGameTeam( stroggTeam );
	gdfBaseTerritory.setGameTeam( stroggTeam );
    	stroggNorthTerritory.setGameTeam( stroggTeam );
  	stroggBase2Territory.setGameTeam( stroggTeam );
  	gdfmcpTerritory.setGameTeam( gdfTeam );
	
	west_spawn.setGameTeam( gdfTeam );
	west_spawn.setActive( true );	

	north_spawn_master.setGameTeam( stroggTeam );
	north_spawn_master.setActive( true );
	
	gdf_base_spawn_master.setGameTeam( stroggTeam );

  	objective1Marker.vStartObjective();
 

  	gameRules.setEndGameCamera( endCameraB );
  
  	serviceDoorDestroyed.hide();
	  
  	guardTower1Built = false;
  	guardTower1Construction.vCreateMission();
	
	gdf_aagun.setGameTeam( stroggTeam );
	gdf_apgun.setGameTeam( stroggTeam );
	gdf_apgun2.setGameTeam( stroggTeam );
	gdf_apgun3.setGameTeam( stroggTeam );
  
  	thread StartFirstObjective();
  }

  // ==========================================
  
  void mapObject_Wake::StartFirstObjective() {
  	sys.wait( 5.f );
	/*
  	objManager.SetObjectiveEntity( securityControls, mainObjectiveIndex );
  
  	CreateInitialTimedMission( securityControls );
  	securityControls.vCreateMission();
  	serviceDoor.vCreateMission();
	*/
  }
  
  void mapObject_Wake::CompleteObjective( float index, entity p ) {
  	if( index == OBJECTIVE_WAKE_BUILD_BRIDGE ) {
		//StartSecondObjective();
		OnBridgeBuilt();
    	} else if( index == OBJECTIVE_WAKE_CAPTURE_OUTPOST ) {
		OnOutpostCaptured();
	} else if ( index == OBJECTIVE_WAKE_HACK_OBJECTIVE ) {
		OnHackObjective();	
	} else if ( index == OBJECTIVE_WAKE_DESTROY_STROGGIFIER ) {
		OnDeviceDestroyed();
	}
}


  handle mapObject_Wake::GetObjectiveMessage( float index ) {
	if ( index == OBJECTIVE_WAKE_BUILD_BRIDGE ) {
		return sys.localizeString( "maps/valley/obj_bridge" );
	   } 
   	if ( index == OBJECTIVE_WAKE_CAPTURE_OUTPOST ) {
	   	return sys.localizeString( "maps/valley/obj_outpost" );
	   }
	if ( index == OBJECTIVE_WAKE_HACK_OBJECTIVE ) {
		return sys.localizeString( "maps/valley/obj_depot" );
	}
	if ( index == OBJECTIVE_WAKE_DESTROY_STROGGIFIER ) {
       		return sys.localizeString( "maps/valley/obj_contaminator" );
	}  

   	 return g_locStr_BadObjective;
  }


  void mapObject_Wake::OnConstructionComplete( entity obj ) {
      if ( obj == guardTower1Construction ) {
          OnGuardTower1Built();
      }
  }
  
  void mapObject_Wake::OnDestructionComplete( entity obj ) {
      if ( obj == guardTower1Construction ) {
          OnGuardTower1Destroyed();
  	} else if ( obj == serviceDoor ) {
  		OnServiceDoorDestroyed();
  	}
  }
  
  void mapObject_Wake::OnGuardTower1Built() {
  	guardTower1Built = true;
  	guardTower1Construction.vCompleteMission();
  }
  
  void mapObject_Wake::OnGuardTower1Destroyed() {
  	guardTower1Built = false;
  	guardTower1.vCompleteMission();
  }
  
  void mapObject_Wake::OnServiceDoorDestroyed() {
  	serviceDoor.vCompleteMission();
  	noplant_serviceDoor.remove();
  	serviceHatch.remove();
  	serviceDoorDestroyed.show();
  }


  void mapObject_Wake::StartSecondObjective() {
	

 }

   void mapObject_Wake::OnShieldHacked() {
     objManager.SetObjectiveEntity( $null_entity, -1 );
     StopTimedMission();
     scudTrigger.vCompleteMission();
 }

  void mapObject_Wake::OnHackObjective() {

         sys.print( "*****SHIELD HACKED*****
" );

        mainObjectiveIndex = OBJECTIVE_WAKE_BUILD_BRIDGE;
        objManager.setNextObjective( gdfTeam, mainObjectiveIndex );
        objManager.setNextObjective( stroggTeam, mainObjectiveIndex );

        device.vStartObjective();

        scudTrigger.vFreeMission();

        objManager.SetObjectiveEntity( device, mainObjectiveIndex );
        CreateInitialTimedMission( device );
		
		west_spawn.setActive(false);
		
		
		
		gdf_capturable_spawn2.setActive( false );
		gdf_capturable_spawn2.setGameTeam( gdfTeam );
		
		

      void mapObject_Wake::ClearMCPData() {
  	if ( currentMCP != $null_entity ) {
  		currentMCP.vFreeMission();
 		currentMCP = $null_entity;
 	}
  }

  void mapObject_Wake::OnMCPSpawned( entity obj ) {
  	ClearMCPData();
  	sys.print( "^7*********mcp spawned******
" ) ;

  }
  


  void mapObject_Wake::OnMCPDestroyed( entity obj, vector newLocation, vector newAngles ) {
          sys.print( "^7********mcp destroyed******
" ) ;
          if ( currentMCP != obj ) {
  		return;
  	}
  
  	ClearMCPData();
  	mcpCaller.vCallDrop( newLocation, newAngles );
  }


  void mapObject_Wake::OnMCPDelivered( entity obj ) {
             ClearMCPData();
  		sys.print( "^7*********mcp delivered******
" ) ;
  		currentMCP = obj;
  		objManager.SetObjectiveEntity( currentMCP, mainObjectiveIndex );
  		currentMCP.vSetGoalMarker( objective1);
  		//currentMCP.vSetPathTargets( mcpCaller.getWorldOrigin(), objective1.getWorldOrigin() );
  		currentMCP.setTrackerEntity( mcpRoute );
  		currentMCP.vCreateMission();
  		CreateInitialTimedMission( currentMCP );
		
		north_spawn_master.setActive( false );
		
		gdf_base_spawn_master.setActive( true );
		gdf_base_spawn_master.setGameTeam( gdfTeam );
		
		stroggBaseSpawn.setActive( true );
		stroggBaseSpawn.setGameTeam ( stroggTeam );
		
  //	}
  }
  
  
   void mapObject_Wake::OnOutpostCaptured() {
    mainObjectiveIndex = OBJECTIVE_WAKE_CAPTURE_OUTPOST;
    objManager.setNextObjective( gdfTeam, mainObjectiveIndex );
    objManager.setNextObjective( stroggTeam, mainObjectiveIndex );

    gdfmcpTerritory.setGameTeam( gdfTeam );

    objManager.SetObjectiveEntity( $null_entity, -1 );

    if ( currentMCP != $null_entity ) {
        currentMCP.vCompleteMission();
    }
    StopTimedMission();  	

    shieldCaller.vOnDeploy();

    G_PlayObjectiveCompletedRoll( GDF );
    objManager.PlaySound( worldspawn.getKey( "snd_outpost_captured_strogg" ), stroggTeam );
    objManager.PlaySound( worldspawn.getKey( "snd_outpost_captured_gdf" ), gdfTeam );

    gdfTeam.SetRespawnWait( 20 );
    stroggTeam.SetRespawnWait( 20 );
    ResetRespawnTimeThread();
  //  thread     FireScudThread();
}

void mapObject_Wake::OnDeviceDestroyed() {
	StopTimedMission();

	gameRules.setEndGameCamera( endCameraA );

	gameRules.setWinningTeam( gdfTeam );
	gameRules.endGame();

}


void mapObject_Wake::OnBridgeBuilt() {
	west_spawn.setActive( false );
	bridge_spawn.setActive( true );
	bridge_spawn.setGameTeam( gdfTeam );

	mcpCaller.vOnDeploy();

	gdfTeam.SetRespawnWait( 15 );
	ResetRespawnTimeThread();
}

void mapObject_Wake::OnShieldDeployed( entity obj, entity trigger ) {
    scudTrigger = trigger;
    scudTrigger.vStartObjective();
    }

    void mapObject_Wake::OnHackComplete( entity obj ) {
    if ( obj == scudTrigger )
         {
        OnShieldHacked();
        }
    }
       void mapObject_Wake::StartShieldObjective() {
        sys.wait( 5.f );
    
        scudTrigger.vSetActive( true );
        CreateInitialTimedMission( scudTrigger );
        scudTrigger.vCreateMission();
        objManager.SetObjectiveEntity( scudTrigger, mainObjectiveIndex );
    }
        void mapObject_Wake::OnShieldDestroyedScud( entity trigger ) {
        thread StartShieldObjective();
    }
	
	 void mapObject_Wake::FireScudThread() {
  	sys.wait( 15.0f );
         	sys.print( "^7*********ssm fired******
" ) ;
  
  	while ( true ) {
  		if ( G_TryFireScud( $null_entity, ssm_target ) ) {
  			break;
  		}
  
  		sys.wait( 0.5f );
  	}
          objManager.PlaySound( worldspawn.getKey( "snd_launched_strogg" ), stroggTeam );
  	objManager.PlaySound( worldspawn.getKey( "snd_launched_gdf" ), gdfTeam );
  
          void mapObject_Wake::ScudExploded( entity scud ) {
		  
		  	func_door_gdf_breakable.remove();
			func_door_gdf_slave.remove();
			func_door_gdf_slave_2.remove();
			func_door_gdf_slave_3.remove();
			gdf_aagun.remove();
			gdf_apgun.remove();
			gdf_apgun2.remove();
			gdf_apgun3.remove();
			
			mcp_gate2.remove();
			
			gdf_base_trojan_1.remove();
			gdf_base_husky_1.remove();
			gdf_base_husky_2.remove();
			gdf_base_badger_1.remove();
			
			gate_destroyed.show();
			
         sys.print( "*********ssm detonated******" ) ;
          StopTimedMission();
          	  
        }
    }
	
    void mapObject_Wake::OnTimeLimitHit() {
    	FinishTimedMission();

    	objManager.SetObjectiveEntity( $null_entity, -1 );


     }
  }


(.Chris.) #2

Make sure all your masks are correct, all your territories are correct.


(Pytox) #3

I guess they’re correct … :rolleyes:


(iwound) #4

what error messages are you getting. they are your biggest clue.


(Pytox) #5

Only error message that could be problem might be this one:
Thread ‘constructible_materials_bridge_2’ : Virtual function call on a NULL entity


(iwound) #6

thats not related. its been a while since i setup an mcp.
you need to give us more information about how you set it up.
entities etc


(pazur) #7

I think this example map that comes with the SDK has a MCP (from what I remember).