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

  1. //Weapons-FixedTarget Training
  2. //--------------------------------------
  3. //all these functions do is set up the scene for each weapon.
  4. //upon killing each target assigned, the next weapon lesson will resume.
  5. exec("game.cs");
  6. exec("Training_AI.cs");
  7.  
  8. //Globals
  9. //////////////
  10. $Train::missionType = "WEAPONS";
  11. $counter = 0;
  12. $AIkilled = 0;
  13.  
  14. //-------------------------------------
  15. //fixedTargetsBlaster()
  16. //-------------------------------------
  17. function fixedTargetsBlaster(%playerId)
  18. {   
  19.    //weapon discription
  20.    schedule("bottomprint(" @ %playerId @ ", \"<f1><jc>This mission will introduce you to the many weapons that are available in TRIBES.\", 10);", 5);
  21.    schedule("messageAll(0, \"~wshell_click.wav\");", 5);
  22.    schedule("bottomprint(" @ %playerId @ ", \"<f1><jc>Ready?\", 10);", 15);
  23.    schedule("messageAll(0, \"~wshell_click.wav\");", 15);
  24.    schedule("bottomprint(" @ %playerId @ ", \"<f1><jc>Let's start with the blaster.  This is an energy weapon which all armor classes can carry.  It is a good close- to medium-range weapon that feeds off of your energy supply.\", 10);", 25);
  25.    schedule("messageAll(0, \"~wshell_click.wav\");", 25);
  26.    
  27.    //mount weapons
  28.    schedule("Player::setItemCount(" @ %playerId @ ",Blaster, 1);", 25);
  29.    schedule("Player::mountItem(" @ %playerId @ ", Blaster, 0);", 25);
  30.    schedule("bottomprint(" @ %playerId @ ", \"<f1><jc>Time to do some shooting!  Somewhere around you a player is trying to infiltrate your base.  Eliminate him with the blaster.\", 10);", 35);
  31.    schedule("messageAll(0, \"~wshell_click.wav\");", 35);
  32.    
  33.    //drone setup
  34.    %name = "Nailz";
  35.    %group = "\"MissionGroup\\\\AI\\\\guard1\"";
  36.    schedule("initAI(" @ %name @ ", " @ %group @ ", marmor);", 35);
  37.    schedule("setTarget(" @ %playerId @ ", " @ %name @ ");", 35);
  38.    $counter++;
  39. }
  40.  
  41. //----------------------------------
  42. //fixedTargetsPlasma()
  43. //----------------------------------
  44. function fixedTargetsPlasma(%playerId)
  45. {   
  46.    //discription of weapon
  47.    schedule("bottomprint(" @ %playerId @ ", \"<f1><jc>Next is the plasma gun.\", 10);", 10);
  48.    schedule("messageAll(0, \"~wshell_click.wav\");", 10);
  49.    schedule("bottomprint(" @ %playerId @ ", \"<f1><jc>The plasma gun has about the same range as the blaster, but far more punch.  This weapon is a good choice against slower heavy armors because of its splash damage radius. \", 10);", 20);
  50.    schedule("messageAll(0, \"~wshell_click.wav\");", 20);
  51.    schedule("bottomprint(" @ %playerId @ ", \"<f1><jc>Let's take out a heavy armor and see how you like it.\", 10);",30);
  52.    schedule("messageAll(0, \"~wshell_click.wav\");", 30);
  53.    schedule("bottomprint(" @ %playerId @ ", \"<f1><jc>Once again, an enemy tribesman has infiltrated your base, and it is up to you to dispose of the threat.\", 10);", 40);
  54.    schedule("messageAll(0, \"~wshell_click.wav\");", 40);
  55.    
  56.    //mount weapon
  57.    schedule("Player::setItemCount(" @ %playerId @ ",Blaster, 0);", 12);
  58.    schedule("Player::setItemCount(" @ %playerId @ ",Plasmagun, 1);", 12);
  59.    schedule("Player::setItemCount(" @ %playerId @ ",PlasmaAmmo, 100);", 45);
  60.    schedule("Player::mountItem(" @ %playerId @ ", Plasmagun, 0);", 12);
  61.    
  62.    //drone details
  63.    %name = "SymLink";
  64.    %group = "\"MissionGroup\\\\AI\\\\guard2\"";
  65.    schedule("initAI(" @ %name @ " ," @  %group @ " , harmor);", 45);
  66.    schedule("setTarget(" @ %playerId @ ", " @ %name @ ");", 45);
  67.    $counter++;
  68. }
  69.  
  70. //--------------------------------------
  71. //fixedTargetsChain()
  72. //--------------------------------------
  73. function fixedTargetsChain(%playerId)
  74. {   
  75.    //weapon discription
  76.    schedule("bottomprint(" @ %playerId @ ", \"<f1><jc>Next, the chain gun.  Capable of churning out explosive flechettes in rapid order, it can chew up even heavy armors in short order.\", 10);", 10);
  77.    schedule("messageAll(0, \"~wshell_click.wav\");", 10);
  78.    schedule("bottomprint(" @ %playerId @ ", \"<f1><jc>It can be carried by all armor classes.  Deadly at short range, it loses much of its effectiveness at greater distances.\", 10);", 20);
  79.    schedule("messageAll(0, \"~wshell_click.wav\");", 20);
  80.    schedule("bottomprint(" @ %playerId @ ", \"<f1><jc>Let's fire a few rounds and get an idea of the range of the chain gun. Try and take out the target that is crossing your path below your base tower.\", 10);", 30);
  81.    schedule("messageAll(0, \"~wshell_click.wav\");", 30);
  82.  
  83.    //weapon mounting
  84.    schedule("Player::setItemCount(" @ %playerId @ ",Chaingun, 1);", 12);
  85.    schedule("Player::setItemCount(" @ %playerId @ ",bulletAmmo, 10000);", 35);
  86.    schedule("Player::setItemCount(" @ %playerId @ ",disclauncher, 0);", 12);
  87.    schedule("Player::mountItem(" @ %playerId @ ", Chaingun, 0);", 12);
  88.    
  89.    //drone stuff
  90.    %name = "Slacker";
  91.    %group = "\"MissionGroup\\\\AI\\\\guard4\"";
  92.    schedule("initAI(" @ %name @ " ," @  %group @ " , marmor);", 35);
  93.    schedule("setTarget(" @ %playerId @ ", " @ %name @ ");", 35);
  94.    $counter++;
  95. }
  96.     
  97. //-----------------------------------
  98. //fixedTargetsdisc()
  99. //-----------------------------------
  100. function fixedTargetsdisc(%playerId)
  101. {   
  102.    //discribe the weapon
  103.    schedule("bottomprint(" @ %playerId @ ", \"<f1><jc>The next weapon available to you is the disk launcher.\", 10);", 10);
  104.    schedule("messageAll(0, \"~wshell_click.wav\");", 10);
  105.    schedule("bottomprint(" @ %playerId @ ", \"<f1><jc>This is definitely a weapon that you want to master.  Little else in tribal arsenals can match the damage dealt by its magnetic spinfusor disks. This weapon also has a wide splash radius, so aim at the feet of your enemy for maximum effectivness.\", 10);", 20);
  106.    schedule("messageAll(0, \"~wshell_click.wav\");", 20);
  107.    schedule("bottomprint(" @ %playerId @ ", \"<f1><jc>The best way to get a feel for this weapon is to shoot some discs.  See if you can find an enemy tribesman wandering around your tower, and take 'em out!\", 10);", 30);
  108.    schedule("messageAll(0, \"~wshell_click.wav\");", 30);
  109.    
  110.    //mount the correct weapon
  111.    schedule("Player::setItemCount(" @ %playerId @ ",Disclauncher, 1);", 12);
  112.    schedule("Player::setItemCount(" @ %playerId @ ",Plasmagun, 0);", 12);
  113.    schedule("Player::setItemCount(" @ %playerId @ ",DiscAmmo, 100);", 32);
  114.    schedule("Player::mountItem(" @ %playerId @ ", Disclauncher, 0);", 12);
  115.    
  116.    //create a drone for them to shoot 
  117.    %name = "\"Cornboy!\"";
  118.    %group = "\"MissionGroup\\\\AI\\\\guard3\"";
  119.    schedule("initAI(" @ %name @ " ," @  %group @ " , harmor);", 35);
  120.    schedule("setTarget(" @ %playerId @ ", " @ %name @ ");", 35);
  121.    $counter++;
  122. }
  123.  
  124. //-----------------------------------
  125. //fixedTargetsSniper
  126. //-----------------------------------
  127. function fixedTargetsSniper(%playerId)
  128. {   
  129.    //discribe weapon
  130.    schedule("bottomprint(" @ %playerId @ ", \"<f1><jc>For long-range sniping, nothing beats the laser rifle.  A powerful energy-based weapon, it can hit a target kilometers away!\", 10);", 5);
  131.    schedule("messageAll(0, \"~wshell_click.wav\");", 5);
  132.    schedule("bottomprint(" @ %playerId @ ", \"<f1><jc>Because of its high energy consumption, you must also have an energy pack to use this weapon and it can only be used by light armors.\", 10);", 15);
  133.    schedule("messageAll(0, \"~wshell_click.wav\");", 10);
  134.    schedule("bottomprint(" @ %playerId @ ", \"<f1><jc>The zoom feature enhances the value of the laser rifle immensely. The default zoom key is E. To change the magnification, press the Z key.  You can change the magnification to two, five, ten or even twenty times normal vision!\", 10);", 25);
  135.    schedule("messageAll(0, \"~wshell_click.wav\");", 25);
  136.    schedule("bottomprint(" @ %playerId @ ", \"<f1><jc>Since a head shot deals more damage than a shot to other parts of the body, being able to use the zoom feature quickly and accurately can make the difference between killing or being killed.\", 10);", 35);
  137.    schedule("messageAll(0, \"~wshell_click.wav\");", 35);
  138.    schedule("bottomprint(" @ %playerId @ ", \"<f1><jc>Zoom in on an enemy tribesmen and take him out. Use your compass to locate the enemy to the north of you, then take him our with the laser rifle.\", 10);", 45);
  139.    schedule("messageAll(0, \"~wshell_click.wav\");", 45);
  140.  
  141.    //mount weapon
  142.    schedule("Player::setItemCount(" @ %playerId @ ",chaingun, 0);", 8);
  143.    schedule("Player::setItemCount(" @ %playerId @ ",laserrifle, 1);", 8);
  144.    schedule("Player::setItemCount(" @ %playerId @ ",EnergyPack, 1);", 8);
  145.    schedule("Player::mountItem(" @ %playerId @ ",EnergyPack, 1);", 8);
  146.    schedule("Player::mountItem(" @ %playerId @ ", laserrifle, 0);", 8);
  147.  
  148.    //setup target to shoot
  149.    %group = "\"MissionGroup\\\\AI\\\\guard5\"";
  150.    %name = "\"GotM*lk?\"";
  151.    schedule("initAI(" @ %name @ " ," @  %group @ " , marmor);", 45);
  152.    schedule("setTarget(" @ %playerId @ ", " @ %name @ ");", 45);
  153.    $counter++;
  154.  
  155. }
  156.  
  157. //---------------------------------------
  158. //fixedTargetsGrenade()
  159. //---------------------------------------
  160. function fixedTargetsGrenade(%playerId)
  161. {   
  162.    schedule("bottomprint(" @ %playerId @ ", \"<f1><jc>On to a more explosive weapon!  Let's take a look at the grenade launcher.  It can be carried by all armor classes.\", 10);", 5);
  163.    schedule("messageAll(0, \"~wshell_click.wav\");", 5);
  164.    schedule("bottomprint(" @ %playerId @ ", \"<f1><jc>Grenades launched from the launcher have a timed fuse, exploding a few seconds after impact.  To clear out the inside of a bunker, just lob a couple of grenades insde and watch the enemy come running out.\", 10);", 15);
  165.    schedule("messageAll(0, \"~wshell_click.wav\");", 15);
  166.    schedule("bottomprint(" @ %playerId @ ", \"<f1><jc>An enemy tribesman is thinking of trying to hide in a bunker.  Time to teach him the error of his ways.\", 10);", 25);
  167.    schedule("messageAll(0, \"~wshell_click.wav\");", 25);
  168.    schedule("bottomprint(" @ %playerId @ ", \"<f1><jc>Watch the bunker at the bottom of your base tower, and fire a couple of grenades when you see the enemy tribesman run inside.\", 10);", 35);
  169.    schedule("messageAll(0, \"~wshell_click.wav\");", 35);
  170.  
  171.    //mount weapon
  172.    schedule("Player::setItemCount(" @ %playerId @ ",grenadeAmmo, 50);", 40);
  173.    schedule("Player::setItemCount(" @ %playerId @ ",laserrifle, 0);", 8);
  174.    schedule("Player::setItemCount(" @ %playerId @ ",grenadelauncher, 1);", 8);
  175.    schedule("Player::mountItem(" @ %playerId @ ", grenadelauncher, 0);", 8);
  176.  
  177.    //setup target to shoot
  178.    %group1 = "\"MissionGroup\\\\AI\\\\guard6\"";
  179.    %name1 = "Skeet";
  180.    schedule("initAI(" @ %name1 @ " ," @  %group1 @ " , harmor);", 40);
  181.    schedule("setTarget(" @ %playerId @ ", " @ %name1 @ ");", 40);
  182.    $counter++;
  183. }
  184.  
  185. //-------------------------------
  186. //weaponsStart()
  187. //-------------------------------
  188. function weaponsStart(%clientId)
  189. {
  190.   fixedTargetsBlaster(%clientId);
  191. }
  192.  
  193. //-------------------------------
  194. //initAi()
  195. //-------------------------------
  196. function initAI(%name, %group, %armor)
  197. {
  198.   createAI(%name, %group, %armor, %name);
  199. }
  200.  
  201. //-------------------------------
  202. //Game:playerSpawned()
  203. //-------------------------------
  204. function Game::playerSpawned(%pl, %clientId, %armor)
  205. {
  206.    replenishAmmo();
  207.  
  208. //--------------------------------
  209. //AI::onDroneKilled()
  210. //--------------------------------
  211. function AI::onDroneKilled(%aiName)
  212. {
  213.   %clientId = 2049;
  214.   //kill thy vehicle creater!
  215.   if(%aiName == "Nailz")
  216.   {
  217.     fixedTargetsPlasma(%clientId);
  218.     bottomprint(%clientId, "<f1><jc>Good Job!", 5);
  219.     $AIkilled++;
  220.     ObjectiveScreen();
  221.   }
  222.   //symlink? hmmm enjoy it cuz it won't happen often. Killing him that is.
  223.   else if(%aiName == "SymLink")
  224.   {
  225.     fixedTargetsDisc(%clientId);
  226.     bottomprint(%clientId, "<f1><jc>Good Job!", 5);
  227.     $AIkilled++;
  228.     ObjectiveScreen();
  229.   }
  230.   //kill thy mission building God!
  231.   else if(%aiName == "Cornboy!")
  232.   {
  233.     fixedTargetsChain(%clientId);
  234.     bottomprint(%clientId, "<f1><jc>Good Job!", 5);
  235.     $AIkilled++;
  236.     ObjectiveScreen();
  237.   }
  238.   //kill thy master of the engine.
  239.   else if(%aiName == "Slacker")
  240.   {
  241.     fixedTargetsSniper(%clientId);
  242.     bottomprint(%clientId, "<f1><jc>Good Job!", 5);
  243.     $AIkilled++;
  244.     ObjectiveScreen();
  245.   }
  246.   //one word, 9 lives! Make every shot count.
  247.   else if(%aiName == "GotM*lk?")
  248.   {
  249.     fixedTargetsGrenade(%clientId);
  250.     bottomprint(%clientId, "<f1><jc>Good Job!", 5);
  251.     $AIkilled++;
  252.     ObjectiveScreen();
  253.   }
  254.   //kill thy compiler of the Gods!
  255.   else if(%aiName == "Skeet")
  256.   {
  257.     endMission(%clientId);
  258.     bottomprint(%clientId, "<f1><jc>Good Job!", 5);
  259.     $AIkilled++;
  260.   }
  261. }  
  262.  
  263. //----------------------------------
  264. //endMission()
  265. //----------------------------------
  266. function endMission(%clientId)
  267. {
  268.   %name = Client::getName(%clientId);
  269.   %String = "\"<f1><jc>Way to go " @ %name @ ", you have completed the weapons introduction mission!\"";
  270.   schedule("bottomprint(" @ %clientId @ ", " @ %String @ " , 10);", 5);
  271.   schedule("messageAll(0, \"~wshell_click.wav\");", 5); 
  272.   schedule("Training::MissionComplete(" @ %clientId @ ");", 15);
  273. }
  274.  
  275. //----------------------------------
  276. //StayInBounds()
  277. //----------------------------------
  278. function StayInBounds(%clientId)
  279.     %player = Client::getOwnedObject(%clientId);
  280.     %flash = 0.4;
  281.     Player::setDamageFlash(%player, %flash);
  282.     %pos = "203.811 -532.056 176.938";
  283.     messageAll(0, "You must Stay inside your base!" @ "~wshieldhit.wav");
  284.     GameBase::setPosition(%ClientId, %pos);
  285.    
  286. //------------------------------------------
  287. //GroupTrigger::onLeave()
  288. //------------------------------------------
  289. function GroupTrigger::onLeave(%this, %object)
  290.    %clId = Client::getFirst();
  291.    //The trigger stuff is not completely reliable, so we'll try our own 
  292.    //hard-coded rough check here as well:
  293.    %pos = Gamebase::getPosition( %clId );
  294.  
  295.    %x = getWord(%pos, 0 );
  296.    %y = getWord(%pos, 1 );
  297.    %z = getWord(%pos, 2 );
  298.  
  299.    // Seems to work pretty well.  You can get on top of the platform now.  I increased
  300.    // the Z so you can fly pretty high (it will cause the call to the else{} below.
  301.    //
  302.    // This has the "side effect" that there now IS a way to leave the platform, but you 
  303.    // have to try, and I think it qualifies as an easter egg rather than a bug.  
  304.    if( %x < 193 || %x > 212 || %y < -539 || %y > -521 || %z < 175 || %z > 250 )
  305.    {
  306.       dbecho(2,"Out of Bounds!");
  307.       StayInBounds(%clId);
  308.    }
  309.    else
  310.    {
  311.       dbecho(2,"onLeave() erroneously called in Weapons Training");
  312.    }
  313.  
  314. //----------------------------------
  315. //setTarget()
  316. //----------------------------------
  317. function setTarget(%playerId, %name)
  318. {
  319.     %id = AI::getId(%name);
  320.     %targIdx = (%id - 2048);
  321.     issueTargCommand(%playerId, %playerId, 1,"Waypoint set to target", %targIdx);
  322. }                
  323.  
  324. //----------------------------------
  325. //missionSummary()
  326. //----------------------------------
  327. function missionSummary()
  328. {
  329.    %time = getSimTime();
  330.    
  331.    Training::displayBitmap(0);
  332.    Team::setObjective(0, 1, "<f5><jl>Mission Completion:");
  333.    Team::setObjective(0, 2, "<f1>   -Completed:");
  334.    Team::setObjective(0, 3, "\n");
  335.    Team::setObjective(0, 4, "<f5><jl>Mission Information:");
  336.    Team::setObjective(0, 5, "<f1>   -Mission Name: Introduction to Weapons");
  337.    Team::setObjective(0, 6, "\n");
  338.    
  339.    Team::setObjective(0, 7, "<f5><j1>Mission Summary:");
  340.    
  341.    Team::setObjective(0, 8, "<f1>   -Total Mission Time: " @ "<f1>" @ Time::getMinutes(%time) @ " Minutes " @ Time::getSeconds(%time) @ " Seconds");
  342.    Team::setObjective(0, 9, "\n");
  343.    Team::setObjective(0, 10, "\n");
  344.    Team::setObjective(0, 11, "\n");
  345.    Team::setObjective(0, 12, "\n");
  346.    Team::setObjective(0, 13, "\n");
  347.    Team::setObjective(0, 14, "\n");
  348. }
  349.  
  350. //--------------------------------------
  351. //Training::missionComplete()
  352. //--------------------------------------
  353. function Training::missionComplete(%cl)
  354. {
  355.   Client::setGuiMode(%cl, $GuiModeObjectives);
  356.   missionSummary();
  357.   remoteEval(2049, TrainingEndMission);
  358. }
  359.  
  360. //-------------------------------------
  361. //remoteTrainingEndMission()
  362. //-------------------------------------
  363. function remoteTrainingEndMission()
  364. {
  365.    schedule("EndGame();", 8);
  366. }
  367.  
  368. //------------------------------------
  369. //replenishAmmo()
  370. //------------------------------------
  371. function replenishAmmo()
  372. {
  373.   %playerId = 2049;
  374.   
  375.   if($counter == 2)
  376.     Player::setItemCount(%playerId, PlasmaAmmo, 100);                          
  377.   else if($counter == 4)
  378.     Player::setItemCount(%playerId, bulletAmmo, 100);
  379.   else if($counter == 3)
  380.     Player::setItemCount(%playerId, discAmmo, 100);
  381.   else if($counter == 5)
  382.     Player::setItemCount(%playerId ,grenadeAmmo, 100);
  383.   schedule("replenishAmmo();", 30);
  384. }
  385.  
  386. //--------------------------------------------
  387. //Game::initialMissionDrop()
  388. //--------------------------------------------
  389. function Game::initialMissionDrop(%clientId)
  390. {
  391.    GameBase::setTeam(%clientId, 0);
  392.    Client::setGuiMode(%clientId, $GuiModePlay);
  393.    Game::playerSpawn(%clientId, false);
  394.  
  395.    schedule("bottomprint(" @ %clientId @ ", \"<f1><jc>Training Mission 2 - Weapon Introduction.\", 5);", 0);
  396.    schedule("messageAll(0, \"~wshell_click.wav\");", 0); 
  397.    schedule("weaponsStart(" @ %clientId @ ");", 5);
  398.     Training::displayBitmap(0);
  399.     objectiveScreen();
  400. }
  401.  
  402. //------------------------------------------------
  403. //ObjectiveScreen()
  404. //------------------------------------------------
  405. function ObjectiveScreen()
  406. {
  407.    %time = getSimTime() - $MatchStartTime;
  408.    Training::displayBitmap(0);
  409.    Team::setObjective(0, 1, "<f5><jl>Mission Completion:");
  410.    Team::setObjective(0, 2, "<f1>   -Firing range: Weapons training in progress");
  411.    Team::setObjective(0, 3, "\n");
  412.    Team::setObjective(0, 4, "<f5><jl>Mission Information:");
  413.    Team::setObjective(0, 5, "<f1>   -Mission Name: Introduction to Weapons");
  414.    Team::setObjective(0, 6, "\n");
  415.    
  416.    Team::setObjective(0, 7, "<f5><j1>Mission Summary:");
  417.    Team::setObjective(0, 8, "<f1>   -Total Mission Time: " @ "<f1>" @ Time::getMinutes(%time) @ " Minutes " @ Time::getSeconds(%time) @ " Seconds");
  418.    Team::setObjective(0, 9, "<f1>   -Total kills: " @ $AIkilled @ " out of 6");
  419.    
  420.    Team::setObjective(0, 10, "\n");
  421.    Team::setObjective(0, 11, "\n");
  422.    Team::setObjective(0, 12, "\n");
  423.    Team::setObjective(0, 13, "\n");
  424.    Team::setObjective(0, 14, "\n");
  425. }
  426.  
  427. //----------------------------------------
  428. //Player::onDamage()
  429. //----------------------------------------
  430. function Player::onDamage(%this,%type,%value,%pos,%vec,%mom,%vertPos,%quadrant,%object)
  431. {
  432.   if(Player::getClient(%this) != Client::getFirst())    
  433.   {    
  434.     if (Player::isExposed(%this)) {
  435.       %damagedClient = Player::getClient(%this);
  436.       %shooterClient = %object;
  437.  
  438.         Player::applyImpulse(%this,%mom);
  439.         if($teamplay && %damagedClient != %shooterClient && Client::getTeam(%damagedClient) == Client::getTeam(%shooterClient) ) {
  440.             if (%shooterClient != -1) {
  441.                 %curTime = getSimTime();
  442.                if ((%curTime - %this.DamageTime > 3.5 || %this.LastHarm != %shooterClient) && %damagedClient != %shooterClient && $Server::TeamDamageScale > 0) {
  443.                     Client::sendMessage(%damagedClient,0,"You took Friendly Fire from " @ Client::getName(%shooterClient) @ "!");
  444.                     Client::sendMessage(%shooterClient,0,"You just harmed Teammate " @ Client::getName(%damagedClient) @ "!");
  445.                     %this.LastHarm = %shooterClient;
  446.                     %this.DamageStamp = %curTime;
  447.                 }
  448.             }
  449.             %friendFire = $Server::TeamDamageScale;
  450.         }
  451.         else 
  452.             %friendFire = 1.0;    
  453.  
  454.         if (!Player::isDead(%this)) {
  455.             %armor = Player::getArmor(%this);
  456.             //More damage applyed to head shots
  457.             if(%vertPos == "head" && %type == $LaserDamageType) {
  458.                 if(%armor == "harmor") { 
  459.                     if(%quadrant == "middle_back" || %quadrant == "middle_front" || %quadrant == "middle_middle") {
  460.                         %value += (%value * 0.3);
  461.                     }
  462.                 }
  463.                 else {
  464.                     %value += (%value * 0.3);
  465.                 }
  466.             }
  467.             //If Shield Pack is on
  468.             if (%type != -1 && %this.shieldStrength) {
  469.                 %energy = GameBase::getEnergy(%this);
  470.                 %strength = %this.shieldStrength;
  471.                 if (%type == $ShrapnelDamageType || %type == $MortarDamageType)
  472.                     %strength *= 0.75;
  473.                 %absorb = %energy * %strength;
  474.                 if (%value < %absorb) {
  475.                     GameBase::setEnergy(%this,%energy - ((%value / %strength)*%friendFire));
  476.                     %thisPos = getBoxCenter(%this);
  477.                     %offsetZ =((getWord(%pos,2))-(getWord(%thisPos,2)));
  478.                     GameBase::activateShield(%this,%vec,%offsetZ);
  479.                     %value = 0;
  480.                 }
  481.                 else {
  482.                     GameBase::setEnergy(%this,0);
  483.                     %value = %value - %absorb;
  484.                 }
  485.             }
  486.               if (%value) {
  487.                 %value = $DamageScale[%armor, %type] * %value * %friendFire;
  488.             %dlevel = GameBase::getDamageLevel(%this) + %value;
  489.             %spillOver = %dlevel - %armor.maxDamage;
  490.                 GameBase::setDamageLevel(%this,%dlevel);
  491.                 %flash = Player::getDamageFlash(%this) + %value * 2;
  492.                 if (%flash > 0.75) 
  493.                     %flash = 0.75;
  494.                 Player::setDamageFlash(%this,%flash);
  495.                 //If player not dead then play a random hurt sound
  496.                 if(!Player::isDead(%this)) { 
  497.                     if(%damagedClient.lastDamage < getSimTime()) {
  498.                         %sound = radnomItems(3,injure1,injure2,injure3);
  499.                         playVoice(%damagedClient,%sound);
  500.                         %damagedClient.lastdamage = getSimTime() + 1.5;
  501.                     }
  502.                 }
  503.                 else {
  504.                if(%spillOver > 0.5 && (%type== $ExplosionDamageType || %type == $ShrapnelDamageType || %type== $MortarDamageType|| %type == $MissileDamageType)) {
  505.                          Player::trigger(%this, $WeaponSlot, false);
  506.                         %weaponType = Player::getMountedItem(%this,$WeaponSlot);
  507.                         if(%weaponType != -1)
  508.                             Player::dropItem(%this,%weaponType);
  509.                     Player::blowUp(%this);
  510.                     }
  511.                     else
  512.                     {
  513.                         if ((%value > 0.40 && (%type== $ExplosionDamageType || %type == $ShrapnelDamageType || %type== $MortarDamageType || %type == $MissileDamageType )) || (Player::getLastContactCount(%this) > 6) ) {
  514.                               if(%quadrant == "front_left" || %quadrant == "front_right") 
  515.                                 %curDie = $PlayerAnim::DieBlownBack;
  516.                             else
  517.                                 %curDie = $PlayerAnim::DieForward;
  518.                         }
  519.                         else if( Player::isCrouching(%this) ) 
  520.                             %curDie = $PlayerAnim::Crouching;                            
  521.                         else if(%vertPos=="head") {
  522.                             if(%quadrant == "front_left" ||    %quadrant == "front_right"    ) 
  523.                                 %curDie = radnomItems(2, $PlayerAnim::DieHead, $PlayerAnim::DieBack);
  524.                               else 
  525.                                 %curDie = radnomItems(2, $PlayerAnim::DieHead, $PlayerAnim::DieForward);
  526.                         }
  527.                         else if (%vertPos == "torso") {
  528.                             if(%quadrant == "front_left" ) 
  529.                                 %curDie = radnomItems(3, $PlayerAnim::DieLeftSide, $PlayerAnim::DieChest, $PlayerAnim::DieForwardKneel);
  530.                             else if(%quadrant == "front_right") 
  531.                                 %curDie = radnomItems(3, $PlayerAnim::DieChest, $PlayerAnim::DieRightSide, $PlayerAnim::DieSpin);
  532.                             else if(%quadrant == "back_left" ) 
  533.                                 %curDie = radnomItems(4, $PlayerAnim::DieLeftSide, $PlayerAnim::DieGrabBack, $PlayerAnim::DieForward, $PlayerAnim::DieForwardKneel);
  534.                             else if(%quadrant == "back_right") 
  535.                                 %curDie = radnomItems(4, $PlayerAnim::DieGrabBack, $PlayerAnim::DieRightSide, $PlayerAnim::DieForward, $PlayerAnim::DieForwardKneel);
  536.                         }
  537.                         else if (%vertPos == "legs") {
  538.                             if(%quadrant == "front_left" ||    %quadrant == "back_left") 
  539.                                 %curDie = $PlayerAnim::DieLegLeft;
  540.                             if(%quadrant == "front_right" ||    %quadrant == "back_right") 
  541.                                 %curDie = $PlayerAnim::DieLegRight;
  542.                         }
  543.                         Player::setAnimation(%this, %curDie);
  544.                     }
  545.                     if(%type == $ImpactDamageType && %object.clLastMount != "")  
  546.                         %shooterClient = %object.clLastMount;
  547.                        Client::onKilled(%damagedClient,%shooterClient, %type);
  548.                 }
  549.             }
  550.         }
  551.       }
  552.   }
  553. }
  554.  
  555.  
  556. //-------------------------------------
  557. //Ammo::onDrop() -don't be an idiot!
  558. //-------------------------------------
  559. function Ammo::onDrop(%player,%item)
  560. {
  561.     if($matchStarted) {
  562.         %count = Player::getItemCount(%player,%item);
  563.         %delta = $SellAmmo[%item];
  564.         if(%count <= %delta) { 
  565.             if( %item == "BulletAmmo" || (Player::getMountedItem(%player,$WeaponSlot)).imageType.ammoType != %item)
  566.                 %delta = %count;
  567.             else 
  568.                 %delta = %count - 1;
  569.  
  570.         }
  571.         if(%delta > 0) {
  572.             %obj = newObject("","Item",%item,%delta,false);
  573.           schedule("Item::Pop(" @ %obj @ ");", $ItemPopTime, %obj);
  574.  
  575.           addToSet("MissionCleanup", %obj);
  576.             GameBase::throw(%obj,%player,20,false);
  577.             messageAll(0, "~wmale2.wdsgst2.wav");
  578.             Player::decItemCount(%player,%item,%delta);
  579.         }
  580.     }
  581. }    
  582.  
  583.  
  584. //do nothing functions
  585. function remoteScoresOn(%clientId)
  586. {
  587. }
  588.  
  589. function remoteScoresOff(%clientId)
  590. {
  591. }
  592.  
  593. function Item::onDrop(%player, %item)
  594. {
  595. }
  596.