I don't know if the stuff in this script will still work, but this is the code to the tie fighter. If I recall correctly, it fired out red lasers when you pressed the fire key. I can't remember if the weapon was attached to the vehicle, or if the model had no clipping for projectiles, and you just fired out of it.
Anyway, maybe it will help someone.
//Lego Plane
//---------------------------------------------------------------------------------------
// Drone Definition
datablock FlyingVehicleData(TieFighter)
{
spawnOffset = "0 0 2";
emap = true;
category = "Vehicles";
shapeFile = "aioreloaded/data/shapes/vehicles/tief/tiefighter.dts";
multipassenger = True;
computeCRC = true;
drag = 0.25;
density = 1.0;
maxMountSpeed = 0.3;
mountDelay = 8;
dismountDelay = 1;
maxDismountSpeed = 0.0;
stationaryThreshold = 0.5;
mountPose[0] = "standing";
mountPose[1] = "standing";
mountPose[2] = "standing";
mountPointTransform[0] = "0 0 0 0 0 1 0";
mountPointTransform[1] = "0 0 0 0 0 1 0";
mountPointTransform[2] = "0 0 0 0 0 1 0";
numMountPoints = 3;
isProtectedMountPoint[0] = true;
cameraOffset = 4; // Vertical offset from camera mount point
cameraMaxDist = 16;
cameraOffset = 3.65;
cameraLag = 0.1;
cameraRoll = true; // Roll the camera with the vehicle
explosionDamage = 10.5;
explosionRadius = 15.0;
maxDamage = 50.40;
destroyedLevel = 50.40;
energyPerDamagePoint = 160;
maxEnergy = 280; // Afterburner and any energy weapon pool
rechargeRate = 0.8;
minDrag = 40; // Linear Drag (eventually slows you down when not thrusting...constant drag)
rotationalDrag = 20; // Anguler Drag (dampens the drift after you stop moving the mouse...also tumble drag)
maxAutoSpeed = 10; // Autostabilizer kicks in when less than this speed. (meters/second)
autoAngularForce = 400; // Angular stabilizer force (this force levels you out when autostabilizer kicks in)
autoLinearForce = 300; // Linear stabilzer force (this slows you down when autostabilizer kicks in)
autoInputDamping = 0.55; // Dampen control input so you don't` whack out at very slow speeds
// Maneuvering
maxSteeringAngle = 1; // Max radiens you can rotate the wheel. Smaller number is more maneuverable.
horizontalSurfaceForce = 20; // Horizontal center "wing" (provides "bite" into the wind for climbing/diving and turning)
verticalSurfaceForce = 20; // Vertical center "wing" (controls side slip. lower numbers make MORE slide.)
maneuveringForce = 6400; // Horizontal jets (W,S,D,A key thrust)
steeringForce = 500; // Steering jets (force applied when you move the mouse)
steeringRollForce = 200; // Steering jets (how much you heel over when you turn)
rollForce = 10; // Auto-roll (self-correction to right you after you roll/invert)
hoverHeight = 0.5; // Height off the ground at rest
createHoverHeight = 0.5; // Height off the ground when created
maxForwardSpeed = 50; // speed in which forward thrust force is no longer applied (meters/second)
// Turbo Jet
jetForce = 3000; // Afterburner thrust (this is in addition to normal thrust)
minJetEnergy = 28; // Afterburner can't be used if below this threshhold.
jetEnergyDrain = 2.8; // Energy use of the afterburners (low number is less drain...can be fractional) // Auto stabilize speed
vertThrustMultiple = 3.0;
// Rigid body
mass = 100; // Mass of the vehicle
integration = 3; // Physics integration: TickSec/Rate
collisionTol = 0.6; // Collision distance tolerance
contactTol = 0.4; // Contact velocity tolerance
bodyFriction = 0; // Don't mess with this.
bodyRestitution = 0.8; // When you hit the ground, how much you rebound. (between 0 and 1)
minRollSpeed = 2000; // Don't mess with this.
softImpactSpeed = 3; // Sound hooks. This is the soft hit.
hardImpactSpeed = 15; // Sound hooks. This is the hard hit.
// Ground Impact Damage (uses DamageType::Ground)
minImpactSpeed = 10; // If hit ground at speed above this then it's an impact. Meters/second
speedDamageScale = 0.06;
// Object Impact Damage (uses DamageType::Impact)
collDamageThresholdVel = 23.0;
collDamageMultiplier = 0.02;
//
minTrailSpeed = 15; // The speed your contrail shows up at.
//trailEmitter = DroneContrailEmitter;
//forwardJetEmitter = DroneJetEmitter;
//downJetEmitter = DroneJetEmitter;
//
//jetSound = DroneThrustSound;
//engineSound = DroneEngineSound;
//softImpactSound = DroneSoftImpactSound;
//hardImpactSound = DroneHardImpactSound;
//
//softSplashSoundVelocity = 10.0;
//mediumSplashSoundVelocity = 15.0;
//hardSplashSoundVelocity = 20.0;
//exitSplashSoundVelocity = 10.0;
//exitingWater = DroneExitWaterMediumSound;
//impactWaterEasy = DroneImpactWaterSoftSound;
//impactWaterMedium = DroneImpactWaterMediumSound;
//impactWaterHard = DroneImpactWaterMediumSound;
//waterWakeSound = DroneWakeMediumSplashSound;
// dustEmitter = VehicleLiftoffDustEmitter;
triggerDustHeight = 4.0;
dustHeight = 1.0;
// damageEmitter[0] = LightDamageSmoke;
// damageEmitter[1] = HeavyDamageSmoke;
// damageEmitter[2] = DamageBubbles;
damageEmitterOffset[0] = "0.0 -3.0 0.0 ";
damageLevelTolerance[0] = 0.3;
damageLevelTolerance[1] = 0.7;
numDmgEmitterAreas = 3;
//
//max[RocketAmmo] = 1000;
minMountDist = 2;
//splashEmitter[0] = VehicleFoamDropletsEmitter;
//splashEmitter[1] = VehicleFoamEmitter;
//shieldImpact = VehicleShieldImpact;
//cmdCategory = "Tactical";
//cmdIcon = CMDFlyingScoutIcon;
//cmdMiniIconName = "commander/MiniIcons/com_scout_grey";
//targetNameTag = 'Drone';
//targetTypeTag = 'FlyingVehicle';
//sensorData = AWACPulseSensor;
//sensorRadius = AWACPulseSensor.detectRadius;
//sensorColor = "255 194 9";
checkRadius = 5.5;
observeParameters = "0 0 1";
shieldEffectScale = "0.937 1.125 0.60";
};
// End Drone Definition
//----------------------------------------------------------------------------------------
// Vehicle Drone Functions
function tiefighter::onDamage(%this, %obj, %delta)
{
Parent::onDamage(%this, %obj);
%currentDamage = %obj.getDamageLevel();
if(%currentDamage > %obj.destroyedLevel)
{
if(%obj.getDamageState() !$= "Destroyed")
{
if(%obj.respawnTime !$= "")
%obj.marker.schedule = %obj.marker.data.schedule(%obj.respawnTime, "respawn", %obj.marker);
%obj.setDamageState(Destroyed);
}
}
else
{
if(%obj.getDamageState() !$= "Enabled")
%obj.setDamageState(Enabled);
}
}
function tiefighter::onAdd(%data, %obj)
{
%obj.setRechargeRate(%data.rechargeRate);
// %obj.mountImage(MissileLauncherImage, 0); // Optional Weapon Mounting
if(%obj.disableMove)
%obj.immobilized = true;
%obj.mountImage(tiefighterblasterImage,1);
%obj.mountImage(tiefighterblasterImage,2);
%obj.mountable = true;
// Enable Mount Points
}
function tiefighter::onTrigger(%data, %obj, %trigger, %state)
{
// data = datablock
// obj = object number
// trigger = 0 for "fire", 1 for "jump", 3 for "thrust"
// state = 1 for firing, 0 for not firing
if(%trigger == 0)
{
switch (%state) {
case 0:
%obj.fireWeapon = false;
%obj.setImageTrigger(1, false);
%obj.setImageTrigger(2, false);
case 1:
%obj.fireWeapon = true;
if(%obj.nextWeaponFire == 0) {
%obj.setImageTrigger(1, true);
%obj.setImageTrigger(2, false);
}
else {
%obj.setImageTrigger(1, false);
%obj.setImageTrigger(2, true);
}
}
}
}
function tiefighter::onCollision(%this,%obj,%col,%vec,%speed)
{
// Collision with other objects, including items
if (%col.getClassName() $= "Player")
%col.damage(%obj,%pos,%this.maxdamage,"RifleBullet");
}
datablock AudioProfile(tiefighterblasterExplosionSound)
{
filename = "aioreloaded/data/sound/fettblaster/hit.wav";
description = AudioClose3d;
preload = false;
};
datablock AudioProfile(tiefighterblasterFireSound)
{
filename = "aioreloaded/data/sound/fettblaster/fire.wav";
description = AudioClosest3d;
preload = false;
};
datablock AudioProfile(detonatorSwitchSound)
{
filename = "aioreloaded/data/sound/fettblaster/on.wav";
description = AudioClose3d;
preload = false;
};
//tiefighterblaster trail
datablock ParticleData(tiefighterblasterTrailParticle)
{
dragCoefficient = 3.0;
windCoefficient = 0.0;
gravityCoefficient = 0.0;
inheritedVelFactor = 0.0;
constantAcceleration = 0.0;
lifetimeMS = 900;
lifetimeVarianceMS = 0;
spinSpeed = 10.0;
spinRandomMin = -50.0;
spinRandomMax = 50.0;
useInvAlpha = false;
animateTexture = false;
//framesPerSec = 1;
textureName = "aioreloaded/data/particles/dot";
//animTexName = "aioreloaded/data/particles/dot";
// Interpolation variables
colors[0] = "1 1 1 0.5";
colors[1] = "1 1 1 0.0";
sizes[0] = 0.2;
sizes[1] = 0.01;
times[0] = 0.0;
times[1] = 1.0;
};
datablock ParticleEmitterData(tiefighterblasterTrailEmitter)
{
ejectionPeriodMS = 7;
periodVarianceMS = 0;
ejectionVelocity = 0; //0.25;
velocityVariance = 0; //0.10;
ejectionOffset = 0;
thetaMin = 0.0;
thetaMax = 90.0;
particles = tiefighterblasterTrailParticle;
};
//effects
datablock ParticleData(tiefighterblasterExplosionParticle)
{
dragCoefficient = 5;
gravityCoefficient = 0.1;
inheritedVelFactor = 0.2;
constantAcceleration = 0.0;
lifetimeMS = 500;
lifetimeVarianceMS = 300;
textureName = "aioreloaded/data/particles/chunk";
spinSpeed = 10.0;
spinRandomMin = -50.0;
spinRandomMax = 50.0;
colors[0] = "0.9 0.9 0.6 0.9";
colors[1] = "0.9 0.5 0.6 0.0";
sizes[0] = 0.25;
sizes[1] = 0.0;
};
datablock ParticleEmitterData(tiefighterblasterExplosionEmitter)
{
ejectionPeriodMS = 7;
periodVarianceMS = 0;
ejectionVelocity = 5;
velocityVariance = 1.0;
ejectionOffset = 0.0;
thetaMin = 0;
thetaMax = 90;
phiReferenceVel = 0;
phiVariance = 360;
overrideAdvance = false;
particles = "tiefighterblasterExplosionParticle";
};
datablock ExplosionData(tiefighterblasterExplosion)
{
//explosionShape = "";
soundProfile = tiefighterblasterExplosionSound;
lifeTimeMS = 150;
particleEmitter = tiefighterblasterExplosionEmitter;
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 = 0;
lightEndRadius = 2;
lightStartColor = "0.7 0 0";
lightEndColor = "0 0 0";
};
//projectile
datablock ProjectileData(tiefighterblasterProjectile)
{
projectileShapeName = "aioreloaded/data/shapes/storm/shapes/fettblaster/redblast.dts";
directDamage = 100;
radiusDamage = 99;
damageRadius = 0.5;
explosion = tiefighterblasterExplosion;
// particleEmitter = tiefighterblasterTrailEmitter;
muzzleVelocity = 60;
velInheritFactor = 0;
armingDelay = 0;
lifetime = 80000;
fadeDelay = 75000;
bounceElasticity = 0;
bounceFriction = 0;
isBallistic = true;
gravityMod = 0;
hasLight = true;
lightRadius = 3.0;
lightColor = "0.7 0 0";
};
//////////
// item //
//////////
////////////////
//weapon image//
////////////////
datablock ShapeBaseImageData(tiefighterblasterImage)
{
// Basic Item properties
shapeFile = "aioreloaded/data/shapes/vehicles/speederbike/blaster.dts";
skinName = 'brown';
emap = true;
cloakable = false;
// Specify mount point & offset for 3rd person, and eye offset
// for first person rendering.
mountPoint = 0;
offset = "0 0 0";
//eyeOffset = "0.1 0.2 -0.55";
// 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 = tiefighterblaster;
ammo = " ";
projectile = tiefighterblasterProjectile;
projectileType = Projectile;
//melee particles shoot from eye node for consistancy
melee = false;
//raise your arm up or not
armReady = true;
//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.1;
stateTransitionOnTimeout[0] = "Ready";
stateSound[0] = tiefighterblasterSwitchSound;
stateName[1] = "Ready";
stateTransitionOnTriggerDown[1] = "Fire";
stateAllowImageChange[1] = true;
stateName[2] = "Fire";
stateTransitionOnTimeout[2] = "Reload";
stateTimeoutValue[2] = 0.1;
stateFire[2] = true;
stateAllowImageChange[2] = false;
stateSequence[2] = "Fire";
stateScript[2] = "onFire";
stateWaitForTimeout[2] = true;
stateSound[2] = tiefighterblasterFireSound;
stateName[3] = "Reload";
stateSequence[3] = "Reload";
stateAllowImageChange[3] = false;
stateTimeoutValue[3] = 0.1;
stateWaitForTimeout[3] = true;
stateTransitionOnTimeout[3] = "Check";
stateName[4] = "Check";
stateTransitionOnTriggerUp[4] = "StopFire";
stateTransitionOnTriggerDown[4] = "Fire";
stateName[5] = "StopFire";
stateTransitionOnTimeout[5] = "Ready";
stateTimeoutValue[5] = 0.1;
stateAllowImageChange[5] = false;
stateWaitForTimeout[5] = true;
//stateSequence[5] = "Reload";
stateScript[5] = "onStopFire";
};
function tiefighterblasterProjectile::onCollision(%this,%obj,%col,%fade,%pos,%normal)
{
%player = %obj.client.player;
if (%col.getClassName() !$= "StaticShape" && %col.getClassName() !$= "Player" && %col.getClassName() !$= "AIPlayer")
return;
%colData = %col.getDataBlock();
%colDataClass = %colData.classname;
if (%col.getClassName() $= "Player" || %col.getClassName() $= "AIPlayer")
%col.damage(%obj,%pos,%this.directDamage,"RifleBullet");
}