Ramirez wrote:What happens if the missile is launched at a non-thargoid? Would it intercept and detonate as usual?
I'm mindful that these multiple warheads are fun to use but being on the receiving end ....
Ahrumans code anticipated on that. When no new targets is uses the one it was fired on. It just needs one aditional fix:
"targets = [this.target]" should be "targets = [this.ship.target]"
I know this problem, code copied from one place must sometimes be altered to work on other places because the references change.
-----
Coming back on my original AI code.:
I added a logging for missile launch in the player script and also one in the missile script. This way every launch should be logged twice.
player:
Code: Select all
this.shipAttackedWithMissile = function(missile, whom)
{
log(this.name, "Missile nr. "+ missile.ID+ " is launched by: "+whom.shipDisplayName)
}
Missile:
Code: Select all
this.shipSpawned = function()
{
if(this.ship.target == player) {this.player=true; log(this.name, "Missile nr. "+this.ship.ID+ " is launched by: "+this.ship.owner.shipDisplayName)}
else this.player=false
}
this.shipDied = function(who, why)
{
if(this.player) log(this.name, "Missile nr. "+this.ship.ID+ " fired by: "+this.ship.owner.shipDisplayName+ " killed by "+who.shipDisplayName+" by means of "+why);
}
this.shipCollided = function(who)
{
if(this.player) log(this.name, "Missile nr. "+this.ship.ID+ " fired by: "+this.ship.owner.shipDisplayName+" collided with: "+who.shipDisplayName+" remaining energy: "+this.ship.energy)
}
this.shipLostTarget = function()
{
if(this.player) log(this.name, "Missile nr. "+this.ship.ID+ " lost the target")
}
In most cases I see double entries in the log. The missile script also logs death and collision. (death by ECM is currently not logged). However, sometimes the log is wrong:
Code: Select all
[player] : Missile nr. 495 is launched by: Falcon-S
[player] : Missile nr. 496 is launched by: Falcon-S
[missile] : Missile nr. 495 is launched by: Falcon-S
[player] : Missile nr. 496 is launched by: Falcon-S
[player] : Missile nr. 497 is launched by: Falcon-S
[missile] : Missile nr. 496 is launched by: Falcon-S
Not all missiles that are created according to the player log have a log by the ship-script. This means they are already des-integrated before the ship script gets active. Changing the AI wont help for these missiles as the AI never gets a chance to run.