Thargoid, thanks for that info - it almost works as I want. Funny thing is, this is very close to my initial code, which looked like this:Thargoid wrote:
So the simplest way is to take your initial script, and adjust it to
whereCode: Select all
this.shipDied = function(whom, why) { if (Math.random() > 0.77) { this.ship.spawn("energy-bomb",1); }
energy-bomb
is one of the roles of the trunk q-bomb. Use that function definition to replace the one in your first script, keeping the header information (this.name etc) from your code above.[/color]
Code: Select all
this.shipDied = function(whom, why) {
if (Math.random() > 0.77) {
system.addShips("energy-bomb", 1, this.ship.position, 0);
}
As I said, your code worked almost perfectly, but there a two minor drawbacks that I don't know how to resolve:
- the q-bomb is spawned near the last position of the Star Destroyer, but not near enough to look like it's the explosion from the Star Destroyer.
- Now that I write these lines I think it might be that the Q-Mine got drifted away by the shockwave of the exploding Star Destroyer? If this is the cause, is there a way I can prevent this?
- I can't set the time after which the Q-Bomb should spawn. For my purpose, that's no big deal, because the preset countdown of the Q-Bomb pretty much matches the time that I would have set anyway... but just out of curiosity, would it be possible to spawn the bomb after, let's say 5 seconds?
Hey, who just called me a dishonorable coward?!?