finally upgraded my old rail effect, now it doesnt stutter as much
heres the script, save as scripting.tbl
#Global Hooks
$GameInit:
[
--effect vars
particle_tex = gr.loadTexture("2_laserglow03")
particle_life = 0.3
deg_per_particle = 5
rot_per_sec = 3
z_vel_factor = 0.08
r_vel_factor = 10
--globals
pih = math.pi * 0.2
pi2 = math.pi * 2
]
$Simulation:
[
for i=1, #mn.Weapons do --loop weapons
if mn.Weapons[i].Class.Name == "Railgun" then --if the weapon is one of these
if mn.Weapons[i]:isValid() and particle_tex:isValid() then --dont work with bad handles
local traillen = mn.Weapons[i].Class.Speed * ba.getFrametime() --distance covered per frame
local arcradis = pi2 * rot_per_sec * ba.getFrametime() --rotation covered per frame
local lifeleft = mn.Weapons[i].LifeLeft * pi2 * rot_per_sec --scale remaining life by rotations per second
for j=0, 1, deg_per_particle * 0.01745329 do
local part_rot = lifeleft + (arcradis * j)
local part_vel_x = math.sin(part_rot) * r_vel_factor
local part_vel_y = math.cos(part_rot) * r_vel_factor
local part_vel_z = mn.Weapons[i].Class.Speed * z_vel_factor
local part_vel = mn.Weapons[i].Orientation:unrotateVector(ba.createVector(part_vel_x,part_vel_y,part_vel_z))
local offset_v = mn.Weapons[i].Orientation:unrotateVector(ba.createVector(0,0,traillen * j))
ts.createParticle(mn.Weapons[i].Position - offset_v,part_vel,particle_life,1,PARTICLE_BITMAP,-1,false,particle_tex)
end
end
end
end
]
#End
and heres a sample tbm, save as railgun-wep.tbm
#Primary Weapons
$Name: Railgun
$Model File: none
@Laser Bitmap: newglo8
@Laser Glow: 2_laserglow03
@Laser Color: 69, 42, 172
@Laser Color2: 69, 42, 172
@Laser Length: 80
@Laser Head Radius: 2.5
@Laser Tail Radius: 5.0
$Mass: 0.08
$Velocity: 1200
$Fire Wait: 2.5
$Damage: 200
$Blast Force: 1500
$Inner Radius: 75
$Outer Radius: 150
$Shockwave Speed: 90
$Armor Factor: 1.3
$Shield Factor: 0.2
$Subsystem Factor: 1.0
$Lifetime: 1
$Energy Consumed: 1.0
$Cargo Size: 0.0
$Homing: NO
$LaunchSnd: 81
$ImpactSnd: 85
$Flags: ( "player allowed" "shudder" "stream")
$Icon: iconNewton
$Anim: Newton
$Impact Explosion: ExpMissileHit1
$Impact Explosion Radius: 75
#end
all the vars at the start of the script are tweakable for different weapons.
particle_tex = gr.loadTexture("2_laserglow03")
you can change what bitmap you want to use by sticking it in the quotes
particle_life = 0.3
how long particle will last
deg_per_particle = 5
number of degrees between particles, higher = faster, fewer particles, lower = slower, more particles, better effect.
rot_per_sec = 3
how many rotations per second, duh
z_vel_factor = 0.08
factor of weapons forward velocity at which particles will move forward
r_vel_factor = 10
the velocity at which the particles will radiate outward from the weapons z axis