Flak Turrets implementation
-
Freelancer is very, very picky with anything effects related. As such, when I code effects I try to keep the structure, formatting, and placement as similar to the vanilla files as possible. One such example is the way my flak effect is coded into the game.
The way you have the effect setup is something akin to a muzzle flash or bullet effect. This was not what the effect was based on, and I believe something hard-coded in Freelancer is causing this difference to shut down the effect. My effect was based on the Patriot’s explosion effect, and as such it is setup exactly the same way as the Patriot explosion, except for the names and crc being different.
This is all the code that I used in order to get my flak explosions to work in the FX folder.
\DATA\FX\effects_explosion.ini
[Effect]
nickname = explosion_super_flak
effect_type = EFT_EXPLOSION_SHIP
vis_effect = gf_explosion_super_flak
;snd_effect = med_explosion1
snd_effect = flak_explosion_sound
lgt_effect = elite_flash_to_red
lgt_range_scale = 30
lgt_radius = 30\DATA\FX\EXPLOSIONS\explosions_ale.ini
[VisEffect]
nickname = gf_explosion_super_flak
alchemy = fx\explosions\gf_explosion_super_flak.ale
effect_crc = 290209852
textures = fx\sarma.txm
textures = fx\lightbeam.txm
textures = fx\standardeffects.txm
textures = fx\kioncannon.txm -
I’ll give that a try. Thanks.
Also, I notice the Munition still used the explosion_arch = li_battleship_flak_turret01_explosion. This has no bearing on the actual effect I presume?
R
-
Well, it’s working. Mostly…
Occasionally I see the projectiles leave the barrels and then just hover right next to the barrel before exploding. This of course does damage to my own ship/guns.
I’ve been using w0dk4s settings for the most part. I’m going to try Why’s settings next.
Also, from time to time, the turrets lock in forward firing mode regardless of which way the point of aim is facing. I can be in turret mode and see the guns pointing in an alternate direction, but the projectiles all fire forward. This is with no target selected as well.
With turn_rate = 270, I even had an experience a couple of times where the turrets would auto-rotate 180 degrees opposite of the way I was aiming. Currently I’m using turn_rate = 120 and that seems to be working ok.
Any input appreciated.
R
-
Oh and I re-checked my code on the server, the lifetime actually is 0.9. One of the main problems is also tuning the explosion radius and the refire delay so that there is no chain reaction.
Are you speaking of the lifetime of the [Motor], or that of the [Munition]?
Either way, I get occasional ‘hiccups’ where the projectile stays right outside the barrel for a second or so before it explodes right on top of me. I’d say it happens about once every 6 shots or so. Then there will be times where it will be every shot. -
-
Yeah, I’m using your code and finding the problems fixed. Thanks much.
Do you remember the formula offhand on how to figure out range of missiles? I know the muzzle velocity, lifetime of the motor, and the lifetime of the munition all factor in, but I don’t remember the details.
R
-
Well, classical physics should work fine normally
RANGE = MUZZLE_VELOCITY * LIFETIME + (ACCELERATION * MOTOR_LIFETIME ^ 2) / 2 + (MUZZLE_VELOCITY + ACCELERATION * MOTOR_LIFETIME) * (LIFETIME - MOTOR_LIFETIME)
That should work, although it may be possible to simplify it a bit ;D
-
I don’t know why, but i don’t get this effect to work. I wanted to modify the Battleship Flaks already implemented in the discovery mod, because they aren’t realy flakguns in my eyes. So i placed the gf_explosion_super_flak.ale in the fx/explosions folder and modified the entry in weapon_equip:
[Motor] nickname = li_battleship_flak_turret01_motor lifetime = 1 accel = 500 delay = 0 [Explosion] nickname = li_battleship_flak_turret01_explosion effect = li_flakcannon01_impact lifetime = 0.000000, 0.000000 process = disappear strength = 0 radius = 250 hull_damage = 750 energy_damage = 0 impulse = 50 [Munition] nickname = li_battleship_flak_turret01_ammo ids_name = 263383 explosion_arch = li_battleship_flak_turret01_explosion hp_type = hp_gun requires_ammo = false hit_pts = 1000000 one_shot_sound = null detonation_dist = 75 lifetime = 1 Motor = li_battleship_flak_turret01_motor force_gun_ori = false const_effect = li_flakcannon01_proj HP_trail_parent = HPExhaust seeker = DUMB time_to_lock = 0 DA_archetype = equipment\models\torpedoes\ge_torpedo.3db material_library = equipment\models\ge_equip.mat mass = 200 volume = 0.000100 [Gun] nickname = li_battleship_flak_turret01 ids_name = 263383 ids_info = 264383 DA_archetype = equipment\models\turret\li_turret04.cmp material_library = equipment\models\li_turret.mat HP_child = HPConnect hit_pts = 25000 explosion_resistance = 0.1 debris_type = debris_turret_small parent_impulse = 0 child_impulse = 0 volume = 16.000000 mass = 10 hp_gun_type = hp_turret_special_10 damage_per_fire = 0 power_usage = 170 refire_delay = 0.5 muzzle_velocity = 500 toughness = 10 light_anim = l_gun01_flash projectile_archetype = li_battleship_flak_turret01_ammo separation_explosion = sever_debris auto_turret = true turn_rate = 1000 lootable = true dispersion_angle = 18
the effects_explosion:
[Effect] nickname = li_flakcannon01_impact effect_type = EFT_EXPLOSION_SHIP vis_effect = gf_explosion_super_flak ;snd_effect = med_explosion1 snd_effect = flak_explosion_sound lgt_effect = elite_flash_to_red lgt_range_scale = 30 lgt_radius = 30
and the explosions_ale
[VisEffect] nickname = gf_explosion_super_flak alchemy = fx\explosions\gf_explosion_super_flak.ale effect_crc = 290209852 textures = fx\sarma.txm textures = fx\lightbeam.txm textures = fx\standardeffects.txm textures = fx\kioncannon.txm
The weapon has the new values, but the effect is just one small explosion, like it was before.
-
Might want to try
dispersion_angle = ……
and maybe
DA_archetype = equipment\models\weapons\br_auto_shotgun.cmp
material_library = equipment\models\br_equip.matwhich will give you a gun with 5 HpFire.
-
-
…… i suppose both (archetype + dispersion) have 2 be on the client
and should be on the server 2.Hit detection is usually done on the client (w0dk4 is the man 2 ask )
and dispersion effects that.It’s a funny thing 4 ‘2nd hand weapons’ ;D
and 2.5 make it hard 2 hit anything.