Greeting, fellow modders
The final part of my ship variant framework is a script capable of assigning a variant to any number of ships in a mission with a single lua call. The script relies on the ship variant infrastructure, as well as another config table which specifies which variant is used by which ships within a certain number of categories. The ships are grouped by table category.
Source code is available
here.
How to use it:REQUIRES parse.lua and shipVariant.luaPut
shipVariantMissionWide.lua in data/scripts.
In data/tables/init-sct.tbm, under
#Conditional Hooks:
$On Game Init: [[shipVariantMissionWide.lua]]
Let's say you have a bunch of recurring baddies called 'Serkr Team'. You've made Serkr variants for each of their ship classes in
ship_variants.tbl, so now you'll want to add these to you mission-wide variant table:
In data/config/ship_variants_mission_wide.tbl:
#Serkr
$Name: Marcus Glaive
$Variant: Serkr
$Name: Hydra
$Variant: Serkr
$Name: Pilum
$Variant: Serkr
#End
In FRED, for missions that use Serkr Team:
( script-eval-block
"setShipVariants("
"'Serkr')"
)
You can also assign a variant to a "wing" of ships by adding the
+Wing: + a number sub-attribute to the
$Variant: attribute, the script will then assign the variant to every ship bearing the same name + a number, for instance:
#Mission 10-hard
; assigns the "Morning-Maxim" variant to sentry guns 1 through 12
$Name: Sentry Gun
$Variant: Morning-Maxim
+Wing: 12
#End
#Mission 10-easy
; assigns the "PromR-Subach" variant to sentry guns 1 through 8
$Name: Sentry Gun
$Variant: PromR-Subach
+Wing: 8
#End
I am open to suggestions, remarks, questions regarding both this script and the way it is presented in this thread
(in other words: I'm not sure if I'm explaining things properly here).