Need help building a pylon system like ARMA 3 Jets

Use inheritance.

  • base class knows how to enable sim and detach
  • various attachables of mass destruction inherit from it
  • the array is of base class and can contain any attachable

Or use an interface:

  • the array is of Actor type and we do not care about the above at all

But, first things first - classes:

MK82 to a Missile because the array I add each new actor to is for MK82s

What’s the difference between the MK82 and MK82s? They should only be separate classes if the functionality differs a lot. If it’s just some stats and a mesh, then I’d keep it a single class and change the data - stats, sounds, mesh, icon and whatnot.

A fuel tank and a GAU-8/A should probably be separate classes since they differ quite a bit in their functionality. But they can still both inherit from some Generic Attachable Base Class that holds onto shared variables and functions (being damaged, reporting status, detaching, basic stats like weight, air resistance, cost).

This way you script the shared stuff only once, any class extending from it already knows how to do it.

1 Like