Here's my code (which runs after eventStartLevel):
Code: Select all
// we will need a sat uplink (in particular for subsequent tests to work)
var struct = enumStruct(me, SAT_UPLINK);
if (struct.length) {
struct = struct[0]; // get first uplink struct
} else { // need to make us a sat up link!
// id of sat uplink...
var satUplink = "A0Sat-linkCentre";
// find a truck
var truck = enumDroid(me, DROID_CONSTRUCT)[0];
hackNetOff();
// make sure sat uplink is enabled
enableStructure(satUplink, me);
// find place to put uplink
var pos = pickStructLocation(truck, SAT_UPLINK, truck.x, truck.y);
// place structure
addStructure(satUplink, me, pos.x, pos.y)
hackNetOn();
// get structure object
struct = enumStruct(me, SAT_UPLINK)[0];
}
pickStuctLocation() is returning a valid position for the uplink, so it looks like the code is failing when gets to addStructure() but I can't work out why
Any ideas?