Flak Turrets implementation
-
Wow Why, that is pretty ace stuff. Who was that with you? I take it none of the server lag issues were really worked out? lol
Also, I really need to try out some of you and KJ’s Cap Ship work. I might as well start working it into RC122, since I want to wait for M0tah to finalize his next Hook build before release.
I’m waiting for you and M0tah of great mod long long time. ;D
-
Wow Why, that is pretty ace stuff. Who was that with you? I take it none of the server lag issues were really worked out? lol
Also, I really need to try out some of you and KJ’s Cap Ship work. I might as well start working it into RC122, since I want to wait for M0tah to finalize his next Hook build before release.
I’m not sure what did it, but I haven’t had any problem at all with the flak exploding the barrels anymore. I’m pretty sure it had to do with setting the missiles to dumbfire, also giving their turret turn speed a really high value helped some as well. I’ve been testing on the KJs server the whole time. He was the other pilot.
-
@w0dk4, I’m monkeying about with the flak cannons using your code up there but I’m finding that a lot of the ‘bullets’ are exploding as soon as they leave the barrel. Should I be increasing the lifetime a bit?
R
Try increasing the hit points of the actual ammunition (its 2) to 2000 or something, this way the bullets dont destroy themselve
-
As a believer in open source material, here is the source code for my flak guns. Highlighted are the important bits.
[Motor]
nickname = li_battleship_flak_turret01_motor
lifetime = 1
accel = 500
delay = 0[Explosion]
nickname = li_battleship_flak_turret01_explosion
effect = explosion_super_flak
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 ;so that flak doesnt kill itself
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
;type = LOOT[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 ;LEquip
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_9
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 -
@ w0dk4 and Why485. May I have permission to add your effects and some of your code into my mod as well?
Thanks,
RoboOh, and while I’m awaiting permissions, I’m testing as a learning experience. This is my code so far:
<data file="data\equipment\weapon_equip.ini" method="sectionreplace" options="1:0, 1:1">[Motor] nickname = li_battleship_flak_turret01_motor <dest>lifetime = 1 accel = 166.666702</dest> <source> lifetime = 0.100000 accel = 10000</data> <data file="data\equipment\weapon_equip.ini" method="sectionreplace" options="1:0, 1:1">[Explosion] nickname = li_battleship_flak_turret01_explosion <dest>effect = gf_explosion_super_flak lifetime = 0.000000, 0.000000 process = disappear strength = 100 radius = 16 hull_damage = 81.500000 energy_damage = 0 impulse = 0</dest> <source> effect = flu_flakcannon01_impact lifetime = 0.000000, 0.000000 process = disappear strength = 80 radius = 250 hull_damage = 1000 energy_damage = 500 impulse = 1800</data> <data file="data\equipment\weapon_equip.ini" method="sectionreplace" options="1:0, 1:1">[Munition] nickname = li_battleship_flak_turret01_ammo <dest>hit_pts = 2 one_shot_sound = fire_capship detonation_dist = 4 lifetime = 5 Motor = li_battleship_flak_turret01_motor force_gun_ori = false const_effect = li_flakcannon01_proj HP_trail_parent = HPExhaust seeker = DUMB DA_archetype = equipment\models\weapons\li_rad_missile.3db material_library = equipment\models\li_equip.mat mass = 1 volume = 0.000100</dest> <source> hit_pts = 2000 one_shot_sound = fire_capship detonation_dist = 100 lifetime = 0.900000 Motor = li_battleship_flak_turret01_motor force_gun_ori = false const_effect = sp_doomsday_03_proj HP_trail_parent = HPExhaust seeker = DUMB time_to_lock = 0 DA_archetype = equipment\models\weapons\li_rad_missile.3db material_library = equipment\models\li_equip.mat mass = 1 volume = 0.0 ids_name = 1 ids_info = 1</data> <data file="data\equipment\weapon_equip.ini" method="sectionreplace" options="1:0, 1:1">[Gun] nickname = li_battleship_flak_turret01 <dest>hit_pts = 4800 explosion_resistance = 1.000000 debris_type = debris_turret_small parent_impulse = 20 child_impulse = 80 volume = 50.000000 mass = 10 damage_per_fire = 0 power_usage = 0 refire_delay = 0.500000 muzzle_velocity = 83.300003 toughness = 1.600000 flash_particle_name = li_flakcannon01_flash flash_radius = 15 light_anim = l_gun01_flash projectile_archetype = li_battleship_flak_turret01_ammo separation_explosion = sever_debris auto_turret = true turn_rate = 90</dest> <source> hit_pts = 69500 explosion_resistance = 1.000000 debris_type = debris_turret_small parent_impulse = 20 child_impulse = 80 volume = 0.000000 mass = 10 damage_per_fire = 0 power_usage = 0 refire_delay = 0.250000 muzzle_velocity = 1 toughness = 10.600000 flash_particle_name = rtc_nomad_torpedo_flash flash_radius = 35 light_anim = l_gun01_flash projectile_archetype = li_battleship_flak_turret01_ammo separation_explosion = sever_debris auto_turret = true turn_rate = 270 dispersion_angle = 18 hp_gun_type = hp_turret_special_10</data> <data file="data\FX\WEAPONS\weapons_ale.ini" method="append" options="1:0, 1:1"><source> [VisEffect] nickname = gf_explosion_super_flak ;created by Why485, modded by w0dk4 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</data> <data file="data\FX\effects.ini" method="append" options="1:0, 1:1"><source> [Effect] nickname = gf_explosion_super_flak effect_type = EFT_WEAPON_IMPACT vis_effect = gf_explosion_super_flak</data>
I downloaded the effects file at the link you gave w0dk4, renamed the extension from *.tale to *.ale (was I supposed to do that?), and put the file in the FX\EXPLOSIONS directory.
The problem I’m seeing so far is that the effect just isn’t working. Do I need to do something else that I’ve missed? -
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