The intention is to label a non-player ship with a beacon, which he's doing with
Code: Select all
var beacon = system.addShips("x__beacon",1,x_ship.position,50);
beacon.primaryRole = "x__beacon"; //set explicitly; is this necessary?
beacon.position = x_ship.position.add(x_ship.heading.multiply(x_ship.collisionRadius+1)); //shift the beacon outside the target's collision zone
log(this.name, "x_spawnBeacon spawned beacon for " + x_ship.displayName);
beacon.target = x_ship;
log(this.name, "x_spawnBeacon assigned a target to it of " + beacon.target);
- 16:14:17.027 [x_Loc]: x_spawnBeacon spawned beacon for Chopped Cobra
16:14:17.027 [x_Loc]: x_spawnBeacon assigned a target to it of [Ship "Chopped Cobra" position: (5609.6, 11493.7, 20624.9) scanClass: CLASS_CARGO status: STATUS_IN_FLIGHT]
Code: Select all
var beacons = system.shipsWithPrimaryRole("x__beacon");
Surely the beacon ought to remember its target for eight seconds? Any insights gratefully accepted!
Jonathan
EDIT: OK, I've seen it. system.addShips() returns *an array*, so the target assignment is going astray: it should be beacon[0].target = x_ship;
I'll leave this post here as a memorial to the invisibility of the obvious... with hindsight!