datablock AudioProfile(ColtFireSound)
{
filename = "./Colt_fire.wav";
description = AudioClose3d;
preload = true;
};
datablock AudioProfile(ColtSwitchSound)
{
filename = "./ColtSwitch.wav";
description = AudioClose3d;
preload = true;
};
datablock AudioProfile(ColtSFireSound)
{
filename = "./ColtS_fire.wav";
description = AudioClose3d;
preload = true;
};
datablock ParticleData(ColtSmokeParticle)
{
dragCoefficient = 4;
gravityCoefficient = -1.0;
inheritedVelFactor = 0.2;
constantAcceleration = 0.0;
lifetimeMS = 425;
lifetimeVarianceMS = 55;
textureName = "base/data/particles/cloud";
spinSpeed = 10.0;
spinRandomMin = -500.0;
spinRandomMax = 500.0;
colors[0] = "0.5 0.5 0.5 0.7";
colors[1] = "0.5 0.5 0.5 0.0";
sizes[0] = 0.05;
sizes[1] = 0.25;
useInvAlpha = false;
};
datablock ParticleEmitterData(ColtSmokeEmitter)
{
ejectionPeriodMS = 10;
periodVarianceMS = 0;
ejectionVelocity = 1.0;
velocityVariance = 1.0;
ejectionOffset = 0.0;
thetaMin = 0;
thetaMax = 90;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvance = false;
particles = "ColtSmokeParticle";
};
datablock ParticleData(ColtExplosionParticle)
{
dragCoefficient = 8;
gravityCoefficient = -0.5;
inheritedVelFactor = 0.2;
constantAcceleration = 0.0;
lifetimeMS = 700;
lifetimeVarianceMS = 400;
textureName = "base/data/particles/cloud";
spinSpeed = 10.0;
spinRandomMin = -50.0;
spinRandomMax = 50.0;
colors[0] = "0.9 0.9 0.9 0.9";
colors[1] = "0.9 0.9 0.9 0.0";
sizes[0] = 0.25;
sizes[1] = 1.0;
useInvAlpha = true;
};
datablock ParticleEmitterData(ColtExplosionEmitter)
{
ejectionPeriodMS = 1;
periodVarianceMS = 0;
ejectionVelocity = 5;
velocityVariance = 1.0;
ejectionOffset = 0.0;
thetaMin = 89;
thetaMax = 90;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvance = false;
particles = "ColtExplosionParticle";
};
datablock ExplosionData(ColtExplosion)
{
//explosionShape = "";
soundProfile = "BulletHitSound";
lifeTimeMS = 150;
particleEmitter = ColtExplosionEmitter;
particleDensity = 10;
particleRadius = 0.2;
faceViewer = true;
explosionScale = "1 1 1";
shakeCamera = false;
camShakeFreq = "10.0 11.0 10.0";
camShakeAmp = "1.0 1.0 1.0";
camShakeDuration = 0.5;
camShakeRadius = 10.0;
// Dynamic light
lightStartRadius = 1;
lightEndRadius = 0;
lightStartColor = "1 1 1";
lightEndColor = "0 0 0";
uiName = "1911 Colt";
};
AddDamageType("Colt", '<bitmap:add-ons/Weapon_Colt/CI_Colt> %1', '%2 <bitmap:add-ons/Weapon_Colt/CI_Colt> %1',0.5,1);
datablock ProjectileData(ColtProjectile)
{
projectileShapeName = "./Bullet.dts";
directDamage = 25;
directDamageType = $DamageType::Colt;
radiusDamageType = $DamageType::Colt;
brickExplosionRadius = 0;
brickExplosionImpact = true; //destroy a brick if we hit it directly?
brickExplosionForce = 10;
brickExplosionMaxVolume = 15; //max volume of bricks that we can destroy
brickExplosionMaxVolumeFloating = 20; //max volume of bricks that we can destroy if they aren't connected to the ground
impactImpulse = 4;
verticalImpulse = 3;
explosion = ColtExplosion;
//particleEmitter = "";
muzzleVelocity = 190;
velInheritFactor = 1;
armingDelay = 00;
lifetime = 30000;
fadeDelay = 29500;
bounceElasticity = 0.99;
bounceFriction = 0.00;
isBallistic = false;
gravityMod = 0.0;
hasLight = false;
lightRadius = 3.0;
lightColor = "0 0 0.5";
uiName = "1911 Colt";
};
//////////
// item //
//////////
datablock ItemData(ColtItem)
{
category = "Weapon"; // Mission editor category
className = "Weapon"; // For inventory system
// Basic Item Properties
shapeFile = "./Colt.dts";
rotate = false;
mass = 1;
density = 0.2;
elasticity = 0.2;
friction = 0.6;
emap = true;
//gui stuff
uiName = "'1911 Colt";
iconName = "./Icon_Colt";
doColorShift = false;
colorShiftColor = (180/255) SPC (180/255) SPC (180/255) SPC (255/255);
// Dynamic properties defined by the scripts
image = ColtImage;
canDrop = true;
};
////////////////
//weapon image//
////////////////
datablock ShapeBaseImageData(ColtImage) // This is incredibly sensitive code. If you leave out any semi-colons, the gun will break.
{
// Basic Item properties
shapeFile = "./Colt.dts";
emap = true;
// Specify mount point & offset for 3rd person, and eye offset
// for first person rendering.
mountPoint = 0;
offset = "0 0 0";
eyeOffset = 0; //"0.0 1.0 -0.85";
rotation = eulerToMatrix( "0 -45 0" );
// When firing from a point offset from the eye, muzzle correction
// will adjust the muzzle vector to point to the eye LOS point.
// Since this weapon doesn't actually fire from the muzzle point,
// we need to turn this off.
correctMuzzleVector = true;
// Add the WeaponImage namespace as a parent, WeaponImage namespace
// provides some hooks into the inventory system.
className = "WeaponImage";
// Projectile && Ammo.
item = BowItem;
ammo = " ";
projectile = ColtProjectile;
projectileType = Projectile;
casing = GunShellDebris;
shellExitDir = "1.0 -1.3 1.0";
shellExitOffset = "0 -45 0";
shellExitVariance = 15.0;
shellVelocity = 7.0;
//melee particles shoot from eye node for consistancy
melee = false;
//raise your arm up or not
armReady = true;
LarmReady = true;
doColorShift = true;
colorShiftColor = ColtItem.colorShiftColor;//"0.400 0.196 0 1.000";
//casing = " ";
// Images have a state system which controls how the animations
// are run, which sounds are played, script callbacks, etc. This
// state system is downloaded to the client so that clients can
// predict state changes and animate accordingly. The following
// system supports basic ready->fire->reload transitions as
// well as a no-ammo->dryfire idle state.
// Initial start up state
stateName[0] = "Activate";
stateSequence[0] = "lock";
stateTimeoutValue[0] = 0.3;
stateTransitionOnTimeout[0] = "Ready";
stateSound[0] = ColtSwitchSound;
stateName[1] = "Ready";
stateTransitionOnTriggerDown[1] = "Fire";
stateAllowImageChange[1] = true;
stateSequence[1] = "ready";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Smoke";
stateTimeoutValue[3] = 0.25;
stateFire[3] = true;
stateAllowImageChange[3] = false;
stateSequence[3] = "Fire";
//stateScript[3] = "onFire";
stateWaitForTimeout[3] = true;
stateEmitter[3] = gunFlashEmitter;
stateEmitterTime[3] = 0.10;
stateEmitterNode[3] = "muzzleNode";
stateSound[3] = ColtFireSound;
stateEjectShell[3] = true;
stateName[4] = "Smoke";
stateEmitter[4] = ColtSmokeEmitter;
stateEmitterTime[4] = 0.14;
stateEmitterNode[4] = "muzzleNode";
stateTimeoutValue[4] = 0.35;
stateTransitionOnTimeout[4] = "Ready";
};
function ColtImage::onFire(%this,%obj,%slot)
{
if(%obj.getDamagePercent() < 1.0)
%obj.playThread(2, plant);
%projectile = %this.projectile;
%spread = 0.0006;
%shellcount = 1;
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;
}
AddDamageType("ColtS", '<bitmap:add-ons/Weapon_Colt/CI_ColtS> %1', '%2 <bitmap:add-ons/Weapon_Colt/CI_ColtS> %1',0.5,1);
datablock ProjectileData(ColtSProjectile)
{
projectileShapeName = "./Bullet.dts";
directDamage = 27;
directDamageType = $DamageType::ColtS;
radiusDamageType = $DamageType::ColtS;
brickExplosionRadius = 0;
brickExplosionImpact = true; //destroy a brick if we hit it directly?
brickExplosionForce = 10;
brickExplosionMaxVolume = 15; //max volume of bricks that we can destroy
brickExplosionMaxVolumeFloating = 20; //max volume of bricks that we can destroy if they aren't connected to the ground
impactImpulse = 4;
verticalImpulse = 3;
explosion = ColtExplosion;
//particleEmitter = "";
muzzleVelocity = 180;
velInheritFactor = 1;
armingDelay = 00;
lifetime = 30000;
fadeDelay = 29500;
bounceElasticity = 0.99;
bounceFriction = 0.00;
isBallistic = false;
gravityMod = 0.0;
hasLight = false;
lightRadius = 3.0;
lightColor = "0 0 0.5";
uiName = "1911 Colt Silenced";
};
//////////
// item //
//////////
datablock ItemData(ColtSItem)
{
category = "Weapon"; // Mission editor category
className = "Weapon"; // For inventory system
// Basic Item Properties
shapeFile = "./ColtS.dts";
rotate = false;
mass = 1;
density = 0.2;
elasticity = 0.2;
friction = 0.6;
emap = true;
//gui stuff
uiName = "'1911 Colt Silenced";
iconName = "./Icon_ColtS";
doColorShift = false;
colorShiftColor = (180/255) SPC (180/255) SPC (180/255) SPC (255/255);
// Dynamic properties defined by the scripts
image = ColtSImage;
canDrop = true;
};
////////////////
//weapon image//
////////////////
datablock ShapeBaseImageData(ColtSImage)
{
// Basic Item properties
shapeFile = "./ColtS.dts";
emap = true;
// Specify mount point & offset for 3rd person, and eye offset
// for first person rendering.
mountPoint = 0;
offset = "0 0 0";
eyeOffset = 0; //"0.0 1.0 -0.85"
rotation = ""; //eulerToMatrix( 0 0 0 )
// When firing from a point offset from the eye, muzzle correction
// will adjust the muzzle vector to point to the eye LOS point.
// Since this weapon doesn't actually fire from the muzzle point,
// we need to turn this off.
correctMuzzleVector = true;
// Add the WeaponImage namespace as a parent, WeaponImage namespace
// provides some hooks into the inventory system.
className = "WeaponImage";
// Projectile && Ammo.
item = BowItem;
ammo = " ";
projectile = ColtSProjectile;
projectileType = Projectile;
casing = GunShellDebris;
shellExitDir = "1.0 -1.3 1.0";
shellExitOffset = "0 0 0";
shellExitVariance = 15.0;
shellVelocity = 7.0;
//melee particles shoot from eye node for consistancy
melee = false;
//raise your arm up or not
armReady = true;
LarmReady = true;
doColorShift = true;
colorShiftColor = ColtSItem.colorShiftColor;//"0.400 0.196 0 1.000";
//casing = " ";
// Images have a state system which controls how the animations
// are run, which sounds are played, script callbacks, etc. This
// state system is downloaded to the client so that clients can
// predict state changes and animate accordingly. The following
// system supports basic ready->fire->reload transitions as
// well as a no-ammo->dryfire idle state.
// Initial start up state
stateName[0] = "Activate";
stateSequence[0] = "lock";
stateTimeoutValue[0] = 0.3;
stateTransitionOnTimeout[0] = "Ready";
stateSound[0] = weaponSwitchSound;
stateName[1] = "Ready";
stateTransitionOnTriggerDown[1] = "Fire";
stateAllowImageChange[1] = true;
stateSequence[1] = "ready";
stateName[3] = "Fire";
stateTransitionOnTimeout[3] = "Smoke";
stateTimeoutValue[3] = 0.25;
stateFire[3] = true;
stateAllowImageChange[3] = false;
stateSequence[3] = "Fire";
stateWaitForTimeout[3] = true;
stateScript[3] = "onFire";
stateEmitter[3] = gunFlashEmitter;
stateEmitterTime[3] = 0.10;
stateEmitterNode[3] = "muzzleNode";
stateSound[3] = ColtSFireSound;
stateEjectShell[3] = true;
stateName[4] = "Smoke";
stateEmitter[4] = ColtSmokeEmitter;
stateEmitterTime[4] = 0.14;
stateEmitterNode[4] = "muzzleNode";
stateTimeoutValue[4] = 0.35;
stateTransitionOnTimeout[4] = "Ready";
};
function ColtSImage::onFire(%this,%obj,%slot)
{
if(%obj.getDamagePercent() < 1.0)
%obj.playThread(2, plant);
%projectile = %this.projectile;
%spread = 0.0007;
%shellcount = 1;
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;
}
This is a Colt edit if you can't tell by now.