FreeSpace Releases > Scripting Releases
[RELEASE] Mission-wide ship variant manager v1.0
(1/1)
X3N0-Life-Form:
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: ---$On Game Init: [[shipVariantMissionWide.lua]]
--- End code ---
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: ---#Serkr
$Name: Marcus Glaive
$Variant: Serkr
$Name: Hydra
$Variant: Serkr
$Name: Pilum
$Variant: Serkr
#End
--- End code ---
In FRED, for missions that use Serkr Team:
--- Code: ---( script-eval-block
"setShipVariants("
"'Serkr')"
)
--- End code ---
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: ---#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
--- End code ---
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).
Navigation
[0] Message Index
Go to full version