Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: Shield piercing weapons: Are they possible?  (Read 1410 times)

Digganob

  • Lieutenant
  • **
  • Posts: 64
    • View Profile
Shield piercing weapons: Are they possible?
« on: August 22, 2022, 12:57:32 AM »

I am planning on making a mod which would involve a special missile weapon that can pierce shields, asking more experience modders (I have no experience myself), is such a mechanic possible to implement? Would it require any special programming a rookie like me wouldn't know how to do immediately?
Logged

Ruddygreat

  • Admiral
  • *****
  • Posts: 524
  • Seals :^)
    • View Profile
Re: Shield piercing weapons: Are they possible?
« Reply #1 on: August 22, 2022, 06:13:28 AM »

it does require programming but it's pretty easy (for a basic piercing effect), CombatEngineAPI.spawnEmpArcPierceShields() will summon an emp arc (like the ion beam or tachyon lance's) that pierces shields & deals damage centered around a nearby weapon / engine slot.

Alternatively (and much more complicatedly), you could use CombatEngineAPI.applyDamage() & some fancy maths to deal damage in the "correct" place on the enemy ship's hull, given the current projectile's trajectory.

either way you'll need an onHitEffect for your new weapon, the vanilla game has some simple examples that you can draw on for setting that up.

Digganob

  • Lieutenant
  • **
  • Posts: 64
    • View Profile
Re: Shield piercing weapons: Are they possible?
« Reply #2 on: August 22, 2022, 09:45:25 PM »

it does require programming but it's pretty easy (for a basic piercing effect), CombatEngineAPI.spawnEmpArcPierceShields() will summon an emp arc (like the ion beam or tachyon lance's) that pierces shields & deals damage centered around a nearby weapon / engine slot.

Alternatively (and much more complicatedly), you could use CombatEngineAPI.applyDamage() & some fancy maths to deal damage in the "correct" place on the enemy ship's hull, given the current projectile's trajectory.

either way you'll need an onHitEffect for your new weapon, the vanilla game has some simple examples that you can draw on for setting that up.

Sounds like I could make a missile that practically pierces shields, but could I make one that actually looks like it pierces? Like, it just goes over the shield the same way a fighter does, but hits the hull?
Logged

Amoebka

  • Admiral
  • *****
  • Posts: 1330
    • View Profile
Re: Shield piercing weapons: Are they possible?
« Reply #3 on: August 23, 2022, 12:03:15 AM »

One dirty way to do that is to run an every frame script that checks if the missile will collide with something shielded on its next frame. If it does, change its collision type to NONE and make it explode after N frames, where you calculate N based on the shield radius. You will have to decide how to handle glancing hits, where the missile would have connected with the shield, but not the ship behind it.
Logged

Digganob

  • Lieutenant
  • **
  • Posts: 64
    • View Profile
Re: Shield piercing weapons: Are they possible?
« Reply #4 on: August 23, 2022, 04:19:13 PM »

One dirty way to do that is to run an every frame script that checks if the missile will collide with something shielded on its next frame. If it does, change its collision type to NONE and make it explode after N frames, where you calculate N based on the shield radius. You will have to decide how to handle glancing hits, where the missile would have connected with the shield, but not the ship behind it.

My, that does sound quite dirty. If I don't find a better way to do it, I think I'll just have to have an on-hit effect that applies to ship hull even if it hits the shields, as the first guy said. It might look odd but I suppose it would work for my purposes. Though, thank you for the suggestion, I might be able to work out something good from doing it that way.
Logged

StargazerRJL

  • Ensign
  • *
  • Posts: 33
    • View Profile
    • My artwork website
Re: Shield piercing weapons: Are they possible?
« Reply #5 on: August 28, 2023, 03:14:13 AM »

Has anyone found a nice clean way to do this? I would love to make this possible for my Halo mod.
Logged

Mephansteras

  • Commander
  • ***
  • Posts: 102
    • View Profile
Re: Shield piercing weapons: Are they possible?
« Reply #6 on: August 28, 2023, 02:59:07 PM »

Check out the StarFed mod. I'm pretty sure it's got some missiles in it that pierce shields. Especially since it's based off of FTL, where missiles piercing shields is one of their big advantages. It also has beams that pierce shields, if I recall.

I just checked and it does have the source for its systems just included with the mod, so you should be able to go in and see how it was done there.
Logged

Wyvern

  • Admiral
  • *****
  • Posts: 3803
    • View Profile
Re: Shield piercing weapons: Are they possible?
« Reply #7 on: August 28, 2023, 03:02:47 PM »

There's also a shield-piercing projectile as a built-in weapon the Shadowyards mod's Mimir-class battlecruiser.
Logged
Wyvern is 100% correct about the math.

float

  • Captain
  • ****
  • Posts: 275
    • View Profile
Re: Shield piercing weapons: Are they possible?
« Reply #8 on: August 28, 2023, 04:06:51 PM »

You could also take the “reinventing the wheel” approach, setting your projectiles’ collision class to NONE and writing your own ray (or circle if the projectile is slow enough) collision function.
Logged