Author Topic: Sound/Emitters not working  (Read 652 times)

So, I have been working on a new addon lately, everything went fine until i tested it ingame.
It is a food item, everything works except the sound, and the emitters that should appear when you eat the food.

Here's the script:

//Steak.cs

datablock AudioProfile(SteakEatenSound)
{
   filename    = "./steakbite.wav";
   description = AudioClose3d;
   preload = true;
};

datablock ParticleData(LoveSteakParticle)
{
   dragCoefficient      = 5.0;
   gravityCoefficient   = -0.2;
   inheritedVelFactor   = 0.0;
   constantAcceleration = 0.0;
   lifetimeMS           = 1000;
   lifetimeVarianceMS   = 500;
   useInvAlpha          = false;
   textureName          = "./LoveSteak";
   colors[0]     = "1.0 1.0 1.0 1";
   colors[1]     = "1.0 1.0 1.0 1";
   colors[2]     = "0.0 0.0 0.0 0";
   sizes[0]      = 0.4;
   sizes[1]      = 0.6;
   sizes[2]      = 0.4;
   times[0]      = 0.0;
   times[1]      = 0.2;
   times[2]      = 1.0;
};

datablock ParticleEmitterData(LoveSteakEmitter)
{
   ejectionPeriodMS = 35;
   periodVarianceMS = 0;
   ejectionVelocity = 0.5;
   ejectionOffset   = 1.0;
   velocityVariance = 0.49;
   thetaMin         = 0;
   thetaMax         = 120;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = "LoveSteakParticle";

   uiName = "Emote - Love Steak";
};

datablock ShapeBaseImageData(LoveSteakImage)
{
   shapeFile = "./Steak.dts";
   emap = false;

   mountPoint = $HeadSlot;

   stateName[0]               = "Ready";
   stateTransitionOnTimeout[0]      = "FireA";
   stateTimeoutValue[0]         = 0.01;

   stateName[1]               = "FireA";
   stateTransitionOnTimeout[1]      = "Done";
   stateWaitForTimeout[1]         = True;
   stateTimeoutValue[1]         = 0.350;
   stateSound[1]               = SteakEatenSound;
   stateEmitter[1]               = LoveSteakEmitter;
   stateEmitterTime[1]            = 0.350;

   stateName[2]               = "Done";
   stateScript[2]               = "onDone";
};
function LoveSteakImage::onDone(%this,%obj,%slot)
{
   %obj.unMountImage(%slot);
}

datablock ItemData(SteakItem)
{
   category = "Weapon";  // Mission editor category
   className = "Weapon"; // For inventory system

    // Basic Item Properties
   shapeFile = "./SteakModel.dts";
   rotate = false;
   mass = 1;
   density = 0.2;
   elasticity = 0.2;
   friction = 0.6;
   emap = true;

   //gui stuff
   uiName = "Steak";
   iconName = "./SteakIcon";
   doColorShift = false;

    // Dynamic properties defined by the scripts
   image = SteakImage;
   canDrop = true;
};

datablock ShapeBaseImageData(SteakImage)
{
   // Basic Item properties
   shapeFile = "./Steakmodel.dts";
   emap = true;

   // Specify mount point & offset for 3rd person, and eye offset
   // for first person rendering.
   mountPoint = 0;
   offset = "0 0 0";
   eyeOffset = 0; //"0.7 1.2 -0.5";
   rotation = eulerToMatrix( "0 0 0" );

   className = "WeaponImage";
   item = SteakItem;

   //raise your arm up or not
   armReady = false;

   doColorShift = true;
   colorShiftColor = "0.400 0.196 0 1.000";

   // Initial start up state
   stateName[0]                     = "Ready";
   stateTransitionOnTriggerDown[0]  = "Fire";
   stateAllowImageChange[0]         = true;

   stateName[1]                     = "Fire";
   stateTransitionOnTimeout[1]      = "Ready";
   stateAllowImageChange[1]         = true;
      stateScript[1]                   = "onFire";
   stateTimeoutValue[1]         = 1;
};

function SteakImage::onFire(%this,%obj,%slot)
{
   %currSlot = %obj.currTool;
   %obj.setDamageLevel(0);
   %obj.emote(LoveSteakImage,1);
   %obj.tool[%currSlot] = 0;
   %obj.weaponCount--;
   messageClient(%obj.client,'MsgItemPickup','',%currSlot,0);
   serverCmdUnUseTool(%obj.client);
}

package SteakPackage
{
   function Armor::onCollision(%this, %obj, %col, %a, %b, %c, %d, %e, %f)
   {
      if(%col.dataBlock $= "SteakItem" && %obj.getDamagePercent() < 100 && %col.canPickup)
      {
         if(!isObject(%col.spawnbrick) && !%col.nowPickup)   
         {
            if(isObject(%obj.client.minigame))
            {
               if(%obj.client.minigame $= %col.minigame)
               {
                  if(%obj.getDamageLevel() >= 1)
                  {
                     %obj.setDamageLevel(0);
                     %obj.emote(LoveSteakImage);
                     %col.delete();
                  }
                  else
                  {
                     %col.nowPickup = 1;
                  }
                  return;
               }
            }
         }

         for(%i=0;%i<%this.maxTools;%i++)
         {
            %item = %obj.tool[%i];
            if(%item $= 0 || %item $= "")
            {
               %freeSlot = 1;
               break;
            }
         }

         if(%freeSlot)
         {
            %obj.pickup(%col);
            return;
         }
      }
      Parent::onCollision(%this, %obj, %col, %a, %b, %c, %d, %e, %f);
   }
};
activatePackage(SteakPackage);

datablock DecalData(SteakIcon)
{
   textureName = "Add-Ons/Item_Steak/Steak";
};


It is only my fourth addon, so i'm not really that good at scripting.

Thanks

Aw c'mon

Anybody?

I want to release this stuff

Quick edit: it only plays the default *beep* atm.
« Last Edit: January 01, 2011, 06:05:11 PM by JakeBlade »

Quick edit: it only plays the default *beep* atm.

Instead of your sound or is it supposed to play?
Also does the console say anything?

Well, console gives 2 error's on use:

The beep sound shouldn't play, since it should play a nom sound
« Last Edit: January 02, 2011, 05:46:02 AM by JakeBlade »

would also be nice to have the whole line  :cookieMonster:
and this is when you spawn, look for errors while loading