Xenolith Here's my targeting laser from UltraXL, converted to a grapple-like thingy. I even will leave the commented out code from debugging and when I was experimenting with acceleration and gravity, making it more, "realistic". Even though it was more realistic, it wasn't any fun, so it was ditched. If you use this code without giving me credit, I won't sue you, I'll just beat the crap out of you. Code: -------------------------------------------------------------------------------- function TargetingLaserImage::onFire(%data,%obj,%slot) { // %p = Parent::onFire(%data, %obj, %slot); // %p.setTarget(%obj.team); if (%obj.holdingFlag) return; %energy = %obj.getEnergyLevel(); // echo("%energy = " @ %energy); %muzzlePos = %obj.getMuzzlePoint(%slot); %muzzleVec = %obj.getMuzzleVector(%slot); //echo("projectile distance " @ %data.projectile.maxRifleRange); %beamtime = 400; %endPos = VectorAdd(%muzzlePos, VectorScale(%muzzleVec, %data.projectile.maxRifleRange)); // echo("%obj.client.heatSignature = " @ %obj.client.heatSignature); %SearchMask = $TypeMasks::SensorObjectType | $TypeMasks::InteriorObjectType | $TypeMasks::ForceFieldObjectType | $TypeMasks::StaticObjectType | $TypeMasks::MoveableObjectType | $TypeMasks::DamagableItemObjectType | $TypeMasks::TerrainObjectType; // did I miss anything? players, vehicles, stations, gens, sensors, turrets %hit = ContainerRayCast(%muzzlePos, %endPos, %SearchMask, %obj); %noDisplay = true; if (%hit !$= "0") { %clientID = %obj.client; if (%obj.client.beamer == 0 && %energy > 15) { %obj.client.beamer = 1; messageClient(%obj.getOwnerClient(), 'MsgBeamerStatus', '~wfx/weapons/cg_hard3.wav'); %obj.setEnergyLevel(%energy - 15); beamerOn(%data, %obj, %hit, %slot); } else { %obj.client.beamer = 0; if(isObject(%obj.beamproj)) %obj.beamproj.schedule(%beamtime, "delete"); // if (isObject(%obj.lastProjectile)) // { // %obj.lastProjectile.delete(); // %obj.lastProjectile = ""; // } messageClient(%obj.getOwnerClient(), 'MsgBeamerStatus', '~wfx/weapons/ELF_underwater.wav'); } // echo("hitpos = " @ %hitpos); // echo("obj.position = " @ %obj.position); } } function beamerOn(%data, %obj, %hit, %slot) { %beamtime = 400; if(isObject(%obj.beamproj)) %obj.beamproj.schedule(%beamtime, "delete"); // if (isObject(%obj.lastProjectile)) // { // %obj.lastProjectile.delete(); // %obj.lastProjectile = ""; // } // %clientID = %obj.client; if (%obj.client.beamer != 1) return; %obj.setHeat(1.0); //max out the heat signature %hitobj = getWord(%hit, 0); %hitpos = getWord(%hit, 1) @ " " @ getWord(%hit, 2) @ " " @ getWord(%hit, 3); %xhit = getword(%hitpos, 0); %yhit = getword(%hitpos, 1); %zhit = getword(%hitpos, 2); %xobj = getword(%obj.position, 0); %yobj = getword(%obj.position, 1); %zobj = getword(%obj.position, 2); %x = %xhit - %xobj; %y = %yhit - %yobj; %z = %zhit - %zobj; %displacement = %x @ " " @ %y @ " " @ %z; // %hitpos = %x @ " " @ %y @ " " @ %z; // echo("displacement1 = " @ %displacement); %x = getword(%displacement, 0); %y = getword(%displacement, 1); %z = getword(%displacement, 2); %distance = mSqrt(%x * %x + %y * %y + %z * %z); %x = %x / %distance; %y = %y / %distance; %z = %z / %distance; %displacement = %x @ " " @ %y @ " " @ %z; if (%distance < 5 || %obj.client.beamer == 0) { %obj.client.beamer = 0; messageClient(%obj.getOwnerClient(), 'MsgBeamerStatus', '~wfx/weapons/ELF_underwater.wav'); if(isObject(%obj.beamproj)) %obj.beamproj.schedule(%beamtime, "delete"); // if (isObject(%obj.lastProjectile)) // { // %obj.lastProjectile.delete(); // %obj.lastProjectile = ""; // } %velocity = VectorScale(%displacement, 5); %obj.setVelocity(%velocity); return; } // %velocity = %obj.getVelocity(); // %acceleration = VectorScale(%displacement, 20); // this defines the magnitude of the acceleration // echo("%acceleration = " @ %acceleration); // %velocity = VectorAdd(%velocity, %acceleration); %z = %z + 0.25; %fix = %x @ " " @ %y @ " " @ %z; if (%distance < 55) %velocity = VectorScale(%fix, (%distance * 2)); else %velocity = VectorScale(%fix, 110); //was 500 %obj.setVelocity(%velocity); // echo("velocity = " @ %velocity); // %velocity = VectorScale(%obj.getVelocity(), 4); // %x = getword(%velocity, 0); // %y = getword(%velocity, 1); // %z = getword(%velocity, 2); // if(mSqrt(%x * %x + %y * %y + %z * %z) > 300) // %velocity = VectorScale(VectorNormalize(%velocity), 300); %muzzlePos = %obj.getMuzzlePoint(%slot); //Below is some code I should try //%VectorBetween = VectorSub(%Position1, %Position2); //%Length = VectorLen(%VectorBetween); //%data.Projectile.maxRifleRange = %Length; // %Projectile = new TargetProjectile() %obj.beamproj = new (%data.projectileType)() { dataBlock = %data.projectile; initialDirection = %displacement; initialPosition = %muzzlePos; // sourceObject = %obj; damageFactor = 0; sourceSlot = 0; //%slot fadeTime = %beamtime; }; // %obj.lastProjectile = %p; MissionCleanup.add(%obj.beamproj); // %this.ELFrecur = %this.schedule(32, checkELFStatus, %data, %target, %targeter); schedule(%beamtime,0,"beamerOn",%data,%obj,%hit,%slot); }