Author Topic: Need help with script for Weapon_Cheese  (Read 2936 times)

ok i sent you the gun sorry it took me so long had to do it this morning

Tom

The model file is named cheese.cs, but the script has the shape files as cheeseholes.cs


Tom

You need the change the model's file name to cheeseholes.dts or change the script so it says cheese.dts.

The only thing that has to be changed is the adddamagetype and damagetype, if you want them to be the same as the sword, you can't do adddamagetype = sword

The only thing that has to be changed is the adddamagetype and damagetype, if you want them to be the same as the sword, you can't do adddamagetype = sword
what do i do then if i want it to be the same damage as sword
The model file is named cheese.cs, but the script has the shape files as cheeseholes.cs
i know i sent you the wrong model theres one with holes and wone with no holes

If you want it to use the same damagetype as the sword, it will need to have the sword enabled. Delete "AddDamageType = Sword" because that will overwrite the sword damage datablock.

This is also useless:

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


the new script
//Cheese.cs
datablock AudioProfile(CheeseDrawSound)
{
   filename    = "./CheeseDraw.wav";
   description = AudioClosest3d;
   preload = true;
};
datablock AudioProfile(CheeseHitSound)
{
   filename    = "./CheeseHit.wav";
   description = AudioClosest3d;
   preload = true;
};


//effects
datablock ParticleData(CheeseExplosionParticle)
{
   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(CheeseExplosionEmitter)
{
   ejectionPeriodMS = 7;
   periodVarianceMS = 0;
   ejectionVelocity = 8;
   velocityVariance = 1.0;
   ejectionOffset   = 0.0;
   thetaMin         = 0;
   thetaMax         = 60;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = "cheeseExplosionParticle";

   uiName = "Cheese Hit";
};

   soundProfile = CheeseHitSound;

   particleEmitter = cheeseExplosionEmitter;
   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("cheese",   '<bitmap:add-ons/Weapon_Cheese/CI_Cheese> %1',    '%2 <bitmap:add-ons/Weapon_Cheese/CI_Cheese> %1',0.75,1);
datablock ProjectileData(cheeseProjectile)
{
   directDamage        = 35;
   directDamageType  = $DamageType::cheese;
   radiusDamageType  = $DamageType::cheese;
   explosion           = cheeseExplosion;
   //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";

   uiName = "Cheese Slice";
};


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

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

   //gui stuff
   uiName = "Cheese";
   iconName = "./icon_Cheese";
   doColorShift = true;
   colorShiftColor = "0.471 0.471 0.471 1.000";

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

////////////////
//weapon image//
////////////////
datablock ShapeBaseImageData(cheeseImage)
{
   // Basic Item properties
   shapeFile = "./cheeseholes.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;

   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 = cheeseItem;
   ammo = " ";
   projectile = cheeseProjectile;
   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]                    = CheeseDrawSound;

   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;

   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 CheeseImage::onPreFire(%this, %obj, %slot)
{
   %obj.playthread(2, armattack);
}

function cheeseImage::onStopFire(%this, %obj, %slot)
{   
   %obj.playthread(2, root);
}

Tom

Did you change the cheese.dts to cheeseholes.dts?

no i took out the cheese model and put in the cheeseholes model, but its still not showing up in game :\

Chewy stole Kre's avatar concept >:U
you sir, am fayul muchly.

Chewy stole Kre's avatar concept >:U
you sir, am fayul muchly.
? i got one of those faces from the topic thingy
BUMP
i wanna finish the cheese

Mine looks like he haves Downs Syndrome.
- -
 U

I know I shouldn't really say anything unless I can help (I can't btw) but CHEESE!

YAY  :iceCream: :iceCream: :iceCream: :iceCream: :iceCream: