where zloc is defined a couple of lines up the script. This worked under 1.71.2, but under 1.72 I get the following warning in the debug console
Warning: The ability to pass three numbers instead of a vector is deprecated and will be removed in a future version of Oolite. Use an array literal instead (for instance, replace v.add(1, 2, z) with v.add([1, 2, z]).
Active script: "aquatics_systemSetUp" 0.1
aquatics_systemSetUp.js, line 23:
system.legacy_addShipsWithinRadius("aquatics_pHauler", 1, "wpu", 0, 0, zloc, 10000);
However if I try and add square brackets around the 0, 0, zloc part I get the following log error (and no spawned ship):
[script.addShips.failed]: SCRIPT ERROR in <anonymous actions> ***** CANNOT 'addShipsWithinRadius: aquatics_pHauler 1 wpu 0.000000 0.000000 0.150052 10000.000000' (should be 'addShipsWithinRadius: role number coordinate_system x y z r')
So I've got a warning telling me one thing, and then an error telling me no, go back to how you were
It does, I can spawn it "manually" via the console (using player.ship.spawn), and as I said it used to work under 1.71.2 (although it is using a template-style "mother-entity", will have to confirm it's not a weird incarnation of the is_template issue, although I don't think I used that in this script).
I'll try the this.zloc idea when I get chance and see if that helps, it's a good idea. Weird one though.
McLane is right, it is a wrong role you are using. All other thing I see are correct. I spawned a ship without problems or errors, but when I used a fake role I got:
Oolite [script.addShips.failed] -[PlayerEntity(Scripting) addShipsWithinRadius:] (PlayerEntityLegacyScriptEngine.m:1644): SCRIPT ERROR in <anonymous actions> ***** CANNOT 'addShipsWithinRadius: leviathan-pirates 1 wsp 0.000000 0.000000 1.000000 5000.000000' (should be 'addShipsWithinRadius: role number coordinate_system x y z r')
In this case the error report is not helping to much.
The shipdata.plist is below. The ship entries you want are towards the bottom, the ones above are the sub-entities and template ships.
Basically there are two new haulers (the Orca and the HammerHead), and two variants on each, prefixed p and w. These have their destinations as either the planet (main station) or witchpoint respectively (different AIs).
The second role in each is the aquatics_wHauler or aquatics_pHauler role. Or does addWithinRadius in 1.72 now only work with primary roles, in contrast to 1.71.2 which was any listed role? And if the roles are wrong, why does the ship actually spawn in the first version in my original post (the one that gives the JS console warning)? I'm something of a confused alien this afternoon...
And if this doesn't help, please try to remove (comment out) the subents and escorts and try again.
And if you still have the problem avoid like_ship at all. Oolites shipdata only uses this key for asteroids and wrecks - I think Ahruman knows why - maybe like_ship doesn't take all keys from the 'template'?
To be honest, from the trials I've done elsewhere (for Missile Rack), the is_template key seems to be broken somewhere and stops anything appearing (as Griff also found iirc from the thread on this topic), so I'm avoiding using it at all anywhere unless I have to.
This OXP is giving me grief anyway (I can't get the models to look right in-game), so I keep getting distracted by other thoughts and OXPs anyway. It just seemed a very strange pair of warnings/errors to get, as they were almost circular in what they instructed.
I'll give it some more play over the next few days though and see what comes of it, starting with your console suggestion I think.
Routinely pressed (these days I seem to always press it when starting up, but then I seem to script more than play these days), but not impossible that I let up too early or something.
Routinely pressed (these days I seem to always press it when starting up, but then I seem to script more than play these days), but not impossible that I let up too early or something.
I am sometimes also in doubt if I pressed it down fast enough. The key is checked quite early in starting up. But when in doubt I always look in the log file if it detected my shiftkey down.