Author Topic: My add-on doesnt show up  (Read 1690 times)

I made a couple add-ons. Some I just can't script because I simply don't know how. But others, like my Spikemace, don't show up ingame if I copy and edit another script. I also tried Masterlegodude's melee example script and renamed edited. But everytime i start a game and check off Spikemace, a buffer overrun s detected. I don't know what this means but I'm assuming my mace is over writing something. Also there is somethign most likely wrong with the script. Hold on, let me post the script.

Heres the script

//Spikemace.cs
datablock AudioProfile(<Spikemace>DrawSound)
{
   filename    = "./sound/swordDraw.wav";
   description = AudioClosest3d;
   preload = true;
};
datablock AudioProfile(<Spikemace>HitSound)
{
   filename    = "./sound/swordHit.wav";
   description = AudioClosest3d;
   preload = true;
};


//effects
datablock ParticleData(<SpikemaceExplosionParticle)
{
   dragCoefficient      = 2;
   gravityCoefficient   = 1.0;
   inheritedVelFactor   = 0.2;
   constantAcceleration = 0.0;
   spinRandomMin = -90;
   spinRandomMax = 90;
   lifetimeMS           = 500;
   lifetimeVarianceMS   = 300;
   textureName          = "base/data/particles/chunk";
   colors[0]     = "0.7 0.7 0.9 0.9";
   colors[1]     = "0.9 0.9 0.9 0.0";
   sizes[0]      = 0.5;
   sizes[1]      = 0.25;
};

datablock ParticleEmitterData(SpikemaceExplosionEmitter)
{
   ejectionPeriodMS = 7;
   periodVarianceMS = 0;
   ejectionVelocity = 8;
   velocityVariance = 1.0;
   ejectionOffset   = 0.0;
   thetaMin         = 0;
   thetaMax         = 60;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = "SpikemaceExplosionParticle";
};

datablock ExplosionData(SpikemaceExplosion)
{
   //explosionShape = "";
   lifeTimeMS = 500;

   soundProfile = SpikemaceHitSound;

   particleEmitter = SpikemaceExplosionEmitter;
   particleDensity = 10;
   particleRadius = 0.2;

   faceViewer     = true;
   explosionScale = "1 1 1";

   shakeCamera = true;
   camShakeFreq = "20.0 22.0 20.0";
   camShakeAmp = "1.0 1.0 1.0";
   camShakeDuration = 0.5;
   camShakeRadius = 10.0;

   // Dynamic light
   lightStartRadius = 3;
   lightEndRadius = 0;
   lightStartColor = "00.0 0.2 0.6";
   lightEndColor = "0 0 0";
};


//projectile
AddDamageType("<Spikemace>",   '<bitmap:add-ons/ci/sword> %1',    '%2 <bitmap:add-ons/ci/sword> %1',1,1);
datablock ProjectileData(<YOURWEAPONNAME>Projectile)
{
   //projectileShapeName = "~/data/shapes/arrow.dts";
   directDamage        = 35;
   directDamageType  = $DamageType::<YOURWEAPONNAME>;
   radiusDamageType  = $DamageType::<YOURWEAPONNAME>;
   explosion           = <YOURWEAPONNAME>Explosion;
   //particleEmitter     = as;

   muzzleVelocity      = 50;
   velInheritFactor    = 1;

   armingDelay         = 0;
   lifetime            = 100;
   fadeDelay           = 70;
   bounceElasticity    = 0;
   bounceFriction      = 0;
   isBallistic         = false;
   gravityMod = 0.0;

   hasLight    = false;
   lightRadius = 3.0;
   lightColor  = "0 0 0.5";
};


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

    // Basic Item Properties
   shapeFile = "./shapes/<YOURWEAPONNAME>.dts";
   mass = 1;
   density = 0.2;
   elasticity = 0.2;
   friction = 0.6;
   emap = true;

   //gui stuff
   uiName = "Spikemace";
   iconName = "./ItemIcons/Spikemace";
   doColorShift = true;
   colorShiftColor = "0.471 0.471 0.471 1.000";

    // Dynamic properties defined by the scripts
   image = <YOURWEAPONNAME>Image;
   canDrop = true;
};

//function Spikemace::onUse(%this,%user)
//{
//   //if the image is mounted already, unmount it
//   //if it isnt, mount it
//
//   %mountPoint = %this.image.mountPoint;
//   %mountedImage = %user.getMountedImage(%mountPoint);
//   
//   if(%mountedImage)
//   {
//      //echo(%mountedImage);
//      if(%mountedImage == %this.image.getId())
//      {
//         //our image is already mounted so unmount it
//         %user.unMountImage(%mountPoint);
//      }
//      else
//      {
//         //something else is there so mount our image
//         %user.mountimage(%this.image, %mountPoint);
//      }
//   }
//   else
//   {
//      //nothing there so mount
//      %user.mountimage(%this.image, %mountPoint);
//   }
//}

////////////////
//weapon image//
////////////////
datablock ShapeBaseImageData(SpikemaceImage)
{
   // Basic Item properties
   shapeFile = "./shapes/Spikemace.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.1 0.2 -0.55";

   // 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;

   eyeOffset = "0.7 1.2 -0.25";

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

   // Projectile && Ammo.
   item = <YOURWEAPONNAME>Item;
   ammo = " ";
   projectile = <YOURWEAPONNAME>Projectile;
   projectileType = Projectile;

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

   //casing = " ";
   doColorShift = true;
   colorShiftColor = "0.471 0.471 0.471 1.000";

   // 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.5;
   stateTransitionOnTimeout[0]      = "Ready";
   stateSound[0]                    = <YOURWEAPONNAME>DrawSound;

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

   stateName[2]         = "PreFire";
   stateScript[2]                  = "onPreFire";
   stateAllowImageChange[2]        = false;
   stateTimeoutValue[2]            = 0.1;
   stateTransitionOnTimeout[2]     = "Fire";

   stateName[3]                    = "Fire";
   stateTransitionOnTimeout[3]     = "CheckFire";
   stateTimeoutValue[3]            = 0.2;
   stateFire[3]                    = true;
   stateAllowImageChange[3]        = false;
   stateSequence[3]                = "Fire";
   stateScript[3]                  = "onFire";
   stateWaitForTimeout[3]      = true;
   //stateTransitionOnTriggerUp[3]   = "StopFire";

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

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


};

function SpikemaceImage::onPreFire(%this, %obj, %slot)
{
   //messageAll( 'MsgClient', 'sword prefired!!!');
   //Parent::onFire(%this, %obj, %slot);
   %obj.playthread(2, armattack);
}

function SpikemaceImage::onStopFire(%this, %obj, %slot)
{   
   %obj.playthread(2, root);
   //messageAll( 'MsgClient', 'stopfire');
}

I fixed it. Here's the code.

Code: [Select]
//Spikemace.cs
datablock AudioProfile(SpikemaceDrawSound)
{
   filename    = "./sound/swordDraw.wav";
   description = AudioClosest3d;
   preload = true;
};
datablock AudioProfile(SpikemaceHitSound)
{
   filename    = "./sound/swordHit.wav";
   description = AudioClosest3d;
   preload = true;
};


//effects
datablock ParticleData(SpikemaceExplosionParticle)
{
   dragCoefficient      = 2;
   gravityCoefficient   = 1.0;
   inheritedVelFactor   = 0.2;
   constantAcceleration = 0.0;
   spinRandomMin = -90;
   spinRandomMax = 90;
   lifetimeMS           = 500;
   lifetimeVarianceMS   = 300;
   textureName          = "base/data/particles/chunk";
   colors[0]     = "0.7 0.7 0.9 0.9";
   colors[1]     = "0.9 0.9 0.9 0.0";
   sizes[0]      = 0.5;
   sizes[1]      = 0.25;
};

datablock ParticleEmitterData(SpikemaceExplosionEmitter)
{
   ejectionPeriodMS = 7;
   periodVarianceMS = 0;
   ejectionVelocity = 8;
   velocityVariance = 1.0;
   ejectionOffset   = 0.0;
   thetaMin         = 0;
   thetaMax         = 60;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = "SpikemaceExplosionParticle";
};

datablock ExplosionData(SpikemaceExplosion)
{
   //explosionShape = "";
   lifeTimeMS = 500;

   soundProfile = SpikemaceHitSound;

   particleEmitter = SpikemaceExplosionEmitter;
   particleDensity = 10;
   particleRadius = 0.2;

   faceViewer     = true;
   explosionScale = "1 1 1";

   shakeCamera = true;
   camShakeFreq = "20.0 22.0 20.0";
   camShakeAmp = "1.0 1.0 1.0";
   camShakeDuration = 0.5;
   camShakeRadius = 10.0;

   // Dynamic light
   lightStartRadius = 3;
   lightEndRadius = 0;
   lightStartColor = "00.0 0.2 0.6";
   lightEndColor = "0 0 0";
};


//projectile
AddDamageType("Spikemace",   '<bitmap:add-ons/ci/sword> %1',    '%2 <bitmap:add-ons/ci/sword> %1',1,1);
datablock ProjectileData(SpikemaceProjectile)
{
   //projectileShapeName = "~/data/shapes/arrow.dts";
   directDamage        = 35;h
   directDamageType  = $DamageType::Spikemace;
   radiusDamageType  = $DamageType::Spikemace;
   explosion           = SpikemaceExplosion;
   //particleEmitter     = as;

   muzzleVelocity      = 50;
   velInheritFactor    = 1;

   armingDelay         = 0;
   lifetime            = 100;
   fadeDelay           = 70;
   bounceElasticity    = 0;
   bounceFriction      = 0;
   isBallistic         = false;
   gravityMod = 0.0;

   hasLight    = false;
   lightRadius = 3.0;
   lightColor  = "0 0 0.5";
};


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

    // Basic Item Properties
   shapeFile = "./shapes/Spikemace.dts";
   mass = 1;
   density = 0.2;
   elasticity = 0.2;
   friction = 0.6;
   emap = true;

   //gui stuff
   uiName = "Spikemace";
   iconName = "./ItemIcons/Spikemace";
   doColorShift = true;
   colorShiftColor = "0.471 0.471 0.471 1.000";

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

//function Spikemace::onUse(%this,%user)
//{
//   //if the image is mounted already, unmount it
//   //if it isnt, mount it
//
//   %mountPoint = %this.image.mountPoint;
//   %mountedImage = %user.getMountedImage(%mountPoint);
//   
//   if(%mountedImage)
//   {
//      //echo(%mountedImage);
//      if(%mountedImage == %this.image.getId())
//      {
//         //our image is already mounted so unmount it
//         %user.unMountImage(%mountPoint);
//      }
//      else
//      {
//         //something else is there so mount our image
//         %user.mountimage(%this.image, %mountPoint);
//      }
//   }
//   else
//   {
//      //nothing there so mount
//      %user.mountimage(%this.image, %mountPoint);
//   }
//}

////////////////
//weapon image//
////////////////
datablock ShapeBaseImageData(SpikemaceImage)
{
   // Basic Item properties
   shapeFile = "./shapes/Spikemace.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.1 0.2 -0.55";

   // 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;

   eyeOffset = "0.7 1.2 -0.25";

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

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

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

   //casing = " ";
   doColorShift = true;
   colorShiftColor = "0.471 0.471 0.471 1.000";

   // 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.5;
   stateTransitionOnTimeout[0]      = "Ready";
   stateSound[0]                    = SpikemaceDrawSound;

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

   stateName[2]         = "PreFire";
   stateScript[2]                  = "onPreFire";
   stateAllowImageChange[2]        = false;
   stateTimeoutValue[2]            = 0.1;
   stateTransitionOnTimeout[2]     = "Fire";

   stateName[3]                    = "Fire";
   stateTransitionOnTimeout[3]     = "CheckFire";
   stateTimeoutValue[3]            = 0.2;
   stateFire[3]                    = true;
   stateAllowImageChange[3]        = false;
   stateSequence[3]                = "Fire";
   stateScript[3]                  = "onFire";
   stateWaitForTimeout[3]      = true;
   //stateTransitionOnTriggerUp[3]   = "StopFire";

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

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


};

function SpikemaceImage::onPreFire(%this, %obj, %slot)
{
   //messageAll( 'MsgClient', 'sword prefired!!!');
   //Parent::onFire(%this, %obj, %slot);
   %obj.playthread(2, armattack);
}

function SpikemaceImage::onStopFire(%this, %obj, %slot)
{   
   %obj.playthread(2, root);
   //messageAll( 'MsgClient', 'stopfire');
}
« Last Edit: October 19, 2008, 06:35:00 AM by Captain Jack »


I got an error when i started blockland it said "Add damage type() - Spikemace file "Add-ons/ci/sword.png" does not exist!

« Last Edit: October 19, 2008, 04:33:57 PM by Captain Jack »

"Add damage type() - Spikemace file "Add-ons/ci/sword.png"

Remove the png.

there is no png
//projectile
AddDamageType("Spikemace",   '<bitmap:add-ons/ci/sword> %1',    '%2 <bitmap:add-ons/ci/sword> %1',1,1);
datablock ProjectileData(SpikemaceProjectile)
Not even in the DTS file.


Change "Add-Ons/ci/sword" to "Add-Ons/Weapon_Sword/CI_sword".
« Last Edit: October 19, 2008, 10:03:01 PM by Scorpion1855 »

Change "Add-Ons/ci/sword" to "Add-Ons/Weapon_Sword/CI_sword".

Ya do that.

When I did that it just became a lot worse. Some buffer over run is detected. master joltener there probably isn't anything wrong with the dts file except it might need some finishing touches such as locating the minifigs hand and getting the right size. Ill pm you the dts file in 10-15 minutes. I need to get an account of media fire(is that right? i forgot the name)

When I did that it just became a lot worse. Some buffer over run is detected. master joltener there probably isn't anything wrong with the dts file except it might need some finishing touches such as locating the minifigs hand and getting the right size. Ill pm you the dts file in 10-15 minutes. I need to get an account of media fire(is that right? i forgot the name)

you don't need a account for media fire to put files on.

yah i made one anyway. i sent it to master joltener

Maybe stop using the example .cs files, those were ment for v8...

No "shape/folder/crappy.dts" directory exist anymore.