Author Topic: [RELEASE] Mission-wide ship variant manager v1.0  (Read 423 times)

0 Members and 1 Guest are viewing this topic.

[RELEASE] Mission-wide ship variant manager v1.0
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.lua

Put shipVariantMissionWide.lua in data/scripts.

In data/tables/init-sct.tbm, under #Conditional Hooks:
Code: [Select]
$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:
Code: [Select]
#Serkr

$Name: Marcus Glaive
$Variant: Serkr

$Name: Hydra
$Variant: Serkr

$Name: Pilum
$Variant: Serkr

#End

In FRED, for missions that use Serkr Team:
Code: [Select]
( 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:
Code: [Select]
#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).