Author Topic: New problem syntax errors in script wont go away  (Read 716 times)

I have yet again forgeted up a script
Code: [Select]
Loading Add-On: Weapon_Chainsword
Add-Ons/Weapon_Chainsword/server.cs Line: 243 - Syntax error.
>>> Some error context, with ## on sides of error halt:
^stateAllowImageChange[5]        = false;

^stateWaitForTimeout[5]^^= true;

^stateSequence[5]                = "StopFire";

^stateScript[5]                  = "onStopFire";



};



function ChainswordImage::onPreFire(%this, %obj, %slot)

{

^%obj.playthread(2, armattack);

};##
##

function ChainswordImage::onStopFire(%this, %obj, %slot)

{^

^%obj.playthread(2, root);


};



function chainswordProjectile::Damage(%this, %obj, %col, %fade, %pos, %normal)

{

^if(%col.gettype() & $TypeMasks::PlayerObjectType && fileName(%col.dataBlock.shapeFile) $= "m.dts")
>>> Error report complete.

ADD-ON "Weapon_Chainsword" CONTAINS SYNTAX ERRORS
« Last Edit: July 30, 2010, 03:11:41 PM by Priad »

You need the hitboxes script to have executed.

« Last Edit: July 30, 2010, 03:15:00 PM by Priad »

You aren't using the right projectile name for the ::Damage.
The name of the projectile is BolterProjectile.
Code: [Select]
datablock ProjectileData(BolterProjectile)
{
   projectileShapeName = "./BolterBullet.dts";
   directDamage        = 25;
   directDamageType    = $DamageType::Bolter;
   radiusDamageType    = $DamageType::Bolter;

   brickExplosionRadius = 1;
   brickExplosionImpact = true;          //destroy a brick if we hit it directly?
   brickExplosionForce  = 25;
   brickExplosionMaxVolume = 3;          //max volume of bricks that we can destroy
   brickExplosionMaxVolumeFloating = 4;  //max volume of bricks that we can destroy if they aren't connected to the ground

   impactImpulse     = 400;
   verticalImpulse  = 400;
   explosion           = BolterExplosion;
   particleEmitter     = ""; //bulletTrailEmitter;

   muzzleVelocity      = 90;
   velInheritFactor    = 1;

   armingDelay         = 00;
   lifetime            = 4000;
   fadeDelay           = 3500;
   bounceElasticity    = 0.5;
   bounceFriction      = 0.20;
   isBallistic         = true;
   gravityMod = 0.2;

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

   uiName = "Bolter Bullet";
};

Then you use BolterRifleBullet. Just change it to BolterProjectile.
Code: [Select]
function BolterRiflebullet::Damage(%this, %obj, %col, %fade, %pos, %normal) //Should be BolterProjectile, not BolterRifleBullet
{
   if(%col.getClassName() $="Player" || %col.getClassName() $= "AIPlayer") //If they're a player of some kind
   {
      if(%col.getClassName() $= "AIPlayer")
      {
         %oldClient = %col.client; //Just in case the bot already had a client
         %col.client = BotConnection;
         %hitBoxList = getHitbox(%obj, %col, %pos);
         %col.client = %oldClient;
      }
      else
      {
         %hitBoxList = getHitbox(%obj, %col, %pos);
      }
      if(strReplace(%hitBoxList, "headskin", "BAM") $= %hitBoxList)
      {
         parent::Damage(%this, %obj, %col, %fade, %pos, %normal);
      }
      else
      {
         %obj.client.centerPrint("\c6Nice Shot!",3);
         %obj.client.play2D(rewardSound);
         %col.damage(%obj, %pos, (125 * getWord(%obj.getScale(),2)), $DamageType::BolterRiflehead);
      }
   }
   else
   {
      parent::Damage(%this, %obj, %col, %fade, %pos, %normal);
   }
}

Edit:The Add Damage type isn't working because you don't have the CI, Most likely, for it.
« Last Edit: July 29, 2010, 12:17:44 PM by Munkey »

« Last Edit: July 30, 2010, 03:15:24 PM by Priad »

functions dont get a semicolon (;) afer the last closing brace

change:
function ChainswordImage::onPreFire(%this, %obj, %slot)
{
     %obj.playthread(2, armattack);
};

to:
function ChainswordImage::onPreFire(%this, %obj, %slot)
{
     %obj.playthread(2, armattack);
}

functions dont get a semicolon (;) afer the last closing brace

change:
function ChainswordImage::onPreFire(%this, %obj, %slot)
{
     %obj.playthread(2, armattack);
};

to:
function ChainswordImage::onPreFire(%this, %obj, %slot)
{
     %obj.playthread(2, armattack);
}

Thanks a ton it works perfectly! :D

Functions end in }
Packages, and objects/datablocks end in };

datablock PlayerData(blahblah)
{

};