Capt. Murphy wrote:I think you'll need two scripts Mandoman. What you've posted definitely won't work as is.
1 worldscript that controls when the UFO will be spawned (by checking for Thargoid numbers on launching from the station or exiting witchspace), and another ship script that will control each UFO finding and targeting the nearest Thargoid ship, which is probably best done in combination with an interlinked unique AI.
Yeah, it didn't work, for sure. I opened up the script.js in the Z-Handler.oxp to get some examples, and I came up with this:
this.name = "UFOship Script"
this.author = "mandoman"
this.copyright = "(C) 2011 Me."
this.licence = "CC-NC-by-SA 2.0"
this.description = "Sets all Thargoid ships as primary target.";
this.version = "1.0 alpha 1"
this.shipAttacksThargoids = function(attack);
{
log(this.UFOship, "Will exit from Witchspace:" + UFOship);
if (less than 2 thargoid ships are present === "20% chance")
{
}
}
this.UFOshipWillExitFromWitchspace = function()
{
log(this.UFOship, "Will exit from Witchspace:" + UFOship);
if (more than 2 thargoid ships are present === "30% chance")
{
}
}
this.UFOshipWillExitFromWitchspace = function()
{
log(this.UFOship, "Will exit from Witchspace:" + UFOship);
if (more than 10 thargoid ships are present === "60% chance")
{
}
}
this.UFOshipWillExitFromWitchspace = function()
{
log(this.UFOship, "Will attack thargoid:" + attack.thargoid);
}
this.UFOshipWillAttackThargoid = function()
{
log(this.UFOship, "Will attack missile:" + attack.missile);
if (Missile attacks UFOship === "attack missile")
{
}
{
this.UFOshipWillAttackMissile = function()
{
log(this.UFOship, "Will attack any ship:" + attack.any ship);
if (Any ship attacks UFOship === "attack any ship")
{
}
{
this.UFOshipWillAttackAnyShip = function()
{
log(this.UFOship, "Will enter Witchspace:" + enter.Witchspace);
if (All thargoids are destroyed === "enter Witchspace")
{
}
{
this.UFOshipWillEnterWitchspace = function()
Then I started getting the error reports from Latest.log. It says there is a syntax error in line 8, but from what I can tell, I wrote it very close to a similar command in the Z-Handler script.js. Here are the Latest.log error reports:
01:37:22.057 [shipData.load.begin]: Loading ship data.
01:37:22.559 [shipData.merge.failed]: ***** ERROR: one or more shipdata.plist entries have like_ship references that cannot be resolved: GW-constore
01:37:23.576 [shipData.load.error]: ***** ERROR: the shipdata.plist entry "GW-radars" specifies non-existent model "td-radars.dat".
01:37:25.866 [script.javaScript.exception.syntaxError]: ***** JavaScript exception (UFOship.anon-script): SyntaxError: syntax error
01:37:25.866 [script.javaScript.exception.syntaxError]: /home/mandoman/.Oolite/AddOns/UFOship.oxp/Config/script.js, line 8: this.shipAttacksThargoids = function(attack);
01:37:25.866 [script.javaScript.load.failed]: ***** Error loading JavaScript script /home/mandoman/.Oolite/AddOns/UFOship.oxp/Config/script.js -- compilation failed
I don't know what all that is about the "GW-radars", but the sytaxErrors come right after.