EMP (and Leech) Bombers

A place for discussion of making game modifications.
Post Reply
User avatar
siyoa
Posts: 182
Joined: Fri Apr 21, 2017 3:19 pm

EMP (and Leech) Bombers

Post by siyoa »

sorry no time to make it work from Mods folder, this will add two new bomber types, one for delivering EMP Missiles, one for Leech Missiles ... if requested technology is not known, they will be equipped with best known missile tech

add this to WEAPONS.lua, I made them as fast and durable as Strike Fighters, and a bit cheaper (change as you please)

Code: Select all

define_weapon "EMP Bomber" {
  tier=2,
  motion_sound = 'FIGHTER_ENGINE_LOOP',
  launch_sound = 'FIGHTER_LAUNCHED_SINGLE',
  multi_launch_sound = 'FIGHTER_LAUNCHED_MULTI',
  type= "fighter",
  loadout = {type = 'emp_bombs', n=1},
  cant_attack_trackers=true,
  cost_mult=3,
  health = 30,
  speed=12,
  desc = "Small craft designed to deliver EMP warheads at point blank range.",
  fighter_drawers = {
    default = 'BladeBomber',
    Hawk='HawkBomber',
    Hammer='HammerBomber',
    Blade='BladeBomber',
    Manta='MantaBomber',
    Star='StarBomber',
    Box='BoxBomber',
	Hat='HawkBomber',
  }
}

define_weapon "Leech Bomber" {
  tier=2,
  motion_sound = 'FIGHTER_ENGINE_LOOP',
  launch_sound = 'FIGHTER_LAUNCHED_SINGLE',
  multi_launch_sound = 'FIGHTER_LAUNCHED_MULTI',
  type= "fighter",
  loadout = {type = 'leech_bombs', n=1},
  cant_attack_trackers=true,
  cost_mult=3,
  health = 30,
  speed=12,
  desc = "Small craft designed to deliver Leech warheads at point blank range.",
  fighter_drawers = {
    default = 'BladeBomber',
    Hawk='HawkBomber',
    Hammer='HammerBomber',
    Blade='BladeBomber',
    Manta='MantaBomber',
    Star='StarBomber',
    Box='BoxBomber',
	Hat='HawkBomber',
  }
}
then change function _G.get_fighter_weapon(craft_type,empire,target) from tech.lua to this

Code: Select all

function _G.get_fighter_weapon(craft_type,empire,target) 

  local _TRACE_INFO = craft_type
  local type in empire.part_info![craft_type]!.loadout!
  local alt_type

  if (type == 'energy_or_bombs') 
    if target
      if is_tracking_object(target)
        type='energy'
      else
        type='strike'
      end
    else
      type='bombs'
      alt_type='energy'
    end
  end
  
  if (type == 'emp_bombs')
    if (empire:known 'EMP Warhead')
	  return 'EMP Missiles'
	else
      type='bombs'	
	end
  end

  if (type == 'leech_bombs')
    if (empire:known 'Leech Warheads')
	  return 'Leech Missiles'
	else
      type='bombs'	
	end
  end

  local best_weapon = fighter_weapon_fun![type](empire:available_part_info()!)

  if alt_type
    return best_weapon,fighter_weapon_fun![alt_type](empire:available_part_info()!)
  end

  return best_weapon
end
now change tech 'Multirole Fighters' to unlock your new bombers (file ~TECHNOLOGY.lua)

Code: Select all

    --unlocks_parts='Strike Fighter',
    unlocks_parts={'Strike Fighter','EMP Bomber','Leech Bomber'},
Attachments
emp_leech_bombers.JPG
emp_leech_bombers.JPG (78.67 KiB) Viewed 34300 times
Last edited by siyoa on Thu May 07, 2020 3:36 pm, edited 1 time in total.
How did YOU get a key? All right, go in.
User avatar
siyoa
Posts: 182
Joined: Fri Apr 21, 2017 3:19 pm

Re: EMP (and Leech) Bombers

Post by siyoa »

Missileses sounds kind of cute, but if you don't like it, change local already_plural in file RACES.lua

Code: Select all

local already_plural = set(
	'ashdar',
  'imperials',
  'ashdar colonials',
  'nuclear missiles',
  'antimatter missiles',
  'fusion missiles',
  'emp missiles','leech missiles',
  'pell','wrem','spice mongers','ashdar haduir','ashdar teros',
  'algorians', 'enfi', 'lummox', 'scanvagers', 'tarib',

  'tanks','battle mechs','hover tanks',
  'pirate raiders', 'assault marines', 'marauder raiders',
	
	'harmonized',
  'the black broadswords',
  "irregulars")
How did YOU get a key? All right, go in.
zolobolo
Posts: 1544
Joined: Fri Nov 25, 2016 3:49 pm

Re: EMP (and Leech) Bombers

Post by zolobolo »

This is a very neat idea :)

Would love to see a weapon mod (same as Ac, Rf..) like this for bombers (any fighters if ion gets some unique effect at some point)

It would make a lot of sense to be able to select the payload for the bomber squadron right before deployement - though not sure if the engine allows for it as there is crrently no similar mechanic. From the AI side it sohuld als obe fairly simple to adjust to this as if the target has strong shields right before hte bombers are sent it usually makes sense to use Leach missiles and no sense to use EMP

Though now that I thin abouth it: think I never actually saw AI designs use EMP or Leach missiles :?
User avatar
siyoa
Posts: 182
Joined: Fri Apr 21, 2017 3:19 pm

Re: EMP (and Leech) Bombers

Post by siyoa »

zolobolo wrote:It would make a lot of sense to be able to select the payload for the bomber squadron right before deployement - though not sure if the engine allows for it as there is crrently no similar mechanic.
yeah, had the same idea when I was modding this ... and yes, currently there is no support for it in game engine

I might try to mod it in, before I retire computers for summer hobbies ... or it may just wait till about November
How did YOU get a key? All right, go in.
User avatar
siyoa
Posts: 182
Joined: Fri Apr 21, 2017 3:19 pm

Re: EMP (and Leech) Bombers

Post by siyoa »

ok, this is even more complicated than I anticipated :lol:

well, I created menu item for it ... that's a start :idea:
fighter_armaments.JPG
fighter_armaments.JPG (54.27 KiB) Viewed 33791 times
How did YOU get a key? All right, go in.
User avatar
siyoa
Posts: 182
Joined: Fri Apr 21, 2017 3:19 pm

Re: EMP (and Leech) Bombers

Post by siyoa »

so, the first approach was a bit complicated

also, loadout of fighter is tied to weapon parent_type, so ...

this approach will let you cycle through different fighter types before you engage in battle ... I will release modded file once I clean up my scripts, it works already as a proof of concept
role_specific_fighters.JPG
role_specific_fighters.JPG (139.6 KiB) Viewed 33669 times
How did YOU get a key? All right, go in.
User avatar
siyoa
Posts: 182
Joined: Fri Apr 21, 2017 3:19 pm

Re: EMP (and Leech) Bombers

Post by siyoa »

Multirole Fighters technology needs to be researched to unlock ability to assign role specific fighters (you need it anyway, to have access to EMP and Leech Bombers)

there is one thing, you can cheat by designing ship with 'Interceptors' and then switch fighter role to better fighters to lower ship building cost, at the moment I cannot do much about it ... in order not to cheat, you should put 'Strike Fighters' into Hangar when designing ship

changed it a bit, only Multirole Fighters are allowed to switch between (i.e. Strike Fighters, EMP Bombers, Leech Bombers), you can still cheat a bit when designing a ship as Strike Fighters are slightly more expensive ... I guess there is no purpose for ship to be designed with EMP Bombers, Leech Bombers as starting fighters, with this mod they now serve as role specific fighters, so their cost can be set the same as Strike Fighters and the whole problem is gone :idea:

Hangar #1 and #2 role specific fighter switching disabled due to ship being originally designed with Interceptors and Bombers in those
role_specific_fighters_02.JPG
role_specific_fighters_02.JPG (57.96 KiB) Viewed 33640 times
it is barely tested, let me know if things are not working properly
Attachments
ShipMidscreenPane.zip
(14.69 KiB) Downloaded 890 times
Last edited by siyoa on Thu May 07, 2020 4:06 pm, edited 2 times in total.
How did YOU get a key? All right, go in.
User avatar
siyoa
Posts: 182
Joined: Fri Apr 21, 2017 3:19 pm

Re: EMP (and Leech) Bombers

Post by siyoa »

I am wondering if it makes sense to do the same for missile launchers, they all tap into one generic source of munition, even when you equip ship with different missile types ... so in a way it would make sense
How did YOU get a key? All right, go in.
User avatar
siyoa
Posts: 182
Joined: Fri Apr 21, 2017 3:19 pm

Re: EMP (and Leech) Bombers

Post by siyoa »

there is cosmetic issue, changing missiles or torpedoes to different type doesn't update graphics

maybe Arioch or Sven can chime in, not enough time to dig through scripts to figure out how it works at the moment :|
role_specific_weapons.JPG
role_specific_weapons.JPG (120.26 KiB) Viewed 33468 times
Attachments
ShipMidscreenPane.zip
(15.13 KiB) Downloaded 873 times
How did YOU get a key? All right, go in.
zolobolo
Posts: 1544
Joined: Fri Nov 25, 2016 3:49 pm

Re: EMP (and Leech) Bombers

Post by zolobolo »

siyoa wrote:I am wondering if it makes sense to do the same for missile launchers, they all tap into one generic source of munition, even when you equip ship with different missile types ... so in a way it would make sense
Sounds reasonable yes
Makes missiles much more versitile thouhg wonder if torps are still a valid option next to them being able to drain shileds and systems faster
zolobolo
Posts: 1544
Joined: Fri Nov 25, 2016 3:49 pm

Re: EMP (and Leech) Bombers

Post by zolobolo »

Awesome solution! This mod I have to try!
Do you know how the AI is interacting with this mechanic?
User avatar
siyoa
Posts: 182
Joined: Fri Apr 21, 2017 3:19 pm

Re: EMP (and Leech) Bombers

Post by siyoa »

zolobolo wrote:Awesome solution! This mod I have to try!
let me know how you feel about it, it for sure introduces a lot of micromanagement to your fleet ... don't forget that you need to apply changes from the first (and if you want to fix plural for missiles, second) post
zolobolo wrote:Do you know how the AI is interacting with this mechanic?
well, they die quicker :twisted:

seriously though, AI can barely make a choice where to send a fleet as it is now, I can't imagine a code that would govern it properly to make a sound decision as to what weapon to select for particular upcoming fight, maybe if harpy eagle is around to write some scripts for us ... i sure have no capacity to do so, sorry

I think you'll find that fighters having ability to use EMP/Leech warheads is quite overpowered
How did YOU get a key? All right, go in.
zolobolo
Posts: 1544
Joined: Fri Nov 25, 2016 3:49 pm

Re: EMP (and Leech) Bombers

Post by zolobolo »

siyoa wrote:let me know how you feel about it
Tried testing it out on my existing game but didnt pop up even after researching Strike Fighters, maybe will see it out in the next new game
User avatar
siyoa
Posts: 182
Joined: Fri Apr 21, 2017 3:19 pm

Re: EMP (and Leech) Bombers

Post by siyoa »

zolobolo wrote: Tried testing it out on my existing game but didn't pop up even after researching Strike Fighters, maybe will see it out in the next new game
hmm, trying it in Mods folder ? I modified vanilla files
How did YOU get a key? All right, go in.
Post Reply