Is there a way to automatically add a ship to a sobgroup when built? I want to put each ship into its own sobgroup. Thanks.
Custom code does this. Each ship will have its own sobgroup and you can execute functions on that sobgroup every n time period, on creation and on destruction
Which custom code? Do you have an example?
Check out the kushan drone frigate for example. The ship file has an
addcustomcode line. There is a file called
kus_dronefrigate.lua, which is the actual script.
Can the custom code and the gametype script talk with each other?
I haven’t checked, but I believe it does. At least in my CustomCode dump it is showing functions from multiple ‘addCustomCode’ files which, to me, would indicate they can.
To add, from my experience with the ‘addCustomCode’, even though the ‘create’ function does pass a CustomGroup, it is empty. If you are wanting to do something with the ship once it’ is built, you may need to do it in the ‘update’ function.
I will have to try this out. Thanks!