Author Topic: Player Coding (Multiple Errors) Need Assistance  (Read 1797 times)

I was just working on a player type and I've come across multiple errors regarding the sound profile, sprinting, and jumping.
When you (Right Click) to activate the players sprint...
Yes, it does work..
But when you attempt to jump while sprinting.. (Let's say I'd like to jump further?) it will not work.
I'd prefer the player to stop sprinting once the bar has depleted, then upon reactivating when the bar is full repeat the process.
I have custom sounds for the player (.wav Formatted)... But they will not Que when they are supposed to at all. There is no sound.
.. I have another request off-topic. I'd like to mount an emitter onto the player that STAYS mounted. I have one in mind, just not sure how to make it collaborate together.
If this is possible, I'd like to bind separate keys..

1.) Right Click to Sprint

2.) Double Tap Jump / or Double Tap Shift for jets

Here's the code..
I'm very quite new to this still, but I'll learn.
Quote
//Standard Armor, similar to the "Advanced Warfare" scheme
datablock PlayerData(PlayerAdvanced : PlayerStandardArmor)
{
        rechargeRate = 4;
   runForce = 4320;
   runEnergyDrain = 0;
   maxForwardSpeed = "7";
   maxBackwardSpeed = "5";
   maxSideSpeed = "5";
   maxForwardCrouchSpeed = "3";
   maxBackwardCrouchSpeed = "2";
   maxSideCrouchSpeed = "2";
   airControl = 0.1;
   jumpForce = 1080;
   canJet = 0;
   canRide = 1;
   showEnergyBar = 1;
        maxUnderwaterForwardSpeed = 80;
        maxUnderwaterBackwardSpeed = 80;
        maxUnderwaterSideSpeed = 80;
   jetEmitter = "./AVJetSpark.png";
   jetGroundEmitter = "./AVJetSpark.png";
   jetGroundDistance = 10;

        mass = 60;
        drag = 0.1;
        maxdrag = 0.52;
        density = 0.7;
        maxEnergy =  10;
        repairRate = 0.4;
        energyPerDamagePoint = 75.0;

        rechargeRate = 0.4;

        useCustomPainEffects = true;
        PainSound         = "./AVPainSound.wav";
        DeathSound         = "./AVDeathSound.wav";

        pickupRadius = 0.75;

        JumpSound         = "./AVJumpSound.wav";

        maxForwardCrouchSpeed = 3;
        maxBackwardCrouchSpeed = 2;
        maxSideCrouchSpeed = 2;

        jumpForce = 17 * 63; //17 * 63;
        jumpEnergyDrain = 0;
        minJumpEnergy = 0;
        jumpDelay = 0;
        jumpsound = "./AVJump.wav";
        camerahorizontaloffset = 1;
   cameraverticaloffset = 1;
   cameraMaxDist = 3;
   cameraTilt = 0.2;
   maxfreelookangle = 1;
   thirdPersonOnly = 1;
   minJetEnergy = 2;
   renderFirstPerson = true;
   jetEnergyDrain = 7;
   canJet = 0;
   jetsound = "./AVJet.wav";

   uiName = "AV Player";
   showEnergyBar = true;

   runSurfaceAngle  = 25;
   jumpSurfaceAngle = 25;

};

datablock PlayerData(PlayerAdvancedActive : PlayerAdvanced)
{
   runEnergyDrain = 7;
   minRunEnergy = 2;
   maxForwardSpeed = "15";
   maxBackwardSpeed = "10";
   maxSideSpeed = "10";

   maxForwardCrouchSpeed = "3";
   maxBackwardCrouchSpeed = "2";
   maxSideCrouchSpeed = "2";

   airControl = 0;

   uiName = "";

   canRide = 0;
};

package AdvancedPlayer
{
   function Armor::onTrigger(%data,%player,%slot,%io)
   {
      if(%slot == 4)
      {
         if(%io && %data.getName() $= "PlayerAdvanced")
         {
            %player.changeDatablock(PlayerAdvancedActive);
            %tool = %player.currTool;
            //servercmdunusetool(%player.client);
            %player.currTool = %tool;
         } else if(!%io && %data.getName() $= "PlayerAdvancedActive")
         {
            %player.changeDatablock(PlayerAdvanced);
            //servercmduseTool(%player.client,%player.currTool);
         }
      }
      Parent::onTrigger(%data,%player,%slot,%io);
   }
};
activatePackage(AdvancedPlayer);


This is approximately how high the player can jump.


This is the Run/Sprint error..
« Last Edit: August 18, 2014, 05:53:15 PM by Yoke »

Sound profiles need to be defined as datablocks.

Code: [Select]
datablock AudioProfile(JumpSound)
{
   filename = "./sound.wav";
   description = AudioClose3D;
   preload = true;
};

For the not jumping issue, try using trace(1); in the console, and then sprint and try to jump. See if you can find anything that tells you why it may not be activating.

Thanks, that actually helped a lot.