--------------------------------------------------------------------------------------------------------------- Flame Torch Pack Tutorial by Defender --------------------------------------------------------------------------------------------------------------- This creates a Flame Torch Pack.. credit go's to team hammer, Not Dynablade Sorry.. Most every thing els he get's credit for.. Step #1 // ------------------------------------------ // inventoryHud.cs // ------------------------------------------ Add this near the top of the file: $InvPack[13] = "Flame Torch Pack"; // set the right number $NTInvPack[13] = "Flame Torch Pack"; // set the right number $NameToInv["Flame Torch Pack"] = "flamePack1"; Step #2 // ------------------------------------------ // pack.cs // ------------------------------------------ exec("scripts/packs/flame.cs"); Step #3 // ------------------------------------------ // player.cs // ------------------------------------------ // In each player datablock add this, Only heavies need it. max[flamePack1] = 1; Step #4 Create a file in the packs folder, Copy and past the code below.. flame.cs //--------------------------------------------------------------------------- // flame Pack: Credit gos to the hammer team, Used their code //--------------------------------------------------------------------------- datablock AudioProfile(flamePackSwitchSound) { filename = "fx/weapons/sniper_miss.wav"; description = AudioClosest3d; preload = true; effect = flamePackSwitchEffect; }; datablock AudioProfile(flamePackFireSound) { filename = "fx/vehicles/outrider_skid.wav"; description = AudioDefault3d; preload = true; effect = flamePackEffect; }; datablock AudioProfile(flamePackProjectileSound) { filename = "fx/powered/turret_aa_fire.wav"; description = ProjectileLooping3d; preload = true; }; datablock ParticleData( TorchSplashParticle ) { dragCoefficient = 1; gravityCoefficient = 0.2; inheritedVelFactor = 0.2; constantAcceleration = -0.0; lifetimeMS = 900; /// was 600 lifetimeVarianceMS = 0; textureName = "special/droplet"; 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; }; datablock ParticleEmitterData( TorchSplashEmitter ) { ejectionPeriodMS = 1; periodVarianceMS = 0; ejectionVelocity = 3; velocityVariance = 1.0; ejectionOffset = 0.0; thetaMin = 60; thetaMax = 80; phiReferenceVel = 0; phiVariance = 360; overrideAdvances = false; orientParticles = true; lifetimeMS = 500; // was 100 particles = "TorchSplashParticle"; }; datablock SplashData(TorchSplash) { dragCoeffiecient = 0.0; gravityCoefficient = -0.2; inheritedVelFactor = 0.0; lifetimeMS = 600; // was 300 lifetimeVarianceMS = 50; textureName = "particleTest"; useInvAlpha = false; spinRandomMin = -160.0; spinRandomMax = 160.0; animateTexture = true; framesPerSec = 15; animTexName[0] = "special/Explosion/exp_0016"; animTexName[1] = "special/Explosion/exp_0018"; animTexName[2] = "special/Explosion/exp_0020"; animTexName[3] = "special/Explosion/exp_0022"; animTexName[4] = "special/Explosion/exp_0024"; animTexName[5] = "special/Explosion/exp_0026"; animTexName[6] = "special/Explosion/exp_0028"; animTexName[7] = "special/Explosion/exp_0030"; animTexName[8] = "special/Explosion/exp_0032"; colors[0] = "1.0 0.7 0.5 1.0"; colors[1] = "1.0 0.5 0.2 1.0"; colors[2] = "1.0 0.25 0.1 0.0"; sizes[0] = 4.5; sizes[1] = 2.5; sizes[2] = 3.5; times[0] = 0.0; times[1] = 0.7; times[2] = 1.0; }; //-------------------------------------------------------------------------- // Particle Effects //-------------------------------------- datablock ParticleData(TorchParticle) { dragCoeffiecient = 0.0; gravityCoefficient = -0.2; inheritedVelFactor = 0.0; lifetimeMS = 600; // was 300 lifetimeVarianceMS = 50; textureName = "particleTest"; useInvAlpha = false; spinRandomMin = -160.0; spinRandomMax = 160.0; animateTexture = true; framesPerSec = 15; animTexName[0] = "special/Explosion/exp_0016"; animTexName[1] = "special/Explosion/exp_0018"; animTexName[2] = "special/Explosion/exp_0020"; animTexName[3] = "special/Explosion/exp_0022"; animTexName[4] = "special/Explosion/exp_0024"; animTexName[5] = "special/Explosion/exp_0026"; animTexName[6] = "special/Explosion/exp_0028"; animTexName[7] = "special/Explosion/exp_0030"; animTexName[8] = "special/Explosion/exp_0032"; colors[0] = "1.0 0.7 0.5 1.0"; colors[1] = "1.0 0.5 0.2 1.0"; colors[2] = "1.0 0.25 0.1 0.0"; sizes[0] = 4.5; sizes[1] = 2.5; sizes[2] = 3.5; times[0] = 0.0; times[1] = 0.7; times[2] = 1.0; }; datablock ParticleEmitterData(TorchEmitter) { ejectionPeriodMS = 10; periodVarianceMS = 0; ejectionVelocity = 1.5; velocityVariance = 0.3; thetaMin = 0.0; thetaMax = 30.0; particles = "TorchParticle"; }; datablock ExplosionData(TorchBoltExplosion) { explosionShape = "effect_plasma_explosion.dts"; //soundProfile = plasmaExpSound; particleEmitter[0] = PlasmaExplosionEmitter; emitter[1] = GExplosionSmokeEmitter; particleDensity = 150; particleRadius = 1.25; faceViewer = true; }; //-------------------------------------------------------------------------- // Projectile //-------------------------------------- datablock LinearProjectileData(TorchBullet) { projectileShapeName = "plasmabolt.dts"; // disc.dts emitterDelay = -1; baseEmitter = TorchEmitter; directDamage = 0.005; hasDamageRadius = true; indirectDamage = 0.05; damageRadius = 10.0; radiusDamageType = $DamageType::Plasma; // add a flame damage type, later //directDamageType = $DamageType::EMP; kickBackStrength = 70; sound = flamePackFireSound; explosion = "TorchBoltExplosion"; underwaterExplosion = "UnderwaterDiscExplosion"; splash = TorchSplash; dryVelocity = 70; wetVelocity = 20; velInheritFactor = 0.5; fizzleTimeMS = 2000; lifetimeMS = 3500; explodeOnDeath = true; reflectOnWaterImpactAngle = 15.0; explodeOnWaterImpact = false; deflectionOnWaterImpact = 0.0; fizzleUnderwaterMS = 1000; hasLight = true; lightRadius = 3.0; lightColor = "0.75 0.175 0.1"; }; datablock ShapeBaseImageData(flamePackImage1) { shapeFile = "turret_fusion_large.dts"; item = flamePack1; mountPoint = 1; offset = "-0.5 0 0.5"; rechargeRateBoost = 0.30; //0.15 explodeOnDeath = true; // State transitions stateName[0] = "Activate"; stateTransitionOnTimeout[0] = "ActivateReady"; stateTimeoutValue[0] = 0.5; stateSequence[0] = "Activate"; stateSound[0] = flamePackSwitchSound; stateName[1] = "ActivateReady"; stateTransitionOnLoaded[1] = "Ready"; stateTransitionOnNoAmmo[1] = "NoAmmo"; stateName[2] = "Ready"; stateTransitionOnNoAmmo[2] = "NoAmmo"; stateTransitionOnTriggerDown[2] = "Fire"; stateName[3] = "Fire"; stateTransitionOnTimeout[3] = "Reload"; stateTimeoutValue[3] = 0.3; stateFire[3] = true; stateRecoil[3] = NoRecoil; stateAllowImageChange[3] = false; stateSequence[3] = "Fire"; stateSound[3] = flamePackFireSound; stateScript[3] = "onFire"; stateName[4] = "Reload"; stateTransitionOnNoAmmo[4] = "NoAmmo"; stateTransitionOnTimeout[4] = "Ready"; stateAllowImageChange[4] = false; stateSequence[4] = "Reload"; stateName[5] = "NoAmmo"; stateTransitionOnAmmo[5] = "Reload"; stateSequence[5] = "NoAmmo"; stateTransitionOnTriggerDown[5] = "DryFire"; stateName[6] = "DryFire"; stateTimeoutValue[6] = 0.3; stateSound[6] = BlasterDryFireSound; stateTransitionOnTimeout[6] = "Ready"; }; datablock ItemData(flamePack1) { className = Pack; catagory = "Packs"; shapeFile = "pack_barrel_missile.dts"; explodeOnDeath = true; mass = 4; elasticity = 0.2; friction = 0.6; pickupRadius = 2; rotate = true; image = "flamePackImage1"; pickUpName = "a Flame pack"; heatSignature = 0.5;//was computeCRC = true; }; datablock ShapeBaseImageData(flamePackImage2) : flamePackImage1 { item = flamePack2; offset = "0.5 0 0.5"; shapeFile = "turret_fusion_large.dts"; }; datablock ItemData(flamePack2) { className = Pack; catagory = "Packs"; shapeFile = "pack_barrel_missile.dts"; mass = 1; elasticity = 0.2; friction = 0.6; pickupRadius = 2; rotate = true; image = "flamePackImage2"; pickUpName = "a Flame pack"; computeCRC = true; }; // --- functions function flamePack1::onAdd(%this) { echo("added!"); } function flamePackImage1::onMount(%this, %obj, %slot) { if(%obj.getMountedImage($AuxiliarySlot) != 0) %obj.unmountImage($AuxiliarySlot); %obj.mountImage(flamePackImage2, $AuxiliarySlot); if(!%obj.cooling) schedule(5000, %obj, "CoolOff", %obj); %obj.cooling = true; } function flamePackImage1::onUnmount(%this, %obj, %slot) { Parent::onUnmount(%this, %obj, %slot); if(%obj.getMountedImage($AuxiliarySlot) != 0) %obj.unmountImage($AuxiliarySlot); } function flamePackImage1::onDrop(%this, %obj, %slot) { echo("drop!!"); } function flamePack1::onInventory(%this,%player,%value) { Parent::onInventory(%this,%player,%value); } function flamePack1::onPickup(%this, %obj, %shape, %amount) { echo("pickup!"); // created to prevent console errors } function flamePack1::onUse(%data, %obj) { %energy = %obj.getEnergyLevel(); %obj.setImageTrigger($BackpackSlot, false); if(%obj.heatLevel < 498) // was < 88) { %obj.heatLevel += (10 + mFloor(5 * getRandom())); } else { echo("ultimate pain"); messageClient(%obj.client, '', "\c5Your Flame Torch Pack reached critical temperature, this is going to hurt!"); bottomPrint(%obj.client, "\nFlame Torch Pack Reached Critical Temperature!", 1, 3); echo("op" SPC %obj.getPosition()); RadiusExplosion(%obj, %obj.getWorldBoxCenter(), 10, 3, 2000, %obj, $DamageType::Explosion); if(%obj.getMountedImage($BackpackSlot) != 0) %obj.unmountImage($BackpackSlot); if(%obj.getMountedImage($AuxiliarySlot) != 0) %obj.unmountImage($AuxiliarySlot); %obj.decInventory(%data, 1); //blow up the packs! return; } if(%obj.heatLevel >= 50) bottomPrint(%obj.client, "\nFlame Torch Pack Temperature :" SPC %obj.heatLevel @ "\%", 1, 3); else if(%energy < 10) RadiusExplosion(%obj, %obj.getWorldBoxCenter(), 5, 0.2, 1000, %obj, $DamageType::Default); if(%obj.heatLevel >= 68 && %obj.heatLevel < 498) // was < 88) { if(%obj.getEnergyPercent() < 0.5) { echo("minor pain"); messageClient(%obj.client, '', "\c3Your Flame Torch Pack is running hot! (" @ %obj.heatLevel @"\%)"); %obj.playAudio(0, MissileDryFireSound); RadiusExplosion(%obj, %obj.getWorldBoxCenter(), 5, 0.2, 1000, %obj, $DamageType::Default); } } if(%obj.heatLevel >= 498) // was < 88 { echo("medium pain"); %obj.playAudio(0, MissileDryFireSound); messageClient(%obj.client, '', "\c5Your Flame Torch Pack has reached a dangerous temperature! (" @ %obj.heatLevel @"\%)"); RadiusExplosion(%obj, %obj.getWorldBoxCenter(), 5, 0.6, 1000, %obj, $DamageType::Explosion); if(%obj.heatLevel > 499) // was > 90) //dont fire if we're too hot return; } %obj.setEnergyLevel(%energy - 15); // was 25 %vec = %obj.getMuzzleVector($BackPackSlot); %obj.flame1 = new (LinearProjectile)() { dataBlock = TorchBullet; initialDirection = %vec; initialPosition = %obj.getMuzzlePoint($BackPackSlot); sourceObject = %obj; damageFactor = 0.05; sourceSlot = %BackPackSlot; }; %vec = %obj.getMuzzleVector($AuxiliarySlot); %obj.flame2 = new (LinearProjectile)() { dataBlock = TorchBullet; initialDirection = %vec; initialPosition = %obj.getMuzzlePoint($AuxiliarySlot); sourceObject = %obj; damageFactor = 0.05; sourceSlot = $AuxiliarySlot; }; } function CoolOff(%obj) { %oldheat = %obj.heatLevel; %obj.heatLevel = (%obj.heatLevel > 4) ? %obj.heatLevel - 5 : 0; if(%obj.getMountedImage($BackpackSlot) != 0) %img = %obj.getMountedImage($BackpackSlot).getName(); else %img = ""; if(%obj.heatLevel >= 40 && %img $= "flamePackImage1") { if(%oldheat >= 50 && %oldheat <= 55) messageClient(%obj.client, '', "\c3Your Flame Torch Pack has cooled to a stable temperature."); bottomPrint(%obj.client, "\nFlame Torch Pack Temperature :" SPC %obj.heatLevel @ "\%", 2.5, 3); } schedule(4000, %obj, "CoolOff", %obj); }