home *** CD-ROM | disk | FTP | other *** search
/ PC PowerPlay 58 / pcpp58b_TRIBES.iso / Tribes / base / scripts.vol / Training_Vehicles.cs < prev    next >
Encoding:
Text File  |  1998-12-16  |  12.8 KB  |  346 lines

  1. //Training_Vehicle.cs
  2. //////////////////////////
  3. exec("game.cs");
  4. exec("training_AI.cs");
  5.  
  6. //Globals
  7. //////////////////////////
  8. $Train::missionType = "VEHICLE";
  9. $currentLeg = 0;
  10. //vehicle buy limits
  11. $TeamItemMax[ScoutVehicle] = 50;
  12. $TeamItemMax[HAPCVehicle] = 50;
  13. $TeamItemMax[LAPCVehicle] = 50;
  14. //crash respawn warps
  15. $spawn[1] = "-38.9365 43.7014 114.682";
  16. $spawn[2] = "-522.794 768.53 135.786";
  17. $spawn[3] = "-1487.25 1201.25 115.386";
  18.  
  19.  
  20. //---------------------------
  21. //vehicle::leg1()
  22. //---------------------------
  23. function vehicle::leg1(%clientId)
  24. {
  25.     schedule("bottomprint(" @ %clientId @ ", \"<f1><jc>In front of you is a vehicle station that is used for buying vehicles. When you step up to it, you get the Vehicle Inventory screen.\", 10);", 0);
  26.     schedule("messageAll(0, \"~wshell_click.wav\");", 0);
  27.     schedule("bottomprint(" @ %clientId @ ", \"<f1><jc>Step up to the panel and the Inventory screen will apear in front of you.\", 10);", 10);
  28.     schedule("messageAll(0, \"~wshell_click.wav\");", 10);
  29.     schedule("bottomprint(" @ %clientId @ ", \"<f1><jc>The right side of the menu is the available inventory you can purchase. Select the Scout from the right side menu.\", 10);", 20);
  30.     schedule("messageAll(0, \"~wshell_click.wav\");", 20);
  31.     schedule("bottomprint(" @ %clientId @ ", \"<f1><jc>Click on the BUY button to purchase the Scout.  To return to the play screen, click on the X button in the upper right hand corner of the screen or hit the inventory(I) key.\", 10);", 30);
  32.     schedule("messageAll(0, \"~wshell_click.wav\");", 30);
  33.     schedule("bottomprint(" @ %clientId @ ", \"<f1><jc>Once the scout is purchased, a scout vehicle will appear on the vehicle pad that is at the front of the vehicle bay. Once you buy the scout, a waypoint to the next station will be assigned to you.\", 10);", 40);
  34.     schedule("messageAll(0, \"~wshell_click.wav\");", 40);
  35.     schedule("bottomprint(" @ %clientId @ ", \"<f1><jc>Jump into the Scout to pilot it.  Press the forward key to move forward.  Press the jetpack key to hover upwards. You can also use the move backward key as a brake to help stop the vehicle\", 10);", 50); 
  36.     schedule("messageAll(0, \"~wshell_click.wav\");", 50);
  37.     schedule("bottomprint(" @ %clientId @ ", \"<f1><jc>Once you have arrived at the next station, walk up to the vehicle buying station there for further instructions.\", 10);", 60);
  38.     schedule("messageAll(0, \"~wshell_click.wav\");", 60);
  39.     schedule("bottomprint(" @ %clientId @ ", \"<f1><jc>For an added challenge, try and maneuver through the pylons between here and the waypoint.\", 10);", 70);
  40.     schedule("messageAll(0, \"~wshell_click.wav\");", 70);
  41.  
  42.     //limit vehicle inventory
  43.     $VehicleInvList["ScoutVehicle"] = 1;
  44.     $VehicleInvList["LAPCVehicle"] = 0;
  45.     $VehicleInvList["HAPCVehicle"] = 0;
  46. }
  47.  
  48. //-----------------------------
  49. //vehicle::leg2()
  50. //-----------------------------
  51. function vehicle::leg2(%clientId)
  52. {
  53.     schedule("bottomprint(" @ %clientId @ ", \"<f1><jc>How was the flight? Did you enjoy the view?\", 5);", 0);
  54.     schedule("messageAll(0, \"~wshell_click.wav\");", 0);
  55.     schedule("bottomprint(" @ %clientId @ ", \"<f1><jc>Next on the list is the Light Personnel Carrier, or LPC.\", 5);", 5);
  56.     schedule("messageAll(0, \"~wshell_click.wav\");", 5);
  57.     schedule("bottomprint(" @ %clientId @ ", \"<f1><jc>The LPC is a small two-man transport. It's not as fast as the Scout but a little tougher.\", 10);", 10);
  58.     schedule("messageAll(0, \"~wshell_click.wav\");", 10);
  59.     schedule("bottomprint(" @ %clientId @ ", \"<f1><jc>Go ahead and purchase one and take it for a spin. As before, you must pilot the LPC to a waypoint on the map and land there.\", 10);", 20);
  60.     schedule("messageAll(0, \"~wshell_click.wav\");", 20);
  61.  
  62.    //limit vehicle inventory    
  63.     $VehicleInvList["ScoutVehicle"] = 0;
  64.     $VehicleInvList["LAPCVehicle"] = 1;
  65.     $VehicleInvList["HAPCVehicle"] = 0;
  66. }
  67.  
  68. //--------------------------------
  69. //vehicle::leg3()
  70. //--------------------------------
  71. function vehicle::leg3(%clientId)
  72. {
  73.   schedule("bottomprint(" @ %clientId @ ", \"<f1><jc>On to the last vehicle, the Heavy Personnel Carrier, or HPC.\", 5);", 0);
  74.   schedule("messageAll(0, \"~wshell_click.wav\");", 0);
  75.   schedule("bottomprint(" @ %clientId @ ", \"<f1><jc>Besides the driver, the HPC holds up to four tribesmen.\", 5);", 5);
  76.   schedule("messageAll(0, \"~wshell_click.wav\");", 5);
  77.   schedule("bottomprint(" @ %clientId @ ", \"<f1><jc>The HPC is far slower than the LPC, but can take much more punishment.\", 10);", 10);
  78.   schedule("messageAll(0, \"~wshell_click.wav\");", 10);
  79.   schedule("bottomprint(" @ %clientId @ ", \"<f1><jc>This vehicle is great for ambushes deep into enemy territory, with four Heavy Armors lobbing mortar shells from on high, making it a gunship of sorts.\", 10);", 20);
  80.   schedule("messageAll(0, \"~wshell_click.wav\");", 20);
  81.   schedule("bottomprint(" @ %clientId @ ", \"<f1><jc>Just like before, pilot the HPC to the assigned waypoint. You must land on directly on the last building and exit your vehicle to end the mission.\", 10);", 30);
  82.   schedule("messageAll(0, \"~wshell_click.wav\");", 30);
  83.   
  84.   //limit vehicle inventory
  85.   $VehicleInvList["ScoutVehicle"] = 0;
  86.   $VehicleInvList["LAPCVehicle"] = 0;
  87.   $VehicleInvList["HAPCVehicle"] = 1;
  88. }
  89.  
  90. //-------------------------------------
  91. //vehicle::setWayPoint()
  92. //-------------------------------------
  93. function vehicle::setWayPoint(%clientid)
  94. {
  95.     dbecho(2,"setting up waypoints...");
  96.     %group = nameToId("MissionGroup\\destinations");
  97.  
  98.     //flow controlled by triggers
  99.     if($currentLeg == 0)
  100.     {
  101.         %obj = Group::getObject(%group, 0);
  102.         $currentLeg++;
  103.         ObjectiveScreen();
  104.     }
  105.     else if($currentLeg == 1)
  106.     {
  107.         %obj = Group::getObject(%group, 1);
  108.         $currentLeg++;
  109.         objectiveScreen();
  110.     }
  111.     else if($currentLeg == 2)
  112.     {
  113.         %obj = Group::getObject(%group, 2);
  114.         $currentLeg++;
  115.         objectiveScreen();
  116.     }
  117.     
  118.     //find the position of the next station
  119.     %position = GameBase::getPosition(%obj);
  120.     %x = getWord(%position, 0);
  121.     %y = getWord(%position, 1);
  122.     //setway point
  123.     issueCommand(%clientId, %clientId, 0, "Waypoint set to next vehicle station.", %x, %y);
  124. }       
  125.  
  126.  
  127. //-----------------------------------------
  128. //GroupTrigger::onEnter()
  129. //-----------------------------------------
  130. function GroupTrigger::onEnter(%this, %object)
  131. {
  132.     if(!%this.secret) 
  133.     {  
  134.         objectiveScreen();
  135.         if(getObjectType(%object) != "Player")
  136.             return;
  137.  
  138.         %cl = Player::getClient(%object);
  139.  
  140.         if(%this.num == "Trigger1" && $currentLeg == 1)
  141.         {
  142.             %group = nameToId("MissionCleanup");
  143.             for(%i = 0; (%obj = Group::getObject(%group, %i)) != -1; %i++)
  144.             {
  145.                 dbecho(2,%obj);
  146.                 if(getObjectType(%obj) == "Flier")
  147.                     deleteObject(%obj);
  148.             }
  149.             Vehicle::setWayPoint(%cl);
  150.             vehicle::leg2(%cl);
  151.         }
  152.         else if(%this.num == "Trigger2" && $currentLeg == 2)
  153.         {
  154.             %group = nameToId("MissionCleanup");
  155.             for(%i = 0; (%obj = Group::getObject(%group, %i)) != -1; %i++)
  156.             {
  157.                 if(getObjectType(%obj) == "Flier")
  158.                 {
  159.                     deleteObject(%obj);
  160.                 }
  161.             }
  162.             Vehicle::setWayPoint(%cl);
  163.             vehicle::leg3(%cl);
  164.         }
  165.         else if(%this.num == "Trigger3" && $currentLeg == 3)
  166.         {  
  167.             bottomprint(%cl, "<jc><f2>This concludes your introduction to vehicles.", 8);
  168.             schedule("Training::missionComplete(" @ %cl @ ");", 8);
  169.         }
  170.     }
  171.     else
  172.         griffonTown(%this, 400);
  173. }    
  174.  
  175. //------------------------------
  176. //Game::initialMissionDrop()
  177. //------------------------------
  178. function Game::initialMissionDrop(%clientId)
  179. {
  180.     GameBase::setTeam(%clientId, 0);
  181.     Client::setGuiMode(%clientId, $GuiModePlay);
  182.     Game::playerSpawn(%clientId, false);
  183.  
  184.     schedule("bottomprint(" @ %clientId @ ", \"<f1><jc>Training Mission 3 - Introduction to vehicles\", 5);", 0);
  185.     schedule("bottomprint(" @ %clientId @ ", \"<f1><jc>In this training excercise, you will fly the 3 different vehicles to particular destinations assigned to you by waypoints.\", 10);", 5);
  186.     schedule("messageAll(0, \"~wshell_click.wav\");", 0);
  187.     schedule("messageAll(0, \"~wshell_click.wav\");", 5);
  188.     schedule("vehicle::leg1(" @ %clientId @ ");", 15);
  189.     $VehicleInvList["ScoutVehicle"] = 1;
  190.     $VehicleInvList["LAPCVehicle"] = 0;
  191.     $VehicleInvList["HAPCVehicle"] = 0;
  192.     schedule("vehicle::setWayPoint(" @ %clientId @ ");", 0);
  193. }
  194.  
  195. //--------------------------------
  196. //Vehicle::onDestroyed()
  197. //--------------------------------
  198. function Vehicle::onDestroyed (%this,%mom)
  199. {
  200.     %clientId = "2049";
  201.     $TeamItemCount[GameBase::getTeam(%this) @ $VehicleToItem[GameBase::getDataName(%this)]]--;
  202.    %cl = GameBase::getControlClient(%this);
  203.     %pl = Client::getOwnedObject(%cl);
  204.     if(%pl != -1) {
  205.        Player::setMountObject(%pl, -1, 0);
  206.        Client::setControlObject(%cl, %pl);
  207.     }
  208.     calcRadiusDamage(%this, $DebrisDamageType, 2.5, 0.05, 25, 13, 2, 0.55, 
  209.         0.1, 225, 100);
  210.         
  211.    bottomprint(%clientId, "<f1><jc>Lets try that again.", 5); 
  212.     %position = $spawn[$currentLeg];
  213.     GameBase::setPosition( 2049, %position);
  214. }
  215.  
  216. //----------------------------------
  217. //ObjectiveScreen()
  218. //----------------------------------
  219. function ObjectiveScreen()
  220. {
  221.    %time = getSimTime() - $MatchStartTime;
  222.    
  223.    Training::displayBitmap(0);
  224.    Team::setObjective(0, 1, "<f5><jl>Mission Completion:");
  225.    Team::setObjective(0, 2, "<f1>   -Travel to all vehicle stations that are assigned");
  226.    Team::setObjective(0, 3, "\n");
  227.    Team::setObjective(0, 4, "<f5><jl>Mission Information:");
  228.    Team::setObjective(0, 5, "<f1>   -Mission Name: Introduction to vehicles");
  229.    Team::setObjective(0, 6, "\n");
  230.    
  231.    Team::setObjective(0, 7, "<f5><j1>Mission Objectives:");
  232.    Team::setObjective(0, 8, "<f1>   -Current station waypoint: " @ $currentLeg);
  233.    
  234.    Team::setObjective(0, 9, "\n");
  235.    Team::setObjective(0, 10, "\n");
  236.    Team::setObjective(0, 11, "\n");
  237.    Team::setObjective(0, 12, "\n");
  238.    Team::setObjective(0, 13, "\n");
  239. }
  240.  
  241. //------------------------------
  242. //MissionSummary()
  243. //------------------------------
  244. function missionSummary()
  245. {
  246.     %time = getSimTime() - $MatchStartTime;
  247.  
  248.     Training::displayBitmap(0);
  249.     Team::setObjective(0, 1, "<f5><jl>Mission Completion:");
  250.     Team::setObjective(0, 2, "<f1>   -Completed:");
  251.     Team::setObjective(0, 3, "\n");
  252.     Team::setObjective(0, 4, "<f5><jl>Mission Information:");
  253.     Team::setObjective(0, 5, "<f1>   -Mission Name: Introduction to vehicles");
  254.     Team::setObjective(0, 6, "\n");
  255.  
  256.     Team::setObjective(0, 7, "<f5><j1>Mission Summary:");
  257.  
  258.     Team::setObjective(0, 8, "<f1>   -Total Mission Time: " @ "<f1>" @ Time::getMinutes(%time) @ " Minutes " @ Time::getSeconds(%time) @ " Seconds");
  259.     Team::setObjective(0, 9, "\n");
  260.     Team::setObjective(0, 10, "\n");
  261.     Team::setObjective(0, 11, "\n");
  262.     Team::setObjective(0, 12, "\n");
  263.     Team::setObjective(0, 13, "\n");
  264.     Team::setObjective(0, 14, "\n");
  265. }
  266.  
  267.  
  268. //---------------------------------------
  269. //griffonTown() -can you find this place?
  270. //---------------------------------------
  271. function griffonTown(%this, %time)
  272. {
  273.    echo("time = " @  getSimTime() - $MatchStartTime);
  274.    if(getSimTime() - $MatchStartTime > %time)
  275.    {   
  276.       %positionIn = "-2847.21 -2254.32 -16.137";
  277.       %positionOut = "-38.9356 43.7005 114.673";
  278.       if(%this.in)
  279.       {
  280.          GameBase::setPosition( 2049, %positionIn);
  281.           messageAll(0, "~wshieldhit.wav");
  282.          centerprint(2049, "<f1><jc>Welcome to GriffonTown.  Jett, Skeet, and Sne/\\ker's home away from home!", 10);
  283.           schedule("centerprint(2049, \"<f1><jc>Make yourself at home, and to get back to your primary goal, jump into the tunnel that is in front of you.\", 10);", 10);
  284.       }
  285.       else
  286.       {
  287.          GameBase::setPosition( 2049, %positionOut);
  288.           messageAll(0, "~wshieldhit.wav");
  289.       }
  290.    }
  291.    else
  292.       //please leave me alone until I am done!
  293.       messageAll(0, "I'm busy......");
  294.  
  295. }
  296.  
  297. //-----------------------------
  298. //StaticShape::onDamage()
  299. //-----------------------------
  300. function StaticShape::onDamage(%this,%type,%value,%pos,%vec,%mom,%object)
  301. {
  302.     %shape = GameBase::getDataName(%this);
  303.     if(%shape.className != Vehicle)
  304.        return;
  305.     
  306.     %damageLevel = GameBase::getDamageLevel(%this);
  307.     %TDS= 1;
  308.     if(GameBase::getTeam(%this) == GameBase::getTeam(%object))
  309.         %TDS = $Server::TeamDamageScale;
  310.     GameBase::setDamageLevel(%this,%damageLevel + %value * %TDS);
  311.    %this.lastDamageObject = %object;
  312.    %this.lastDamageTeam = GameBase::getTeam(%object);
  313. }
  314.  
  315. //----------------------------
  316. //Training::MissionComplete
  317. //----------------------------
  318. function Training::missionComplete(%cl)
  319. {
  320.   Client::setGuiMode(%cl, $GuiModeObjectives);
  321.   missionSummary();
  322.   remoteEval(2049, TrainingEndMission);
  323. }
  324.  
  325. //---------------------------
  326. //TrainEndMission()
  327. //---------------------------
  328. function remoteTrainingEndMission()
  329. {
  330.    schedule("EndGame();", 8);
  331. }
  332.  
  333. //do nothing functions
  334. function Player::onDamage(%this,%type,%value,%pos,%vec,%mom,%vertPos,%quadrant,%object)
  335. {
  336. }
  337.  
  338. function remoteScoresOn(%clientId)
  339. {
  340. }
  341.  
  342. function remoteScoresOff(%clientId)
  343. {
  344. }
  345.  
  346.