Author Topic: Melee Weapon Animating in First Person.  (Read 2627 times)

I'm making a entrepreneur  Staff Melee Weapon and whenever I activate to slice something, it shows no animation of it slashing in first person but you can see it in third person.

Also when I walk around it doesn't show the animation of it moving.
« Last Edit: September 08, 2011, 07:21:31 PM by Trogtor »

You have to fix the eye offset.

The sword has some weird offset, just change it to 0 0 0


This didn't work. It didn't show up in the weapons list.

This didn't work. It didn't show up in the weapons list.
That's not all that you changed.

You obviously did it wrong or changed something else.

That's not all that you changed.

You obviously did it wrong or changed something else.

This is from the script in the sword

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

Before I changed it, it was the same thing.
The sword works fine.

It has to be something else.

This is from the script in the sword

Before I changed it, it was the same thing.
The sword works fine.

It has to be something else.
The sword works fine, but that offset is designed for the sword only.

Listen to me. Change it to "0 0 0";

that won't break it.

Edit: One of the most popular melee weapons of all time, butterfly knife:
Code: [Select]
datablock ShapeBaseImageData(butterflyknifeImage)
{
   // Basic Item properties
   shapeFile = "./bknife2.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";

Edit2: TF2 Ubersaw, as well:
Code: [Select]
datablock ShapeBaseImageData(tf2UbersawImage)
{
   // Basic Item properties
   shapeFile = "./ubersaw.dts";
   emap = true;

   // Specify mount point & offset for 3rd person, and eye offset
   // for first person rendering.
   mountPoint = 0;
   offset = "0.05 0.05 0.1";
   rotation = eulerToMatrix("30 0 0");
   eyeOffset = "0";
« Last Edit: September 08, 2011, 08:27:10 PM by TheKhoz »

Its still not working.

Can you spot what I did wrong?

Quote
//entrepreneur Staff.cs
datablock AudioProfile(entrepreneur StaffDrawSound)
{
   filename    = "./entrepreneur StaffDraw.wav";
   description = AudioClosest3d;
   preload = true;
};
datablock AudioProfile(entrepreneur StaffHitSound)
{
   filename    = "./entrepreneur StaffHit.wav";
   description = AudioClosest3d;
   preload = true;
};


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

   uiName = "entrepreneur Staff Hit";
};

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

   soundProfile = entrepreneur StaffHitSound;

   particleEmitter = entrepreneur StaffExplosionEmitter;
   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("entrepreneur Staff",   '<bitmap:add-ons/Weapon_entrepreneur _Staff/CI_entrepreneur Staff> %1',    '%2 <bitmap:add-ons/Weapon_entrepreneur _Staff/CI_entrepreneur Staff> %1',0.75,1);
datablock ProjectileData(entrepreneur StaffProjectile)
{
   directDamage        = 35;
   directDamageType  = $DamageType::entrepreneur Staff;
   radiusDamageType  = $DamageType::entrepreneur Staff;
   explosion           = entrepreneur StaffExplosion;
   //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 = "entrepreneur Staff Slice";
};


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

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

   //gui stuff
   uiName = "entrepreneur  Staff";
   iconName = "./icon_entrepreneur Staff";
   doColorShift = true;
   colorShiftColor = "0.471 0.471 0.471 1.000";

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

////////////////
//weapon image//
////////////////
datablock ShapeBaseImageData(entrepreneur StaffImage)
{
   // Basic Item properties
   shapeFile = "./entrepreneur Staff.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.0 0.0 0.0";

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

   // Projectile && Ammo.
   item = entrepreneur StaffItem;
   ammo = " ";
   projectile = entrepreneur StaffProjectile;
   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]                    = entrepreneur StaffDrawSound;

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

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

Its still not working.

Can you spot what I did wrong?

What did your regular old 'offset' used to be?


0 0 0
Hrm.

Well, someone else had this problem, but they somehow fixed it. They didn't tell us how though.

There is no reason it should be happening

Hrm.

Well, someone else had this problem, but they somehow fixed it. They didn't tell us how though.

There is no reason it should be happening

When I modeled it in Milkshape I had one joint by where I hold the staff (As needed) and the other joint way down at the bottom of the staff. Is that why?

When I modeled it in Milkshape I had one joint by my hand and the other joint way down at the bottom of the staff. Is that why?
No, it's not your model.

Edit: Maybe just set your eyeOffset to '0'.

That worked for me...

Edit2: Pushbroom says:

Code: [Select]
datablock ShapeBaseImageData(pushBroomImage)
{
   // Basic Item properties
   shapeFile = "./pushBroom.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.15";

   // 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 = pushBroomItem;
   ammo = " ";
   projectile = pushBroomProjectile;
   projectileType = Projectile;

   //melee particles shoot from eye node for consistancy
   melee = true;
   doRetraction = false;
   //raise your arm up or not
   armReady = true;
« Last Edit: September 08, 2011, 08:38:23 PM by TheKhoz »

HOOLLLLYY CRAAAAPPP

I am one dumb mother forgeter.

I edited the scripts so it would open Weapon_entrepreneur _Staff.zip

Instead it was named Weapon_entrepreneur Staff.zip (I think I pressed ctl+z too many times because I accidentally moved an addon into another addons folder and must of changed the name back)

anyways, what you did worked. Thanks!