Blockland Forums > Modification Help
New problem syntax errors in script wont go away
Priad:
I have yet again forgeted up a script
--- Code: ---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
--- End code ---
Amade:
You need the hitboxes script to have executed.
Priad:
new problem
Munkey:
You aren't using the right projectile name for the ::Damage.
The name of the projectile is BolterProjectile.
--- Code: ---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";
};
--- End code ---
Then you use BolterRifleBullet. Just change it to BolterProjectile.
--- Code: ---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);
}
}
--- End code ---
Edit:The Add Damage type isn't working because you don't have the CI, Most likely, for it.
Priad:
new problem