Gun script ( i bought it this time )
by Mark Junior · in Torque Game Engine · 01/15/2007 (7:58 am) · 26 replies
Hey, i bought the modern weapons pack this time and now ive copied the crossbow script to make a script for an AWP. ( well i used the m16.cs file as a resource which is made out of the crossbow script file that came with the soldier pack ) the code wont work please help me and tell me what errors there are ( nothing in console.log ) i need a pro to do this:
/-----------------------------------------------------------------------------
// Torque Game Engine
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Crossbow weapon. This file contains all the items related to this weapon
// including explosions, ammo, the item and the weapon item image.
// These objects rely on the item & inventory support system defined
// in item.cs and inventory.cs
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Sounds profiles
datablock AudioProfile(AwpReloadSound)
{
filename = "~/data/sound/crossbow_reload.ogg";
description = AudioClose3d;
preload = true;
};
datablock AudioProfile(AwpFireSound)
{
filename = "~/data/sound/crossbow_firing.ogg";
description = AudioClose3d;
preload = true;
};
datablock AudioProfile(AwpFireEmptySound)
{
filename = "~/data/sound/crossbow_firing_empty.ogg";
description = AudioClose3d;
preload = true;
};
datablock AudioProfile(AwpExplosionSound)
{
filename = "~/data/sound/crossbow_explosion.ogg";
description = AudioDefault3d;
preload = true;
};
//-----------------------------------------------------------------------------
// M16 ammo projectile splash
datablock ParticleData(AwpSplashMist)
{
dragCoefficient = 2.0;
gravityCoefficient = -0.05;
inheritedVelFactor = 0.0;
constantAcceleration = 0.0;
lifetimeMS = 400;
lifetimeVarianceMS = 100;
useInvAlpha = false;
spinRandomMin = -90.0;
spinRandomMax = 500.0;
textureName = "~/data/shapes/soldier/splash";
colors[0] = "0.7 0.8 1.0 1.0";
colors[1] = "0.7 0.8 1.0 0.5";
colors[2] = "0.7 0.8 1.0 0.0";
sizes[0] = 0.5;
sizes[1] = 0.5;
sizes[2] = 0.8;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(AwpSplashMistEmitter)
{
ejectionPeriodMS = 5;
periodVarianceMS = 0;
ejectionVelocity = 3.0;
velocityVariance = 2.0;
ejectionOffset = 0.0;
thetaMin = 85;
thetaMax = 85;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvance = false;
lifetimeMS = 250;
particles = "AwpSplashMist";
};
datablock ParticleData( AwpSplashParticle )
{
dragCoefficient = 1;
gravityCoefficient = 0.2;
inheritedVelFactor = 0.2;
constantAcceleration = -0.0;
lifetimeMS = 600;
lifetimeVarianceMS = 0;
colors[0] = "0.7 0.8 1.0 1.0";
colors[1] = "0.7 0.8 1.0 0.5";
colors[2] = "0.7 0.8 1.0 0.0";
sizes[0] = 0.5;
sizes[1] = 0.5;
sizes[2] = 0.5;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
/-----------------------------------------------------------------------------
// Torque Game Engine
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Crossbow weapon. This file contains all the items related to this weapon
// including explosions, ammo, the item and the weapon item image.
// These objects rely on the item & inventory support system defined
// in item.cs and inventory.cs
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Sounds profiles
datablock AudioProfile(AwpReloadSound)
{
filename = "~/data/sound/crossbow_reload.ogg";
description = AudioClose3d;
preload = true;
};
datablock AudioProfile(AwpFireSound)
{
filename = "~/data/sound/crossbow_firing.ogg";
description = AudioClose3d;
preload = true;
};
datablock AudioProfile(AwpFireEmptySound)
{
filename = "~/data/sound/crossbow_firing_empty.ogg";
description = AudioClose3d;
preload = true;
};
datablock AudioProfile(AwpExplosionSound)
{
filename = "~/data/sound/crossbow_explosion.ogg";
description = AudioDefault3d;
preload = true;
};
//-----------------------------------------------------------------------------
// M16 ammo projectile splash
datablock ParticleData(AwpSplashMist)
{
dragCoefficient = 2.0;
gravityCoefficient = -0.05;
inheritedVelFactor = 0.0;
constantAcceleration = 0.0;
lifetimeMS = 400;
lifetimeVarianceMS = 100;
useInvAlpha = false;
spinRandomMin = -90.0;
spinRandomMax = 500.0;
textureName = "~/data/shapes/soldier/splash";
colors[0] = "0.7 0.8 1.0 1.0";
colors[1] = "0.7 0.8 1.0 0.5";
colors[2] = "0.7 0.8 1.0 0.0";
sizes[0] = 0.5;
sizes[1] = 0.5;
sizes[2] = 0.8;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
datablock ParticleEmitterData(AwpSplashMistEmitter)
{
ejectionPeriodMS = 5;
periodVarianceMS = 0;
ejectionVelocity = 3.0;
velocityVariance = 2.0;
ejectionOffset = 0.0;
thetaMin = 85;
thetaMax = 85;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvance = false;
lifetimeMS = 250;
particles = "AwpSplashMist";
};
datablock ParticleData( AwpSplashParticle )
{
dragCoefficient = 1;
gravityCoefficient = 0.2;
inheritedVelFactor = 0.2;
constantAcceleration = -0.0;
lifetimeMS = 600;
lifetimeVarianceMS = 0;
colors[0] = "0.7 0.8 1.0 1.0";
colors[1] = "0.7 0.8 1.0 0.5";
colors[2] = "0.7 0.8 1.0 0.0";
sizes[0] = 0.5;
sizes[1] = 0.5;
sizes[2] = 0.5;
times[0] = 0.0;
times[1] = 0.5;
times[2] = 1.0;
};
About the author
#22
Hehe i wrote that above but maybe i wasn't clear enough :)
And Saska i'm glad you got it working !!
01/16/2007 (7:10 am)
@FuciferHehe i wrote that above but maybe i wasn't clear enough :)
And Saska i'm glad you got it working !!
#23
01/16/2007 (1:42 pm)
@Billy, I complete miss what you wrote. I found the error in console. If I saw what you wrote I would point him there. It is good idea to check the console if you script is not compile. Saska I am glad you got it working. One way I learn how script weapons was looking at different cs file. The BraveTree Girl has an assualt rife, skeleton pack has an mp5 and sword. I am working on weapon tutorial, I got side track but I will pick it back up today and finish it.
#24
--Amr
01/16/2007 (1:48 pm)
Have you tried using the Torsion IDE? It's currently in beta and so is free. When using the Torsion IDE, the IDE will inform you if your scripts have compiled or not, thus saving you the headache of not knowing what the hell's up with your code! You can get it from www.sickheadgames.com/torsion.php.--Amr
#25
01/17/2007 (1:15 am)
Thanks i figured out also now how to do shoot delays. But 1 question since im getting fast answers in this thread can someone answer how to recompile the engine with VC2005 express edition?
#26
--Amr
01/17/2007 (2:45 am)
Have you tried my suggestions in your original post? You didn't reply, so I don't know if you did or not.--Amr
Torque Owner Mark Junior