Author Topic: Weapon "Damage Type" error  (Read 1636 times)

Full code. In between the ##'s is the error.
Code: [Select]
datablock AudioProfile(Ar2FireSound)
{
   filename    = "./ar2_fire.wav";
   description = AudioClose3d;
   preload = true;
};

datablock AudioProfile(Ar2ReloadSound)
{
filename = "ar2_reload.wav";
description = AudioClose3d;
preload = true;
}

AddDamageType(##"## Ar2",   '<bitmap:add-ons/Weapon_Ar2/CI_Ar2> %1',    '%2 <bitmap:add-ons/Weapon_Ar2/CI_Ar2> %1',0.2,1);
datablock ProjectileData(Ar2Projectile)
{
   directDamage        = 12;
   directDamageType    = $DamageType::Ar2;
   radiusDamageType    = $DamageType::Ar2;

   brickExplosionRadius = 0;
   brickExplosionImpact = true;
   brickExplosionForce  = 10;
   brickExplosionMaxVolume = 1;
   brickExplosionMaxVolumeFloating = 2;

   impactImpulse     = 100;
   verticalImpulse     = 200;
   explosion           = gunExplosion;

   muzzleVelocity      = 120;
   velInheritFactor    = 1;

   armingDelay         = 0;
   lifetime            = 4000;
   fadeDelay           = 3500;
   bounceElasticity    = 0.5;
   bounceFriction      = 0.20;
   isBallistic         = false;
   gravityMod = 0.1;

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

datablock ItemData(Ar2Item)
{
category = "Weapon";
className = "Weapon";

shapeFile = "./Blocko-AR2.dts";
rotate = false;
mass = 1;
density = 0.2;
elasticity = 0.2;
friction = 0.6;
emap = true;

//gui stuff
uiName = "AR2 (Pulse Rifle)";

canDrop = true;

maxAmmo = 30;
canReload = 1;
};

datablock ShapeBaseImageData(Ar2Image)
{
   shapeFile = "./Blocko-AR2.dts";
   emap = true;

   offset = "0 0 0";
   eyeOffset = 0; //"0.7 1.2 -0.5";
   rotation = eulerToMatrix( "0 0 0" );

   className = "WeaponImage";

   item = Ar2Item;
   ammo = " ";
   projectile = Ar2Projectile;
   projectileType = Projectile;

   //melee particles shoot from eye node for consistancy
   melee = false;
   //raise your arm up or not
   armReady = true;

stateName[0]                     = "Activate";
stateTimeoutValue[0]             = 0.05;
stateTransitionOnTimeout[0]       = "Ready";
stateSound[0] = weaponSwitchSound;

stateName[1]                     = "Ready";
stateTransitionOnNoAmmo[1]       = "Reload";
stateTransitionOnTriggerDown[1]  = "Fire";
stateAllowImageChange[1]         = true;

stateName[2]                    = "Fire";
stateTransitionOnTimeout[2]     = "Delay";
stateTimeoutValue[2]            = 0.01;
stateFire[2]                    = true;
stateAllowImageChange[2]        = false;
stateSequence[2]                = "Fire";
stateScript[2]                  = "onFire";
stateEjectShell[2]        = true;
stateEmitter[2] = gunFlashEmitter;
stateEmitterTime[2] = 0.05;
stateEmitterNode[2] = "muzzleNode";
stateWaitForTimeout[2] = true;
stateSound[2] = Ar2FireSound;

stateName[3] = "Delay";
stateTransitionOnTimeout[3]     = "Reload";
stateTimeoutValue[3]            = 2;
stateEmitter[3] = gunSmokeEmitter;
stateEmitterTime[3] = 0.03;
stateEmitterNode[3] = "muzzleNode";

stateName[4] = "LoadCheck";
stateTransitionOnAmmo[4] = "Ready";
stateTransitionOnNoAmmo[4] = "Reload";

stateName[5] = "Reload";
stateTimeoutValue[5] = 0.5;
stateScript[5] = "onReloadStart";
stateTransitionOnTimeout[5] = "Reloaded";
stateWaitForTimeout[5] = true;
stateSound[5] = Ar2ReloadSound;

stateName[6] = "Reloaded";
stateTimeoutValue[6] = 0.01;
stateScript[6] = "onReloaded";
stateTransitionOnTimeout[6] = "Ready";
};

function Ar2Image::onFire(%this,%obj,%slot)
{
%projectile = Ar2Projectile;
%spread = 0.00100;
%shellcount = 1;

%obj.playThread(2, Fire);
%obj.toolAmmo[%obj.currTool]--;

for(%shell=0; %shell<%shellcount; %shell++)
{
%vector = %obj.getMuzzleVector(%slot);
%objectVelocity = %obj.getVelocity();
%vector1 = VectorScale(%vector, %projectile.muzzleVelocity);
%vector2 = VectorScale(%objectVelocity, %projectile.velInheritFactor);
%velocity = VectorAdd(%vector1,%vector2);
%x = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%y = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%z = (getRandom() - 0.5) * 10 * 3.1415926 * %spread;
%mat = MatrixCreateFromEuler(%x @ " " @ %y @ " " @ %z);
%velocity = MatrixMulVector(%mat, %velocity);

%p = new (%this.projectileType)()
{
dataBlock = %projectile;
initialVelocity = %velocity;
initialPosition = %obj.getMuzzlePoint(%slot);
sourceObject = %obj;
sourceSlot = %slot;
client = %obj.client;
};
MissionCleanup.add(%p);
}
return %p;
}

function Ar2Image::onReloadStart(%this,%obj,%slot)
{
%obj.toolAmmo[%obj.currTool] = 0;
%obj.playThread(2, shiftTo);
}

function Ar2Image::onReloaded(%this,%obj,%slot)
{
%obj.toolAmmo[%obj.currTool] = %this.item.maxAmmo;
%obj.setImageAmmo(%slot,1);
}
« Last Edit: June 18, 2010, 04:51:16 PM by Glitchman365 »

Yeah your source code snippet needs to be a bit more specific. (you might be using illegal characters or something)

EDIT: I can't see any problems from the source code you've given. Maybe you could give a little more code? Torque's Syntax Error locator is usually off.
« Last Edit: June 18, 2010, 05:43:16 AM by Destiny/Zack0Wack0 »

You have to change the text "<WEAPON>" for something else, the angle brackets < > are invalid when used like that.

You have to change the text "<WEAPON>" for something else, the angle brackets < > are invalid when used like that.
I thought he was just doing that to cover up his weapon name.

It looks like it's the ones from those "example retail weapon scripts" posted a while back.

-snip, uneeded post-
« Last Edit: June 18, 2010, 04:50:19 PM by Glitchman365 »

Okay look. None of us really care what you're making or are going to steal the idea. If you don't give us the actual script we're not going to be able to help you. The syntax error appears to be caused by the weapon's name which likely includes a symbol that torquescript can't process correctly.

Fine. I'm making an Ar2, I just don't want a bunch of noobs running in here and saying "OMG UR MAKIGN A AR@ I WANTED THAT SO MUCH".

Full script at the top now.
I have a server.cs which is only "exec(Weapon_Ar2.cs);" as well as a description and namecheck.

You forgot the ";" at the end of:
Code: [Select]
datablock AudioProfile(Ar2ReloadSound)
{
   filename   = "ar2_reload.wav";
   description = AudioClose3d;
   preload      = true;
} <<need a ; here

The filename for Ar2ReloadSound should be "./ar2_reload.wav" so that it loads correctly; otherwise it's looking in your base Blockland folder instead of where your mod is located.

I know whats wrong... I think.
But I dont know how to say it, wait a sec, ill post what the code should look like...