Author Topic: I need help!  (Read 1444 times)

Hey, well this is my first time trying to make an addon. I know I really didn't make it I just changed some stuff on the fireworks script. (mainly cause it looks weird coming from the printer and stuff....
Anyway, the problem is that I have it saved in the addons folder as a cs file and it shows up when I check it off in the addons on Blockland. The problem is that when I go into the game, place a brick, and use the wrench, it does not appear there...... not even its name...... can you help? It uses the wand model instead. Here's the code:


Code: [Select]
//-----------------------------------------------------------------------------
// Script_FireWorksWand
// Copyright (c) SolarFlare Productions, Inc.
//-----------------------------------------------------------------------------

//-----------------------------------------------------------------------------
// Audio

datablock AudioProfile(fireWorksShot)
{
   filename    = "./sound/exitWater.wav";
   description = AudioClose3d;
   preload = true;
};
datablock AudioProfile(fireWorksBoom)
{
   filename    = "./sound/fireWorksBoom.wav";
   description = AudioClose3d;
   preload = true;
};

//-----------------------------------------------------------------------------
// Item

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

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

//gui stuff
uiName = "FWW";
iconName = "base/client/ui/itemIcons/Wand";
doColorShift = true;
colorShiftColor = "0.25 0.25 0.25 1.000";

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

//-----------------------------------------------------------------------------
// Image

datablock ShapeBaseImageData(fireWorksImage)
{
   // Basic Item properties
   shapeFile = "base/data/shapes/wand.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.7 1.2 -0.55";
   rotation = eulerToMatrix( "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 = true;

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

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

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

   doColorShift = true;
   colorShiftColor = fireWorksItem.colorShiftColor;//"0.400 0.196 0 1.000";

   //casing = " ";

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

stateName[1]                    = "Ready";
stateTransitionOnTriggerDown[1] = "Fire";
stateAllowImageChange[1]        = true;
stateSequence[1]         = "Ready";

stateName[2]                    = "Fire";
stateTransitionOnTimeout[2]     = "Reload";
stateTimeoutValue[2]            = 0.14;
stateFire[2]                    = true;
stateAllowImageChange[2]        = false;
stateSequence[2]                = "Fire";
stateScript[2]                  = "onFire";
stateWaitForTimeout[2] = true;
stateEmitterTime[2] = 0.05;
stateEmitterNode[2] = "muzzleNode";
stateSound[2] = fireWorksShot;
stateEjectShell[2]              = true;

stateName[4] = "Reload";
stateSequence[4]                = "Reload";
stateTransitionOnTriggerUp[4]   = "Ready";
stateSequence[4]         = "Ready";

};

function fireWorksImage::onFire(%this,%obj,%slot)
{
   %projectile = "fireWorks" @ getRandom(1, $fireWorksCount) @ "Projectile";

   %muzzleVector = %obj.getMuzzleVector(%slot);
   %objectVelocity = %obj.getVelocity();
   %velocity = VectorAdd(%vector1,%vector2);
   %muzzleVelocity = VectorScale(%muzzleVector, %projectile.muzzleVelocity);
   VectorScale(%objectVelocity, %projectile.velInheritFactor);

   %p = new (%this.projectileType)() {
      dataBlock        = %projectile;
      initialVelocity  = %muzzleVelocity;
      initialPosition  = %obj.getMuzzlePoint(%slot);
      sourceObject     = %obj;
      sourceSlot       = %slot;
      client           = %obj.client;
   };

   MissionCleanup.add(%p);
   return %p;
}

//-----------------------------------------------------------------------------
// FireWorks Types

// FireWork 1

datablock ParticleData(fireWorks1TrailParticle)
{
dragCoefficient      = 3;
gravityCoefficient   = -0.0;
inheritedVelFactor   = 1.0;
constantAcceleration = 0.0;
lifetimeMS           = 525;
lifetimeVarianceMS   = 55;
textureName          = "base/lighting/corona";
spinSpeed = 10.0;
spinRandomMin = -500.0;
spinRandomMax = 500.0;
colors[0]     = "0.9 0.2 0.2 0.9";
colors[1]     = "0.9 0.2 0.2 0.0";
sizes[0]      = 0.15;
sizes[1]      = 0.25;

useInvAlpha = false;
};
datablock ParticleEmitterData(fireWorks1TrailEmitter)
{
   ejectionPeriodMS = 3;
   periodVarianceMS = 0;
   ejectionVelocity = 1;
   velocityVariance = 0.0;
   ejectionOffset   = 0.0;
   thetaMin         = 0;
   thetaMax         = 90;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = "fireWorks1TrailParticle";
};
datablock ParticleData(fireWorks1ExplosionParticle)
{
dragCoefficient      = 8;
gravityCoefficient   = 0;
inheritedVelFactor   = 6;
constantAcceleration = 0.0;
lifetimeMS           = 1000;
lifetimeVarianceMS   = 600;
textureName          = "base/lighting/corona";
spinSpeed = 10.0;
spinRandomMin = -50.0;
spinRandomMax = 50.0;
colors[0]     = "0.9 0.2 0.2 0.9";
colors[1]     = "0.2 0.9 0.2 0.9";
colors[2]     = "0.2 0.2 0.9 0.9";
sizes[0]      = 1.6;
sizes[1]      = 1.0;
sizes[2]      = 0.3;

useInvAlpha = false;
};
datablock ParticleEmitterData(fireWorks1ExplosionEmitter)
{
   ejectionPeriodMS = 8000;
   periodVarianceMS = 700;
   ejectionVelocity = 80;
   velocityVariance = 1.0;
   ejectionOffset   = 0.0;
   thetaMin         = 89;
   thetaMax         = 90;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = "fireWorks1ExplosionParticle";
};
datablock ExplosionData(fireWorks1Explosion)
{
   soundProfile = fireWorksBoom;

   lifeTimeMS = 150;

   particleEmitter = fireWorks1ExplosionEmitter;
   particleDensity = 150;
   particleRadius = 0.2;

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

   shakeCamera = false;
   camShakeFreq = "10.0 11.0 10.0";
   camShakeAmp = "1.0 1.0 1.0";
   camShakeDuration = 0.5;
   camShakeRadius = 10.0;

   // Dynamic light
   lightStartRadius = 0;
   lightEndRadius = 2;
   lightStartColor = "0.3 0.6 0.7";
   lightEndColor = "0 0 0";
};
datablock ProjectileData(fireWorks1Projectile)
{
   explosion           = fireWorks1Explosion;
   particleEmitter     = fireWorks1TrailEmitter;

   muzzleVelocity      = 90;
   velInheritFactor    = 1;

   armingDelay         = 00;
   lifetime            = 500;
   fadeDelay           = 200;
   bounceElasticity    = 0.5;
   bounceFriction      = 0.20;
   isBallistic         = false;
   gravityMod          = 0.0;
   explodeOnDeath      = true;

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

// FireWork 2

datablock ParticleData(fireWorks2TrailParticle)
{
dragCoefficient      = 3;
gravityCoefficient   = -0.0;
inheritedVelFactor   = 1.0;
constantAcceleration = 0.0;
lifetimeMS           = 525;
lifetimeVarianceMS   = 55;
textureName          = "base/lighting/flare";
spinSpeed = 10.0;
spinRandomMin = -500.0;
spinRandomMax = 500.0;
colors[0]     = "0.9 0.8 0.2 0.9";
colors[1]     = "0.9 0.8 0.2 0.9";
sizes[0]      = 0.15;
sizes[1]      = 0.25;

useInvAlpha = false;
};
datablock ParticleEmitterData(fireWorks2TrailEmitter)
{
   ejectionPeriodMS = 3;
   periodVarianceMS = 0;
   ejectionVelocity = 5;
   velocityVariance = 0.0;
   ejectionOffset   = 0.0;
   thetaMin         = 0;
   thetaMax         = 90;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = "fireWorks2TrailParticle";
};
datablock ParticleData(fireWorks2ExplosionParticle)
{
dragCoefficient      = 8;
gravityCoefficient   = 0;
inheritedVelFactor   = 6;
constantAcceleration = 0.0;
lifetimeMS           = 1000;
lifetimeVarianceMS   = 600;
textureName          = "base/lighting/flare";
spinSpeed = 10.0;
spinRandomMin = -50.0;
spinRandomMax = 50.0;
colors[0]     = "0.9 0.8 0.2 0.9";
colors[1]     = "0.9 0.8 0.2 0.9";
colors[2]     = "0.9 0.8 0.2 0.9";
sizes[0]      = 1.3;
sizes[1]      = 1.0;
sizes[2]      = 0.3;

useInvAlpha = false;
};
datablock ParticleEmitterData(fireWorks2ExplosionEmitter)
{
   ejectionPeriodMS = 8000;
   periodVarianceMS = 700;
   ejectionVelocity = 60;
   velocityVariance = 1.0;
   ejectionOffset   = 0.0;
   thetaMin         = 89;
   thetaMax         = 90;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = "fireWorks2ExplosionParticle";
};
datablock ExplosionData(fireWorks2Explosion)
{
   soundProfile = fireWorksBoom;

   lifeTimeMS = 150;

   particleEmitter = fireWorks2ExplosionEmitter;
   particleDensity = 200;
   particleRadius = 0.2;

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

   shakeCamera = false;
   camShakeFreq = "10.0 11.0 10.0";
   camShakeAmp = "1.0 1.0 1.0";
   camShakeDuration = 0.5;
   camShakeRadius = 10.0;

   // Dynamic light
   lightStartRadius = 0;
   lightEndRadius = 2;
   lightStartColor = "0.3 0.6 0.7";
   lightEndColor = "0 0 0";
};
datablock ProjectileData(fireWorks2Projectile)
{
   explosion           = fireWorks2Explosion;
   particleEmitter     = fireWorks2TrailEmitter;

   muzzleVelocity      = 90;
   velInheritFactor    = 1;

   armingDelay         = 00;
   lifetime            = 500;
   fadeDelay           = 200;
   bounceElasticity    = 0.5;
   bounceFriction      = 0.20;
   isBallistic         = false;
   gravityMod          = 0.0;
   explodeOnDeath      = true;

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

// FireWorks 3

datablock ParticleData(fireWorks3TrailParticle)
{
dragCoefficient      = 3;
gravityCoefficient   = -0.0;
inheritedVelFactor   = 1.0;
constantAcceleration = 0.0;
lifetimeMS           = 525;
lifetimeVarianceMS   = 55;
textureName          = "base/lighting/lightFalloffMono";
spinSpeed = 10.0;
spinRandomMin = -500.0;
spinRandomMax = 500.0;
colors[0]     = "0.4 0.8 0.4 0.9";
colors[1]     = "0.4 0.4 0.8 0.9";
colors[2]     = "0.8 0.4 0.4 0.9";
sizes[0]      = 0.6;
sizes[1]      = 0.2;
sizes[2]      = 0.3;

useInvAlpha = false;
};
datablock ParticleEmitterData(fireWorks3TrailEmitter)
{
   ejectionPeriodMS = 3;
   periodVarianceMS = 0;
   ejectionVelocity = 2;
   velocityVariance = 0.0;
   ejectionOffset   = 0.0;
   thetaMin         = 0;
   thetaMax         = 90;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = "fireWorks3TrailParticle";
};
datablock ParticleData(fireWorks3ExplosionParticle)
{
dragCoefficient      = 8;
gravityCoefficient   = 0;
inheritedVelFactor   = 6;
constantAcceleration = 0.0;
lifetimeMS           = 1000;
lifetimeVarianceMS   = 600;
textureName          = "base/lighting/lightFalloffMono";
spinSpeed = 10.0;
spinRandomMin = -50.0;
spinRandomMax = 50.0;
colors[0]     = "0.4 0.8 0.4 0.9";
colors[1]     = "0.4 0.4 0.8 0.9";
colors[2]     = "0.8 0.4 0.4 0.9";
sizes[0]      = 1.3;
sizes[1]      = 1.0;
sizes[2]      = 0.3;

useInvAlpha = false;
};
datablock ParticleEmitterData(fireWorks3ExplosionEmitter)
{
   ejectionPeriodMS = 8000;
   periodVarianceMS = 700;
   ejectionVelocity = 20;
   velocityVariance = 1.0;
   ejectionOffset   = 10;
   thetaMin         = 89;
   thetaMax         = 90;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = "fireWorks3ExplosionParticle";
};
datablock ExplosionData(fireWorks3Explosion)
{
   soundProfile = fireWorksBoom;

   lifeTimeMS = 150;

   particleEmitter = fireWorks3ExplosionEmitter;
   particleDensity = 600;
   particleRadius = 0.2;

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

   shakeCamera = false;
   camShakeFreq = "10.0 11.0 10.0";
   camShakeAmp = "1.0 1.0 1.0";
   camShakeDuration = 0.5;
   camShakeRadius = 10.0;

   // Dynamic light
   lightStartRadius = 0;
   lightEndRadius = 2;
   lightStartColor = "0.3 0.6 0.7";
   lightEndColor = "0 0 0";
};
datablock ProjectileData(fireWorks3Projectile)
{
   explosion           = fireWorks3Explosion;
   particleEmitter     = fireWorks3TrailEmitter;

   muzzleVelocity      = 90;
   velInheritFactor    = 1;

   armingDelay         = 00;
   lifetime            = 500;
   fadeDelay           = 200;
   bounceElasticity    = 0.5;
   bounceFriction      = 0.20;
   isBallistic         = false;
   gravityMod          = 0.0;
   explodeOnDeath      = true;

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

// FireWork 4

datablock ParticleData(fireWorks4TrailParticle)
{
dragCoefficient      = 3;
gravityCoefficient   = -0.0;
inheritedVelFactor   = 1.0;
constantAcceleration = 0.0;
lifetimeMS           = 525;
lifetimeVarianceMS   = 55;
textureName          = "base/data/particles/star1";
spinSpeed = 10.0;
spinRandomMin = -500.0;
spinRandomMax = 500.0;
colors[0]     = "0.2 0.2 0.9 0.9";
colors[1]     = "0.2 0.2 0.9 0.0";
sizes[0]      = 0.15;
sizes[1]      = 0.25;

useInvAlpha = false;
};
datablock ParticleEmitterData(fireWorks4TrailEmitter)
{
   ejectionPeriodMS = 3;
   periodVarianceMS = 0;
   ejectionVelocity = 1;
   velocityVariance = 0.0;
   ejectionOffset   = 0.0;
   thetaMin         = 0;
   thetaMax         = 90;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = "fireWorks4TrailParticle";
};
datablock ParticleData(fireWorks4ExplosionParticle)
{
dragCoefficient      = 8;
gravityCoefficient   = 0;
inheritedVelFactor   = 6;
constantAcceleration = 0.0;
lifetimeMS           = 1000;
lifetimeVarianceMS   = 600;
textureName          = "base/data/particles/star1";
spinSpeed = 10.0;
spinRandomMin = -50.0;
spinRandomMax = 50.0;
colors[0]     = "0.2 0.2 0.9 0.9";
colors[1]     = "0.2 0.2 0.6 0.9";
colors[2]     = "0.2 0.2 0.9 0.9";
sizes[0]      = 1.6;
sizes[1]      = 1.0;
sizes[2]      = 0.3;

useInvAlpha = false;
};
datablock ParticleEmitterData(fireWorks4ExplosionEmitter)
{
   ejectionPeriodMS = 8000;
   periodVarianceMS = 700;
   ejectionVelocity = 80;
   velocityVariance = 1.0;
   ejectionOffset   = 0.0;
   thetaMin         = 89;
   thetaMax         = 90;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = "fireWorks4ExplosionParticle";
};
datablock ExplosionData(fireWorks4Explosion)
{
   soundProfile = fireWorksBoom;

   lifeTimeMS = 150;

   particleEmitter = fireWorks4ExplosionEmitter;
   particleDensity = 150;
   particleRadius = 0.2;

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

   shakeCamera = false;
   camShakeFreq = "10.0 11.0 10.0";
   camShakeAmp = "1.0 1.0 1.0";
   camShakeDuration = 0.5;
   camShakeRadius = 10.0;

   // Dynamic light
   lightStartRadius = 0;
   lightEndRadius = 2;
   lightStartColor = "0.3 0.6 0.7";
   lightEndColor = "0 0 0";
};
datablock ProjectileData(fireWorks4Projectile)
{
   explosion           = fireWorks4Explosion;
   particleEmitter     = fireWorks4TrailEmitter;

   muzzleVelocity      = 90;
   velInheritFactor    = 1;

   armingDelay         = 00;
   lifetime            = 500;
   fadeDelay           = 200;
   bounceElasticity    = 0.5;
   bounceFriction      = 0.20;
   isBallistic         = false;
   gravityMod          = 0.0;
   explodeOnDeath      = true;

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


$fireWorksCount = 4;

I re-read the thing again; You need to rename the datablocks.

IE, change all the fireWorks to fireWorks2 with Ctrl-H.
« Last Edit: January 11, 2008, 11:04:43 AM by Bushido »

It says at the top "Solarflare Productions".

Stop being a theif.
solar made some fireworks?

« Last Edit: January 11, 2008, 06:38:18 PM by ryan31394 »