<looks sheepish>
spara, it's actually Random Hits that I'm having problems with.
<wanders away to do some testing>
OK, let me break this down. And prepare yourself for a long post!
The Issue
Station Dock Control is trying to create a standalone version of Random Hits ships. For example, the "rhs_mark_vamppurg_shipset". The reason for wanting to create an individual ship is two-fold: (1) to maintain the docked ship list so a ship can be seen with the escort ships, and (2) when I try to launch the ship, if the ship has escorts defined it will add them to the launch queue, potentially overfilling it. My solution to this is to create "dock" versions of any ships that need escorts, setting it up in a way that clears any pre-existing escort roles, and allows me to launch a single ship.
The Details
"rhs_mark_vamppurg_shipset" is defined as follows:
Code: Select all
"rhs_mark_vamppurg_shipset" = {
"aft_weapon_type" = "WEAPON_NONE";
"auto_weapons" = "true";
escorts = 0;
"escape_pod_model" = "escape-capsule";
"has_energy_bomb" = "0";
"is_external_dependency" = yes;
"like_ship" = "random_hits_mark_vamppurg";
"roles" = "trader(0.01) pirate-heavy-fighter(0.01) pirate-aegis-raider(0.01) pirate-interceptor(0.01) assassin-heavy(0.01)";
script = "rh_mark_shipset.js";
"script_info" = {
"randomshipnames" = "no";
};
};
The "like_ship" is defined as follows:
Code: Select all
"random_hits_mark_vamppurg" = {
"ai_type" = "randomhitsmarkAI.plist";
bounty = 142;
escort_roles = ({
role = "random_hits_markguard_medium"; min = 4; max = 5;
});
fuel = 42;
"has_energy_bomb" = "0.99";
"likely_cargo" = 2;
"like_ship" = "random_hits_patrol_vamppurg";
"missile_role" = "EQ_HARDENED_MISSILE";
pilot = "oolite-pirate";
roles = "random_hits_mark_vamppurg bigBos_revenge_clan random_hits_mark_3";
script = "oolite-random-hits-mark.js";
"script_info" = {
extraMissileLauncher = 0;
markLevel = 3;
podChance = "0.55";
podType = "random_hits_pod2";
qmineChance = "0.75";
};
};
I won't go higher than this here, although the "random_hits_mark_vamppurg" also has a like ship.
When I do a
var dta = Ships.shipDataForKey("rhs_mark_vamppurg_shipset");
I find that
escorts
is defined with a value of 0, and
escort_roles
is defined as per the "random_hits_mark_vamppurg" definition.
In Game Testing
If I do this:
Code: Select all
var myship = system.addShips("[rhs_mark_vamppurg_shipset]", 1, p.position.add(p.vectorForward.multiply(10000)), 1000)[0];
I get a Vampire with a number of escorts. So the "escorts" setting in the rhs_mark_vamppurg_shipset definiton is doing nothing.
OK, so I want a single version of this ship. In SDC I create a "dock" version that looks like this:
Code: Select all
"dock_rhs_mark_vamppurg_shipset" = {
like_ship = "rhs_mark_vamppurg_shipset";
escort_roles = (
{role = ""; min = 16; max = 16;}
);
roles = "dockonly";
is_external_dependency = yes;
};
Now when I do this:
Code: Select all
var myship = system.addShips("[dock_rhs_mark_vamppurg_shipset]", 1, p.position.add(p.vectorForward.multiply(10000)), 1000)[0];
I get the result I'm looking for - a single ship.
But now I want to attach some escorts to this ship. So I do this:
Code: Select all
var mygroup = new ShipGroup("mygroup1", myship);
myship.group = mygroup;
var grd1 = system.addShips("random_hits_markguard_medium", 1, myship.position, 1000)[0];
grd1.shipUniqueName = "My Guard 1";
var result = grd1.offerToEscort(myship);
if (result === false) log(this.name, "fail 1");
mygroup.addShip(grd1);
grd1.group = mygroup;
var grd2 = system.addShips("random_hits_markguard_medium", 1, myship.position, 1000)[0];
grd2.shipUniqueName = "My Guard 2";
result = grd2.offerToEscort(myship);
if (result === false) log(this.name, "fail 2");
mygroup.addShip(grd2);
grd2.group = mygroup;
In both cases the result for offering to escort is false.
To prove that my code is doing things reasonably correctly, if I change the first ship creation to be a "dock_anaconda", and the two escorts to be "escort-medium", the offers to escort are accepted.
The Conclusion
I'm confused! On the one hand a straight creation of a "rhs_mark_vamppurg_shipset" adds escorts based on the escort_roles from the like_ship definition. But if I used my "dock" version and try to do things manually it fails.
So, I'm either doing things wrong (which is a highly likely scenario, by the way!), or there's some sort of issue in play. I even tried hacking the Random Hits shipset shipdata.plist file and removing the "escorts = 0" entry entirely, but got the same results.
Any suggestions, anyone?