Author Topic: Melee Weapon Attacking Problems  (Read 2098 times)

Ok, i have finally gotten my texture problem worked out, and i am making a... special weapon, in looks and origin, no difference in the script you get from the up-to-date tutorial other than modified explosion radius and particle density. When i attack in 3rd person, the attack animation plays, but in 1st person, it stays static, not moving like the outside one does, anyone know whats wrong?

I think you need to add an animation, but I'm not sure.

Crap, i hope not, idk how

-edit

cant anyone help me with this??? i even looked through youtube and didnt see anything
« Last Edit: June 22, 2010, 12:43:39 AM by Midway Sentinel »

I've seen this with many weapons. People don't seem to mind.


In the weapon Image datablock:

Code: [Select]
   offset = "0 0 0";
   eyeOffset = 0;

make sure those are set to zero.


new question: how do i make to guy only swing the weapon once? he swings it 3 times or so.

and can anyone tell me whats wrong with my weapon script?

Quote
//GravityHammer.cs
datablock AudioProfile(GravityHammerDrawSound)
{
   filename    = "./swordDraw.wav";
   description = AudioClosest3d;
   preload = true;
};
datablock AudioProfile(GravityHammerHitSound)
{
   filename    = "./GravityHammerHit.wav";
   description = AudioClosest3d;
   preload = true;
};


//effects
datablock ParticleData(GravityHammerExplosionParticl e)
{
   dragCoefficient      = 2;
   gravityCoefficient   = 1.0;
   inheritedVelFactor   = 0.2;
   constantAcceleration = 0.0;
   spinRandomMin = -90;
   spinRandomMax = 90;
   lifetimeMS           = 500;
   lifetimeVarianceMS   = 300;
   textureName          = "base/data/particles/cloud";
   colors[0]     = "0.7 0.7 0.9 0.9";
   colors[1]     = "0.9 0.9 0.9 0.0";
   sizes[0]      = 0.10;
   sizes[1]      = 0.30;
};

datablock ParticleEmitterData(GravityHammerExplosionEmitter)
{
   ejectionPeriodMS = 7;
   periodVarianceMS = 0;
   ejectionVelocity = 8;
   velocityVariance = 1.0;
   ejectionOffset   = 0.0;
   thetaMin         = 0;
   thetaMax         = 60;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvance = false;
   particles = "GravityHammerExplosionParticl e";

   uiName = "GravityHammer Hit";
};

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

   soundProfile = GravityHammerHitSound;

   particleEmitter = GravityHammerExplosionEmitter;
   particleDensity = 100;
   particleRadius = 5;

   faceViewer     = true;
   explosionScale = "50 50 50";
   damageRadius = 7
   raduisDamage = 400

   shakeCamera = true;
   camShakeFreq = "20.0 22.0 20.0";
   camShakeAmp = "5.0 5.0 5.0";
   camShakeDuration = 0.5;
   camShakeRadius = 20.0;

   // Dynamic light
   lightStartRadius = 7;
   lightEndRadius = 0;
   lightStartColor = "00.0 0.2 0.6";
   lightEndColor = "0 0.2 0.6";
};


//projectile
AddDamageType("GravityHammer",   '<bitmap:add-ons/Weapon_GravityHammer/CI_GravityHammer> %1',    '%2 <bitmap:add-ons/Weapon_GravityHammer/CI_GravityHammer> %1',0.75,1);
datablock ProjectileData(GravityHammerProjectile)
{
   directDamage        = 500;
   directDamageType  = $DamageType::GravityHammer;
   radiusDamageType  = $DamageType::GravityHammer;
   explosion           = GravityHammerExplosion;
   //particleEmitter     = as;

   muzzleVelocity      = 200;
   velInheritFactor    = 1;

   armingDelay         = 0;
   lifetime            = 50;
   fadeDelay           = 70;
   bounceElasticity    = 0;
   bounceFriction      = 0;
   isBallistic         = false;
   gravityMod = 0.0;

   hasLight    = false;
   lightRadius = 5.0;
   lightColor  = "0 0 0.5";

   uiName = "GravityHammer Slice";
};


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

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

   //gui stuff
   uiName = "GravityHammer";
   iconName = "./icon_GravityHammer";
   doColorShift = true;
   colorShiftColor = "0.471 0.471 0.471 1.000";

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

////////////////
//weapon image//
////////////////
datablock ShapeBaseImageData(GravityHammerImage)
{
   // Basic Item properties
   shapeFile = "./GravityHammer.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 = GravityHammerItem;
   ammo = " ";
   projectile = GravityHammerProjectile;
   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.1;
   stateTransitionOnTimeout[0]      = "Ready";
   stateSound[0]                    = GravityHammerDrawSound;

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

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

« Last Edit: June 22, 2010, 01:22:12 PM by Midway Sentinel »