Author Topic: Invalid Projectile... !?!  (Read 910 times)

I'm making an AntMan belt for my MBB server, but when I try to use it, it says Invalid Projectile or something in the console.
code:
Code: [Select]
datablock ItemData(AMBeltItem)
{
// Basic Item Properties
shapeFile = "base/data/shapes/empty.dts";
mass = 1;
density = 0.2;
elasticity = 0.2;
friction = 0.6;
emap = true;

//gui properties
uiName = "Ant-Man Belt";
iconName = "";
doColorShift = true;
colorShiftColor = "1.0 0.0 0.0 1.0";

// Dynamic properties defined by the scripts
image = AMBeltImage;
canDrop = false;

SmallMode = false;
};

datablock ShapeBaseImageData(AMBeltImage)
{
   // Basic Item properties
   shapeFile = "base/data/shapes/empty.dts";
   emap = true;

   // Specify mount point & offset for 3rd person, and eye offset
   // for first person rendering.
   mountPoint = 0;
   offset = "0 0 0";

   // When firing from a point offset from the eye, muzzle correction
   // will adjust the muzzle vector to point to the eye LOS point.
   // Since this weapon doesn't actually fire from the muzzle point,
   // we need to turn this off. 
   correctMuzzleVector = false;

   // Add the WeaponImage namespace as a parent, WeaponImage namespace
   // provides some hooks into the inventory system.
   className = "WeaponImage";

   // Projectile && Ammo.
   item = AMBeltItem;
   ammo = " ";
   projectile = "";
   projectileType = "";

   //melee particles shoot from eye node for consistancy
   melee = true;
   doRetraction = false;
   //raise your arm up or not
   armReady = false;

   showBricks = false;

   //casing = " ";

   doColorShift = true;
   colorShiftColor = AMBeltItem.colorShiftColor;

   // Images have a state system which controls how the animations
   // are run, which sounds are played, script callbacks, etc. This
   // state system is downloaded to the client so that clients can
   // predict state changes and animate accordingly.  The following
   // system supports basic ready->fire->reload transitions as
   // well as a no-ammo->dryfire idle state.

   // Initial start up state
stateName[0] = "Activate";
stateTimeoutValue[0] = 0.0;
stateTransitionOnTimeout[0] = "Ready";

stateName[1] = "Ready";
stateTransitionOnTriggerDown[1] = "PreFire";
stateAllowImageChange[1] = true;

stateName[2]                    = "PreFire";
stateScript[2]                  = "onPreFire";
stateAllowImageChange[2]        = true;
stateTimeoutValue[2]            = 0.01;
stateTransitionOnTimeout[2]     = "Fire";

stateName[3]                    = "Fire";
stateTransitionOnTimeout[3]     = "CheckFire";
stateTimeoutValue[3]            = 0.15;
stateFire[3]                    = true;
stateAllowImageChange[3]        = true;
stateSequence[3]                = "Fire";
stateScript[3]                  = "onFire";
stateWaitForTimeout[3] = true;
stateSequence[3]                = "Fire";

stateName[4]                    = "CheckFire";
stateTransitionOnTriggerUp[4]   = "StopFire";

stateName[5]                    = "StopFire";
stateTransitionOnTimeout[5]     = "Ready";
stateTimeoutValue[5]            = 0.01;
stateAllowImageChange[5]        = true;
stateWaitForTimeout[5]          = true;
stateSequence[5]                = "StopFire";
stateScript[5]                  = "onStopFire";
};

function AMBelt::onFire(%this, %obj, %slot)
{
if(%this.SmallMode == false)
{
%obj.setPlayerScale("0.01 0.01 0.01");
%obj.setPlayertype(PlayerAntManSmall);
}
else
{
%obj.setPayerScale("1 1 1");
%obj.setPlayertype(PlayerAntMan);
addItem(%obj, FistImage, %obj.client);
}
parent::onFire(%this, %obj, %slot);
}

Can you give us the exact console message please?

Can't know about the error until you post it here, but here are some things I found wrong with it.

Code: [Select]
function AMBelt::onFire(%this, %obj, %slot)
{
if(%this.SmallMode == false)
{
%obj.setPlayerScale("0.01 0.01 0.01");
%obj.setPlayertype(PlayerAntManSmall);
}
else
{
%obj.setPayerScale("1 1 1");
%obj.setPlayertype(PlayerAntMan);
addItem(%obj, FistImage, %obj.client);
}
parent::onFire(%this, %obj, %slot);
}
This function will never be called. AMBeltImage::onFire(%this, %obj, %slot) is the function being called when you click with the item.

Also, I highly suggest setting the SmallMode variable on the player or rather than the datablock. If you set it on the datablock and one person uses it and goes small, then when the next person uses it, it will attempt to make them regular sized.

Th error says:
Code: [Select]
Error: WeaponImage AMBeltImage - Invalid projectile ' 'And thank you jes00.

That error is because you used
Code: [Select]
projectile = ""; in your definition of AMBeltImage.

That error is because you used
Code: [Select]
projectile = ""; in your definition of AMBeltImage.
I'm pretty sure that's what they did with Item_Key. Anyways, I'll look at it when I get home.