Author Topic: Milk Shape Weapon making...  (Read 961 times)

I used Masterlegodude's tutorial and it didn't work. The problem is when I try to make a mini game with the weapon, it doesn't show up and yes I have it enabled. Ive tried a lot but I cant get a solution. Can anyone help?

It's worked for plenty of people i'm sure, you've probably done something wrong

Go to your weapon and copy and paste it all on your post, maybe i can help ya
« Last Edit: January 25, 2008, 09:01:31 PM by Masterlegodude »

Ok, here you go :


//Golfscorereseter.cs

datablock AudioProfile(GolfscorereseterFireSound)
{
   filename    = "./sound/Button.wav";
   description = AudioClose3d;
   preload = true;
};

datablock ExplosionData(GolfscorereseterExplosion)
{
   //explosionShape = "";
   lifeTimeMS = 150;

   soundProfile = GolfscorereseterExplosionSoun d;

   emitter[0] = GolfscorereseterExplosionEmit ter;
   emitter[1] = GolfscorereseterExplosionEmit ter2;
   //particleDensity = 30.0;
   //particleRadius = 1.0;

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

   shakeCamera = false;
   camShakeFreq = "7.0 8.0 7.0";
   camShakeAmp = "1.0 1.0 1.0";
   camShakeDuration = 0.5;
   camShakeRadius = 15.0;

   // Dynamic light
   lightStartRadius = 0.1;
   lightEndRadius = 0.1;
   lightStartColor = "1.0 1.0 1.0 1.0";
   lightEndColor = "1.0 1.0 1.0 1.0";

   //impulse
   impulseRadius = 0;
   impulseForce = 0;

   //radius damage
   radiusDamage        = 0;
   damageRadius        = 0;
};

//projectile
AddDamageType("RocketDirect",   '<bitmap:add-ons/ci/rocket> %1',    '%2 <bitmap:add-ons/ci/rocket> %1',1,1);
AddDamageType("RocketRadius",   '<bitmap:add-ons/ci/rocketRadius> %1',    '%2 <bitmap:add-ons/ci/rocketRadius> %1',1,0);
datablock ProjectileData(GolfscorereseterProjectile)
{
   projectileShapeName = "base/data/shapes/empty.dts";
   directDamage        = 0;
   directDamageType  = $DamageType::rocketDirect;
   radiusDamageType  = $DamageType::rocketRadius;
   impactImpulse      = 0;
   verticalImpulse      = 0;
   explosion           = GolfscorereseterExplosion;
   particleEmitter     = GolfscorereseterTrailEmitter;

   muzzleVelocity      = 70;
   velInheritFactor    = 1;

   armingDelay         = 0;
   lifetime            = 20000;
   fadeDelay           = 19500;
   bounceElasticity    = 0;
   bounceFriction      = 0;
   isBallistic         = true;
   gravityMod = 0.20;

   hasLight    = false;
   lightRadius = 3.0;
   lightColor  = "1.0 1.0 1";
};


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

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

   //gui stuff
   uiName = "Score Reseter";
   iconName = "base/client/ui/ItemIcons/golfscorereseter";
   doColorShift = true;
   colorShiftColor = "1.0 1.0 1 1.000";

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

//function Golfscorereseter::onUse(%this,%user)
//{
//   //mount the image in the right hand slot
//   %user.mountimage(%this.image, $RightHandSlot);
//}

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

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

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

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

   //casing = " ";
   doColorShift = true;
   colorShiftColor = "1.0 1.0 1 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 cldriverwandient 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.1;
   stateTransitionOnTimeout[0]   = "Ready";
   stateSequence[0]      = "ready";
   stateScript[0]         = "onActivate";
   stateSound[0]               = weaponSwitchSound;

   stateName[1]         = "Ready";
   stateTransitionOnTriggerDown[1]   = "Fire";
   stateEmitter[1]         = GolfscorereseterWandEmitter;
   stateEmitterTime[1]      = 1000;
   stateScript[1]         = "onReady";
   stateAllowImageChange[1]   = true;
   
   stateName[2]                    = "Charge";
   stateTransitionOnTimeout[2]   = "Armed";
   stateTimeoutValue[2]            = 1;
   stateWaitForTimeout[2]      = false;
   stateTransitionOnTriggerUp[2]   = "AbortCharge";
   stateScript[2]                  = "onCharge";
   stateAllowImageChange[2]        = false;
   
   stateName[3]         = "AbortCharge";
   stateTransitionOnTimeout[3]   = "Ready";
   stateTimeoutValue[3]      = 0.3;
   stateWaitForTimeout[3]      = true;
   stateScript[3]         = "onAbortCharge";
   stateAllowImageChange[3]   = false;

   stateName[4]         = "Armed";
   stateTransitionOnTriggerUp[4]   = "Fire";
   stateEmitter[4]         = GolfscorereseterWandEmitterB;
   stateEmitterTime[4]      = 0.2;
   stateAllowImageChange[4]   = false;

   stateName[5]         = "Fire";
   stateTransitionOnTimeout[5]   = "Ready";
   stateTimeoutValue[5]      = 0.15;
   stateFire[5]         = true;
   stateSequence[5]      = "fire";
   stateScript[5]         = "onFire";
   stateWaitForTimeout[5]      = true;
   stateEmitter[5]         = GolfscorereseterWandEmitter;
   stateEmitterTime[5]      = 1;
   stateAllowImageChange[5]   = false;
   stateSound[5]            = GolfscorereseterFireSound;
};

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

function GolfscorereseterImage::onFire(%this, %obj, %slot)
{
   %nrg = %obj.getEnergyLevel();
   if(0 <= %nrg) {
   %obj.setEnergyLevel(%nrg - 100);
   commandtoClient(%obj.client,'bottomprint',"\c1Strokes: " @ mFloor(%obj.getEnergyLevel()) @ "/" @ %obj.getDatablock().maxenergy);   
   }
   %obj.playthread(2, armattack);
   Parent::onFire(%this, %obj, %slot);
}

I dunno what's wrong, hmm, i wonder if anybody else knows, sorry dude

Try it then post console, are you sure the shape is in the correct directory?

Correct directory as in add-ons/shapes right?

Correct directory as in add-ons/shapes right?
Yes, and also look in the console after you start a game to see if it picks up the problem. It's probably just one faulty line somewhere.