Projectile Probs
by Adam Zeid · in Torque Game Engine · 10/22/2001 (8:54 pm) · 9 replies
Ok, I've created another file for a new weapon called blaster.cs, it's almost a direct copy of the rifle.cs, the only things I changed were the names of the projectile, ammo etc. For instance "RifleSmokeParticle" became "BlasterSmokeParticle".
They both use the same projectile, shell casing, and smoke files, the blaster and rifle both eject spent shells and take up ammo, etc... Rifle will fire a projectile and smoke when fired, Blaster will not fire anything, I swapped the projectile.dts with the chaingun ammo box in T2, it worked for the rifle.cs but same problem with blaster.cs.
I swapped our blaster model with the rifle model and it worked on "rifle.cs" but not on "blaster.cs", The Rifle won't work with the blaster.cs
Any ideas?
EDIT: When I mean won't work, I mean the projectile and smoke will not show up.
They both use the same projectile, shell casing, and smoke files, the blaster and rifle both eject spent shells and take up ammo, etc... Rifle will fire a projectile and smoke when fired, Blaster will not fire anything, I swapped the projectile.dts with the chaingun ammo box in T2, it worked for the rifle.cs but same problem with blaster.cs.
I swapped our blaster model with the rifle model and it worked on "rifle.cs" but not on "blaster.cs", The Rifle won't work with the blaster.cs
Any ideas?
EDIT: When I mean won't work, I mean the projectile and smoke will not show up.
#2
10/22/2001 (9:40 pm)
It's not the blaster from T2, the script isn't either. The script is a copy of rifle.cs, with the renames, and the model is one we designed, the model we made can replace the default rifle and I've replaced the default rifle model with it and it works like the rifle, shoots projectiles/smoke etc....
#3
One thing to check... pop up the console and make sure the script was run, and that there were no errors.
10/22/2001 (9:50 pm)
You are execing the blaster script from game.cs are you? I basically just did the same thing, created a new weapon (the crossbow) off the rifle.cs file and it works great :)One thing to check... pop up the console and make sure the script was run, and that there were no errors.
#4
Yes, otherwise I wouldn't be able to have it in game, there are no console errors.... Haven't had a chance to get the update yet...
Loads up just fine, but won't shoot projectiles/smoke, it even ejects the shell.
datablock ParticleData(BlasterSmokeParticle)
{
dragCoeffiecient = 0.0;
gravityCoefficient = -0.2; // rises slowly
inheritedVelFactor = 0.00;
lifetimeMS = 700; // lasts 0.7 second
lifetimeVarianceMS = 150; // ...more or less
textureName = "~/data/shapes/rifle/smokeParticle";
//Skipped rest, not needed to show
datablock ParticleEmitterData(BlasterSmokeEmitter)
{
ejectionPeriodMS = 10;
periodVarianceMS = 5;
ejectionVelocity = 0.25;
velocityVariance = 0.10;
thetaMin = 0.0;
thetaMax = 90.0;
particles = BlasterSmokeParticle;
};
datablock ParticleData(BlasterExplosionParticle)
{
dragCoefficient = 2;
gravityCoefficient = 0.2;
inheritedVelFactor = 0.2;
constantAcceleration = 0.0;
lifetimeMS = 850;
lifetimeVarianceMS = 150;
textureName = "~/data/shapes/rifle/smokeParticle";
colors[0] = "0.76 0.86 0.46 1.0";
colors[1] = "0.56 0.16 0.26 0.0";
sizes[0] = 0.9;
sizes[1] = 1.7;
};
datablock ParticleEmitterData(BlasterExplosionEmitter)
{
ejectionPeriodMS = 7;
periodVarianceMS = 0;
ejectionVelocity = 2;
velocityVariance = 1.0;
ejectionOffset = 0.0;
thetaMin = 0;
thetaMax = 60;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
particles = "BlasterExplosionParticle";
};
datablock ExplosionData(BlasterExplosion)
{
//explosionShape = "~/data/shapes/rifle/explosion.dts";
particleEmitter = BlasterExplosionEmitter;
//skipped rest not needed to show...
datablock ProjectileData(BlasterProjectile)
{
projectileShapeName = "~/data/shapes/rifle/projectile.dts";
directDamage = 20;
explosion = BlasterExplosion;
particleEmitter = BlasterSmokeEmitter;
//ditto
// Projectile && Ammo.
item = Blaster;
ammo = BlasterAmmo;
projectile = BlasterProjectile;
projectileType = Projectile;
casing = BlasterShell;
The rest stays the same, see anything wrong with those lines? I did a WinMerge comparison and looked over both files, and had 2 other people look over them, they said it looked right.
10/22/2001 (10:31 pm)
Edit: And yes it's in same Directory as rifle.cs so paths would be right.Yes, otherwise I wouldn't be able to have it in game, there are no console errors.... Haven't had a chance to get the update yet...
Loads up just fine, but won't shoot projectiles/smoke, it even ejects the shell.
datablock ParticleData(BlasterSmokeParticle)
{
dragCoeffiecient = 0.0;
gravityCoefficient = -0.2; // rises slowly
inheritedVelFactor = 0.00;
lifetimeMS = 700; // lasts 0.7 second
lifetimeVarianceMS = 150; // ...more or less
textureName = "~/data/shapes/rifle/smokeParticle";
//Skipped rest, not needed to show
datablock ParticleEmitterData(BlasterSmokeEmitter)
{
ejectionPeriodMS = 10;
periodVarianceMS = 5;
ejectionVelocity = 0.25;
velocityVariance = 0.10;
thetaMin = 0.0;
thetaMax = 90.0;
particles = BlasterSmokeParticle;
};
datablock ParticleData(BlasterExplosionParticle)
{
dragCoefficient = 2;
gravityCoefficient = 0.2;
inheritedVelFactor = 0.2;
constantAcceleration = 0.0;
lifetimeMS = 850;
lifetimeVarianceMS = 150;
textureName = "~/data/shapes/rifle/smokeParticle";
colors[0] = "0.76 0.86 0.46 1.0";
colors[1] = "0.56 0.16 0.26 0.0";
sizes[0] = 0.9;
sizes[1] = 1.7;
};
datablock ParticleEmitterData(BlasterExplosionEmitter)
{
ejectionPeriodMS = 7;
periodVarianceMS = 0;
ejectionVelocity = 2;
velocityVariance = 1.0;
ejectionOffset = 0.0;
thetaMin = 0;
thetaMax = 60;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvances = false;
particles = "BlasterExplosionParticle";
};
datablock ExplosionData(BlasterExplosion)
{
//explosionShape = "~/data/shapes/rifle/explosion.dts";
particleEmitter = BlasterExplosionEmitter;
//skipped rest not needed to show...
datablock ProjectileData(BlasterProjectile)
{
projectileShapeName = "~/data/shapes/rifle/projectile.dts";
directDamage = 20;
explosion = BlasterExplosion;
particleEmitter = BlasterSmokeEmitter;
//ditto
// Projectile && Ammo.
item = Blaster;
ammo = BlasterAmmo;
projectile = BlasterProjectile;
projectileType = Projectile;
casing = BlasterShell;
The rest stays the same, see anything wrong with those lines? I did a WinMerge comparison and looked over both files, and had 2 other people look over them, they said it looked right.
#5
If you do not do this then the weapon cannot be picked up by the player.
Look for this in player.cs
// Allowable Inventory Items
maxInv[BulletAmmo] = 20;
maxInv[HealthKit] = 1;
maxInv[ThompsonAmmo] = 100;
maxInv[Thompson] = 1;
maxInv[BazookaAmmo] = 100;
maxInv[Bazooka] = 1;
maxInv[FlamethrowerAmmo] = 300;
maxInv[Flamethrower] = 1;
maxInv[smokegrenadeAmmo] = 6;
maxInv[smokegrenade] = 1;
As you can see I have 4 different weapons and they are all working.
Also add them to the config to bind them to keys so you can select them, this would look like this:
MoveMap.bindCmd(keyboard, "1", "commandToServer(\'use\',\"thompson\");", "");
MoveMap.bindCmd(keyboard, "2", "commandToServer(\'use\',\"bazooka\");", "");
MoveMap.bindCmd(keyboard, "3", "commandToServer(\'use\',\"flamethrower\");", "");
MoveMap.bindCmd(keyboard, "4", "commandToServer(\'use\',\"smokegrenade\");", "");
Its in fps/client/config.cs
// Clocks out
10/23/2001 (2:04 am)
Did you add the new weapon to the player.cs inventory list.If you do not do this then the weapon cannot be picked up by the player.
Look for this in player.cs
// Allowable Inventory Items
maxInv[BulletAmmo] = 20;
maxInv[HealthKit] = 1;
maxInv[ThompsonAmmo] = 100;
maxInv[Thompson] = 1;
maxInv[BazookaAmmo] = 100;
maxInv[Bazooka] = 1;
maxInv[FlamethrowerAmmo] = 300;
maxInv[Flamethrower] = 1;
maxInv[smokegrenadeAmmo] = 6;
maxInv[smokegrenade] = 1;
As you can see I have 4 different weapons and they are all working.
Also add them to the config to bind them to keys so you can select them, this would look like this:
MoveMap.bindCmd(keyboard, "1", "commandToServer(\'use\',\"thompson\");", "");
MoveMap.bindCmd(keyboard, "2", "commandToServer(\'use\',\"bazooka\");", "");
MoveMap.bindCmd(keyboard, "3", "commandToServer(\'use\',\"flamethrower\");", "");
MoveMap.bindCmd(keyboard, "4", "commandToServer(\'use\',\"smokegrenade\");", "");
Its in fps/client/config.cs
// Clocks out
#6
10/23/2001 (8:48 am)
Umm yes, Read the posts. I stated it was IN GAME, but there just isn't any projectile coming from it :(
#7
$GameBase::boundingBox = true;
This will draw a bounding box around every game base object, and it will also draw little pink cubes at the muzzle, mount and eject points of any mounted images.
10/23/2001 (9:19 am)
If it appears to be working, maybe the weapons muzzle point is messed up. With a debug version of the exe... load up the mission, grab the weapon, then on the console type:$GameBase::boundingBox = true;
This will draw a bounding box around every game base object, and it will also draw little pink cubes at the muzzle, mount and eject points of any mounted images.
#8
10/23/2001 (9:46 am)
That's a neat little function, Yes it has pink boxes near the hands and at the muzzle, I can replace your weapon.dts with ours and it shoots just like the rifle, but when tried with it's own .cs file, it shoots but no particle or smoke image appears, it's very umm weird.
#9
10/23/2001 (2:38 pm)
I don't think it has anything to do with the dts shape. The particles are all controlled from the image state engine, only the muzzle and eject nodes are optained from the shape (and even those don't really have to be there). There something going on with the scripts, particle datablock definitions, or maybe the weapon state engine. Why don't you zip it up and email it me, I'll take a quick look.
Associate Anthony Rosenbaum
SniperProjectileData and GenadeProjectileData which I think were subobjects from the ProjectileData Class that we own, I'm not sure about the dts file, but their could be an alternative muzzlepoint point they used for the blaster,
Anthony