Author Topic: weapon script help  (Read 2142 times)

very sorry, but can you fix my appleshot? PLEASE tell me what is wrong with it and explain how to fix it if you can

Code: [Select]
//Weapon_Appleshot.cs
//Appleshot Stuff - BOOMBOOMBOOM

//audio
datablock AudioProfile(Appleshotfiresound)
{
   filename    = "./sound/impact2A.wav";
   description = AudioClose3d;
   preload = true;
};
datablock AudioProfile(blastExplosionSound)
{
   filename    = "./sound/spearHit.wav";
   description = AudioClose3d;
   preload = true;
};

//blast trail
datablock ParticleData(blastTrailParticle)
{
dragCoefficient = 3.0;
windCoefficient = 0.0;
gravityCoefficient = 0.0;
inheritedVelFactor = 0.0;
constantAcceleration = 0.0;
lifetimeMS = 1500;
lifetimeVarianceMS = 0;
spinSpeed = 10.0;
spinRandomMin = -50.0;
spinRandomMax = 50.0;
useInvAlpha = false;
animateTexture = false;
//framesPerSec = 1;

textureName = "base/data/particles/bubble";
//animTexName = "base/data/particles/dot";

// Interpolation variables
colors[0] = "0 0 1 0.9";
colors[1] = "0 0 1 0.9";
sizes[0] = 0.3;
sizes[1] = 0.0;
times[0] = 0.0;
times[1] = 1.0;
};

datablock ParticleEmitterData(blastTrailEmitter)
{
   ejectionPeriodMS = 2;
   periodVarianceMS = 0;

   ejectionVelocity = 0.25; //0.25;
   velocityVariance = 0; //0.10;

   ejectionOffset = 0;

   thetaMin         = 0.0;
   thetaMax         = 0.0; 

   particles = blastTrailParticle;
};

//effects
datablock ParticleData(blastExplosionParticle)
{
dragCoefficient      = 5;
gravityCoefficient   = 0.1;
inheritedVelFactor   = 0.2;
constantAcceleration = 0.0;
lifetimeMS           = 500;
lifetimeVarianceMS   = 300;
textureName          = "base/data/particles/cloud";
spinSpeed = 10.0;
spinRandomMin = -50.0;
spinRandomMax = 50.0;
colors[0]     = "1 0 0 0.9";
colors[1]     = "1 0 0 0.9";
sizes[0]      = 0.25;
sizes[1]      = 0.0;
};

datablock ParticleEmitterData(blastExplosionEmitter)
{
   ejectionPeriodMS = 7;
   periodVarianceMS = 0;
   ejectionVelocity = 5;
   velocityVariance = 1.0;
   ejectionOffset   = 0.0;
   thetaMin         = 0;
   thetaMax         = 90;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = "blastExplosionParticle";
};

datablock ExplosionData(blastExplosion)
{
   //explosionShape = "";
soundProfile = blastExplosionSound;

   lifeTimeMS = 150;

   particleEmitter = blastExplosionEmitter;
   particleDensity = 10;
   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 = "1 0 0 0.9";
   lightEndColor = "0 0 0";
};


//projectile
datablock ProjectileData(blastProjectile)
{
//   projectileShapeName = "~/shapes/rocketprojectile.dts";
   directDamage        = 1000;
   radiusDamage        = 10;
   damageRadius        = 0.5;
   explosion           = blastExplosion;
   particleEmitter     = blastTrailEmitter;

   muzzleVelocity      = 300;
   velInheritFactor    = 1;

   armingDelay         = 0;
   lifetime            = 8000;
   fadeDelay           = 7500;
   bounceElasticity    = 0.999;
   bounceFriction      = 0;
   isBallistic         = true;
   gravityMod = 0;

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


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

// Basic Item Properties
shapeFile = "./shapes/pistol.dts";
iconName = "./ItemIcons/gun";
doColorShift = true;
colorShiftColor = "1 0 0 1.000";
rotate = false;
mass = 1;
density = 0.2;
elasticity = 0.2;
friction = 0.6;
emap = true;
cost = 350;

// Dynamic properties defined by the scripts
pickUpName = "a Appleshot.";
invName = "Appleshot";
uiname = "Appleshot";
             image = AppleshotImage;

};

////////////////
//weapon image//
////////////////
datablock ShapeBaseImageData(AppleshotImage)
{
   // Basic Item properties
   shapeFile = "~/shapes/gun.dts";
   skinName = "red";
   emap = true;
   PreviewFileName = "./ItemIcons/sword.png";
cloakable = true;
   // Specify mount point & offset for 3rd person, and eye offset
   // for first person rendering.
   mountPoint = 0;
   offset = "0 0 .1";
   //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;

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

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

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

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

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

stateName[2]                    = "Fire";
stateTransitionOnTimeout[2]     = "Reload";
stateTimeoutValue[2]            = 0.3;
stateFire[2]                    = true;
stateAllowImageChange[2]        = false;
stateSequence[2]                = "Fire";
stateScript[2]                  = "onFire";
stateWaitForTimeout[2] = true;
stateSound[2] = AppleshotFireSound;

stateName[3] = "Reload";
stateSequence[3]                = "Reload";
stateAllowImageChange[3]        = false;
stateTimeoutValue[3]            = 0.2;
stateWaitForTimeout[3] = true;
stateTransitionOnTimeout[3]     = "Check";

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

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


};

And i'm not planning on releasing it but if you REALLY like it, rate it, but I think it sucks.....BIGTIME.........and I mean BIGTIME
« Last Edit: November 30, 2007, 10:28:26 PM by jake211 »

Quote
What seems to be the problem Ma'am?

No seriously, what aspect of it doesn't work? Does it fail to load completely? Won't switch when you try to equip it? Particles missing?

Quote
What seems to be the problem Ma'am?

No seriously, what aspect of it doesn't work? Does it fail to load completely? Won't switch when you try to equip it? Particles missing?
When I try to spawn it, it's not in the list

Tried it, only error I see is the lack of a blaster model, so it doesn't load (doesn't make it to the in-game add-on list)

Do you have a model named "blaster" in your add-ons/shapes/ folder?
« Last Edit: November 29, 2007, 11:15:09 PM by Muffinmix »

Tried it, only error I see is the lack of a blaster model, so it doesn't load (doesn't make it to the in-game add-on list)

Do you have a model named "blaster" in your add-ons/shapes/ folder?
oh, sorry, i'll edit first post
Done, and yes I do have the blaster model
« Last Edit: November 29, 2007, 11:24:34 PM by jake211 »

oh, and I do have a cloud2 in the script, but I changed it to just cloud for you guys


Change this part.

Code: [Select]
datablock ItemData(Appleshot)
{
category = "Weapon";  // Mission editor category
className = "Weapon"; // For inventory system

// Basic Item Properties
shapeFile = "./shapes/pistol.dts";
iconName = "./ItemIcons/gun";
doColorShift = true;
colorShiftColor = "1 0 0 1.000";
rotate = false;
mass = 1;
density = 0.2;
elasticity = 0.2;
friction = 0.6;
emap = true;
cost = 350;

// Dynamic properties defined by the scripts
uiName = 'Appleshot';
image = AppleshotImage;
};

it's not the shape file, I had the blaster model on there, but i'll try it....

ok....now I have a bit of WTF..... it shows up in the list as "132" and when I equip it just takes the place of my last weapon........you try it and see...

Don't put the uiName inside the apostrophes, use a quotation mark:

uiName = " Appleshot";

Don't put the uiName inside the apostrophes, use a quotation mark:

uiName = " Appleshot";
ok...that fixed the name problem, but it still taking the place of my last weapon, try it...and see


Code: [Select]
pickUpName = 'a Appleshot.';
invName = 'Appleshot';

As Ephi said, do not use apostrophes, use quotation marks in all your Datablock naming values.

Code: [Select]
pickUpName = "a Appleshot.";
invName = "Appleshot";

And also

Code: [Select]
skinName = 'red';
To

Code: [Select]
skinName = "red";
Try that.

I did that, I just forgot to update the script, but it still just takes the place of my last weapon....help?