8
« on: May 18, 2010, 07:58:05 PM »
Apparently this overwrites akimbo data blocks. I'm new to weapons, I have no idea what I'm doing, and I'm a bit fed up with 'em, so HELP ME!
//Goldengun.cs
%error = ForceRequiredAddOn("Weapon_Gun");
if(%error == $Error::AddOn_Disabled)
{
GunItem.uiName = "";
}
if(%error == $Error::AddOn_NotFound)
{
error("ERROR: Weapon_GunsAkimbo - required add-on Weapon_Gun not found");
}
else
{
exec("./Weapon_AkimboGun.cs");
}
datablock AudioProfile(GoldengunShotSound)
{
filename = "./GoldengunShot.wav";
description = AudioClose3d;
preload = true;
};
AddDamageType("Goldengun", '<bitmap:add-ons/Weapon_Goldengun/CI_Goldengun> %1', '%2 <bitmap:add-ons/Weapon_Goldengun/CI_Goldengun> %1',0.2,1);
datablock ProjectileData(GoldengunProjectile)
{
projectileShapeName = "./bullet.dts";
directDamage = 10;
directDamageType = $DamageType::Goldengun;
radiusDamageType = $DamageType::Goldengun;
brickExplosionRadius = 0;
brickExplosionImpact = true; //destroy a brick if we hit it directly?
brickExplosionForce = 10;
brickExplosionMaxVolume = 1; //max volume of bricks that we can destroy
brickExplosionMaxVolumeFloating = 2; //max volume of bricks that we can destroy if they aren't connected to the ground
impactImpulse = 400;
verticalImpulse = 400;
explosion = gunExplosion;
particleEmitter = ""; //bulletTrailEmitter;
muzzleVelocity = 130;
velInheritFactor = 1;
armingDelay = 00;
lifetime = 4000;
fadeDelay = 3500;
bounceElasticity = 0.5;
bounceFriction = 0.20;
isBallistic = false;
gravityMod = 0.0;
hasLight = false;
lightRadius = 3.0;
lightColor = "0 0 0.5";
uiName = "Goldengun Bullet";
};
//////////
// item //
//////////
datablock ItemData(GoldengunItem)
{
category = "Weapon"; // Mission editor category
className = "Weapon"; // For inventory system
// Basic Item Properties
shapeFile = "./pistol.dts";
rotate = false;
mass = 1;
density = 0.2;
elasticity = 0.2;
friction = 0.6;
emap = true;
//gui stuff
uiName = "Goldengun";
iconName = "./icon_Goldengun";
doColorShift = true;
colorShiftColor = "1.000 .700 0.110 1.000";
// Dynamic properties defined by the scripts
image = GoldengunImage;
canDrop = true;
};
////////////////
//weapon image//
////////////////
datablock ShapeBaseImageData(GoldengunImage)
{
// Basic Item properties
shapeFile = "./pistol.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.7 1.2 -0.5";
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 = GoldengunProjectile;
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;
doColorShift = true;
colorShiftColor = GoldengunItem.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";
stateTimeoutValue[0] = 0.15;
stateTransitionOnTimeout[0] = "Ready";
stateSound[0] = weaponSwitchSound;
stateName[1] = "Ready";
stateTransitionOnTriggerDown[1] = "Fire";
stateAllowImageChange[1] = true;
stateSequence[1] = "Ready";
stateName[2] = "Fire";
stateTransitionOnTimeout[2] = "Smoke";
stateTimeoutValue[2] = 1.5;
stateFire[2] = true;
stateAllowImageChange[2] = false;
stateSequence[2] = "Fire";
stateScript[2] = "onFire";
stateWaitForTimeout[2] = true;
stateEmitter[2] = GunFlashEmitter;
stateEmitterTime[2] = 0.05;
stateEmitterNode[2] = "muzzleNode";
stateSound[2] = GoldengunShotSound;
stateEjectShell[2] = true;
stateName[3] = "Smoke";
stateEmitter[3] = GunSmokeEmitter;
stateEmitterTime[3] = 1.50;
stateEmitterNode[3] = "muzzleNode";
stateTimeoutValue[3] = 1.00;
stateTransitionOnTimeout[3] = "Reload";
stateName[4] = "Reload";
stateSequence[4] = "Reload";
stateTransitionOnTriggerUp[4] = "Ready";
stateSequence[4] = "Ready";
};
function GoldengunImage::onFire(%this,%obj,%slot)
{
if(%obj.getDamagePercent() < 1.0)
%obj.playThread(2, shiftAway);
Parent::onFire(%this,%obj,%slot);
%breakdelay = schedule(200, 0, Break, %this, %obj, %slot);
}
function Break(%this, %obj, %slot)
{
%currSlot = %obj.currtool;
%obj.tool[%currSlot] = 0;
%obj.weaponCount--;
messageClient(%obj.client,'MsgItemPickup','',%currSlot,0);
serverCmdUnUseTool(%obj.client);
}
function GoldengunProjectile::damage(%this,%obj,%col,%fade,%pos,%normal)
{
if(minigamecandamage(%obj, %col))
{
%col.kill();
}
}