Thargoid wrote:The AI command fireMissile (with a suitable target set first), or indeed the equivalent function (with brackets) in JS, is your friend (or black cat) here...
As thargoids says you must explicit fire the missiles in your script, or oolite will decide for you. However just using the AI command
fireMissile
might give unwanted results for you as oolite will use random missiles in 10% of the cases.
To get full controll define in shipdata:
that way the ship will be initialized without any missiles. Than in the AI fire a missile with:
Than in the ship script of your ship (you have to add one) add the lines:
Code: Select all
this.$fireMissile = function ()
{
this.ship.awardEquipment("EQ_griff_pumpkin_missile");
this.ship.fireMissile();
}
That will guarantee that only this missile is loaded and than immediately fired. So your bay is empty again and oolites internal code will never be able to fire one unexpected. This code will supply an unlimited amount of missiles as you requested. When you want a limit, just add a counter in above function like:
Code: Select all
this.missiles = 6;
this.$fireMissile = function ()
{
if (this.missiles > 0)
{
this.ship.awardEquipment("EQ_griff_pumpkin_missile");
this.ship.fireMissile();
this.missiles--;
}
}