Author Topic: Damage not working  (Read 2280 times)

Theres ment to be automatic damage but my weapon is not damaging people, its only one of my weapons and im not getting any errors. I've checked the damage isnt set to 0 and its not its on 30, i've checked it to other weapons that do work and i cant see anything wrong,

What it could be?

Post the cs. Maybe you've just done something stupid to the file.

Its not even working anymore... Its just killed itself, On second it was working, then it stopped and consol just says: Syntax Error It dosent even say where.

Code: [Select]
//DarkWand.cs By MrPickle, Model by GMP


datablock AudioProfile(DarkWandExplosionSound)
{
filename ="./sounds/jeepExplosion.wav";
description = AudioClose3d;
preload =true;
};
datablock AudioProfile(DarkWandFireSound)
{
filename ="./sounds/rocketFire.wav";
description = AudioClosest3d;
preload = true;
};
datablock ParticleData(DarkWandTrailParticle)
{
dragCoefficient = 1;
gravityCoefficient = 0.5;
inheritedVelFactor = 0;
constantAcceleration = 2;
lifetimeMS = 150;
lifetimeVarianceMS = 100;
textureName ="base/data/particles/SparkSpin.png";
colors[0] ="1 1 5 1";
colors[1] ="1 1 5 1";
sizes[0] = 0.7;
sizes[1] = 0.7;
};
datablock ParticleEmitterData(DarkWandTrailEmitter)
{
ejectionPeriodMS = 2;
periodVarianceMS = 0;
ejectionVelocity = 0;
velocityVariance = 0;
ejectionOffset = 0;
thetaMin = 0.0;
thetaMax = 90.0;
particles = DarkWandTrailParticle;
};
datablock ParticleData(DarkWandExplosionParticle)
{
dragCoefficient = 0;
gravityCoefficient = 2.0;
inheritedVelFactor = 0.0;
constantAcceleration = 0.0;
lifetimeMS = 1000;
lifetimeVarianceMS = 400;
textureName ="base/data/particles/SparkSpin.png";
colors[0] ="1 1 5 1";
colors[1] ="1 1 5 1";
sizes[0] = 1.5;
sizes[1] = 1.5;
};
datablock ParticleEmitterData(DarkWandExplosionEmitter)
{
ejectionPeriodMS = 3;
periodVarianceMS = 0;
ejectionVelocity = 10;
velocityVariance = 1.0;
ejectionOffset = 3.0;
thetaMin = 89;
thetaMax = 90;
phiReferenceVel  = 0;
phiVariance = 360;
overrideAdvance = false;
particles = "DarkWandExplosionParticle";
};
datablock ExplosionData(DarkWandExplosion)
{
//explosionShape = "";
soundProfile = DarkWandExplosionSound;
lifeTimeMS = 150;
particleEmitter = DarkWandExplosionEmitter;
particleDensity = 10;
particleRadius = 0.2;
faceViewer   = true;
explosionScale = "10 10 10";
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 = 0;
lightStartColor = "";
lightEndColor = "";
};
AddDamageType();
datablock ProjectileData(DarkWandProjectile)
{
//projectileShapeName = "";
directDamage   = 30;
directDamageType = $DamageType::DarkWandDirect;
radiusDamageType = $DamageType::DarkWandRadius;
impactImpulse = 1000;
verticalImpulse = 1000;
explosion   = DarkWandExplosion;
particleEmitter   = DarkWandTrailEmitter;
brickExplosionRadius = 3;
brickExplosionImpact = false; //destroy a brick if we hit it directly?
brickExplosionForce  = 30;
brickExplosionMaxVolume = 0; //max volume of bricks that we can destroy
brickExplosionMaxVolumeFloating = 0;  //max volume of bricks that we can destroy if they aren't connected to the ground (should always be >= brickExplosionMaxVolume)
muzzleVelocity = 65;
velInheritFactor = 1.0;
armingDelay = 00;
lifetime = 4000;
fadeDelay   = 3500;
bounceElasticity = 0.5;
bounceFriction = 0.20;
isBallistic = false;
gravityMod = 0.0;
};
datablock ItemData(DarkWandItem)
{
category ="weapon";
className= "Weapon";
shapeFile ="./shapes/wand.dts";
mass = 1;
density = 0.2;
elasticity = 0;
friction = 0.6;
emap = true;
uiName = "Dark Wand";
iconName = "./ItemIcons/Wand";
image = DarkWandImage;
canDrop = true;
};
datablock ShapeBaseImageData(DarkWandImage)
{
// Basic Item properties
shapeFile = "./shapes/wand.dts";
emap = true;
// Specify mount point & offset for 3rd person, and eye offset
// for first person rendering.
mountPoint = 0;
offset = " 0.0 0.0 0.0";
//eyeOffset = 0; //"0.7 1.2 -0.5";
// 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 = DarkWand;
ammo = " ";
projectile = DarkWandProjectile;
projectileType = Projectile;
//melee particles shoot from eye node for consistancy
melee = false;
//raise your arm up or not
armReady = true;
doColorShift = false;
colorShiftColor = DarkWandItem.colorShiftColor;//"0.400 0.196 0 1.000";
//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.5;
stateTransitionOnTimeout[0]       = "Ready";

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

stateName[2] = "PreFire";
stateScript[2]                  = "onPreFire";
stateAllowImageChange[2]        = false;
stateTimeoutValue[2]            = 0.5;
stateTransitionOnTimeout[2]     = "Fire";

stateName[3]                    = "Fire";
stateTransitionOnTimeout[3]     = "CheckFire";
stateTimeoutValue[3]            = 0.7;
stateFire[3]                    = true;
stateAllowImageChange[3]        = false;
stateSequence[3]                = "Fire";
stateScript[3]                  = "onFire";
stateWaitForTimeout[3] = true;
//stateTransitionOnTriggerUp[3] = "StopFire";

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 darkwandImage::onFire(%this, %obj, %slot)
{
//messageAll( 'MsgClient', 'sword prefired!!!');
//Parent::onFire(%this, %obj, %slot);
%obj.playthread(2, armattack);
}
function darkwandImage::onStopFire(%this, %obj, %slot)
{
%obj.playthread(2, root);
//messageAll( 'MsgClient', 'stopfire');
}
function darkwandProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
if(%obj.client.minigame == %col.client.minigame)

{
%random = GetRandom(0,12);
switch(%random)
 {
case 1:
%col.hidenode(Larm);
case 2:
%col.hidenode(Rarm);
case 3:
%col.hidenode(LLeg);
case 4:
%col.hidenode(RLeg);
case 5:
%col.hidenode(chest);
case 6:
%col.hidenode(hat);
case 7:
%col.hidenode(pants);
case 8:
%col.hidenode(torso);
case 9:
%col.hidenode(Lhand);
case 10:
%col.hidenode(RHand);
case 11:
%col.hidenode(Pack);
case 12:
%col.hidenode(SecondPack);
  }
 }
}

Try adding Parent::onCollision(%this,%obj,%col,%fade,%pos,%normal); to the end of the collision script.

My guess is that your edited function is overwriting the part which would normally have the damage functions in.


Try adding Parent::onCollision(%this,%obj,%col,%fade,%pos,%normal); to the end of the collision script.

My guess is that your edited function is overwriting the part which would normally have the damage functions in.

I cant try its saying syntax error input and not telling me where.

Two things:

"AddDamageType();" - shouldn't that have arguments like "AddDamageType("Gun",   '<bitmap:add-ons/ci/gun> %1',    '%2 <bitmap:add-ons/ci/gun> %1',0.5,1);"?

%col.hidenode(SecondPack); may cause errors - try %col.hidenode("SecondPack");, although I am uncertain whether such a node even exists on the model.

...
%col.hidenode(SecondPack); may cause errors - try %col.hidenode("SecondPack");, although I am uncertain whether such a node even exists on the model.
He put Pack and Secondpack, which aren't nodes, those are names for what the pack nodes are.
%col.hidenode($secondPack[%col.client.secondpack]);
%col.hidenode($Pack[%col.client.pack]);


Code: [Select]
switch(%random)
{
case 1:
%col.hidenode(Larm);
case 2:
%col.hidenode(Rarm);
case 3:
%col.hidenode(LLeg);
case 4:
%col.hidenode(RLeg);
case 5:
%col.hidenode(chest);
case 6:
%col.hidenode(hat);
case 7:
%col.hidenode(pants);
case 8:
%col.hidenode(torso);
case 9:
%col.hidenode(Lhand);
case 10:
%col.hidenode(RHand);
case 11:
%col.hidenode(Pack);
case 12:
%col.hidenode(SecondPack);
  }
Code: [Select]
switch(%random)
{
case 1:
%this.unhidenode($LArm[%client.larm]);
case 2:
%this.unhidenode($RArm[%client.rarm]);
case 3:
if(%client.hip == 0) {
  %this.unhidenode($LLeg[%client.lleg]);
  %this.unhidenode($RLeg[%client.rleg]);
}
else {
  %this.unhidenode(skirtTrimLeft);
  %this.unhidenode(skirtTrimRight);
}
case 4:
if(%client.hip == 0) {
  %this.unhidenode($LLeg[%client.lleg]);
  %this.unhidenode($RLeg[%client.rleg]);
}
else {
  %this.unhidenode(skirtTrimLeft);
  %this.unhidenode(skirtTrimRight);
}
case 5:
%this.unhidenode($chest[%client.chest]);
case 6:
%this.unhidenode($hat[%client.hat]);
case 7:
%this.unhidenode($hip[%client.hip]);
if(%client.hip == 0) {
  %this.unhidenode($LLeg[%client.lleg]);
  %this.unhidenode($RLeg[%client.rleg]);
}
else {
  %this.unhidenode(skirtTrimLeft);
  %this.unhidenode(skirtTrimRight);
}
case 8:
if(%client.hat == 1 && %client.accent == 1)
  %this.unhidenode($accent[4]);
else {
  if($accent[%client.accent] !$= "none")
    %this.unhidenode($accent[%client.accent]);
}
case 9:
%this.unhidenode($LHand[%client.lhand]);
case 10:
%this.unhidenode($RHand[%client.rhand]);
case 11:
if($pack[%client.pack] !$= "none")
  %this.unhidenode($pack[%client.pack]);
case 12:
if($secondpack[%client.secondpack] !$= "none")
  %this.unhidenode($secondPack[%client.secondpack]);
}
Change the top code with the bottom, the bottom is untested and I don't feel like checking because I keep getting IM'ed

The node hiding bit works apart from pants and hat.