Just when I thought I was out...
Moderators: winston, another_commander
Another question: adding ships to take off from the planet. I'm guessing I should use addShipsAt to call them into existence at some point far away from anywhere, then have setTakeOffFromPlanet in the ships' AI to (almost) instantly move them to a suitable position/set them off. Does this sound about right? (I'm not sure how Oolite itself does it.)
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
Very difficult in legacy scripting as he command setTakeOffFromPlanet has a bug. It is not setting the orientation of a ship, it only sets a desired range. Ships spawned near the surface will just fly in the random direction they were added. (Half of them crashing into the surface). The bug was filed long ago, but recently Kaks took it up to fix it for the 1.71 release.Roberto wrote:Another question: adding ships to take off from the planet. I'm guessing I should use addShipsAt to call them into existence at some point far away from anywhere, then have setTakeOffFromPlanet in the ships' AI to (almost) instantly move them to a suitable position/set them off. Does this sound about right? (I'm not sure how Oolite itself does it.)
I use ships launching from the surface in UPS. There I let them start at the witchpoint side of the planet. I needed this side as now I can make them turn into the witchpoint direction and i know they will fly from the surface. Originally I also wanted to let ships start from the back of the planet, but in legacy I did not see a way to give them a direction.
When you look in UPS, you will find upsSatelliteDefenseAI.plist and risingUpsShuttleAI.plist that take care of this lift of. You add them with addShipsAtPrecisely: name pwp 1 0 0 1.02
Use the coordinate system "pwp". this is related to planet radii. 1 means surface and 1.01 is just a little above. You can even use lower values but in my experience they also need room to turn upwards before departure.
In JS with a shipscript this orientation can be done with JS, but likely Kaks has than fixed the setTakeOffFromPlanet command so this will take care of the orientation.
UPS-Courier & DeepSpacePirates & others at the box and some older versions
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
I think (read: I'm not sure, but it's a suitable guess) ships are not added in a random direction, but always along the internal z-axis, which happens to be very close to the wp-axis. So adding ships exactly opposite of the witchpoint (pwp 0 0 -1.02) should do the trick and have them launch straight automatically.Eric Walch wrote:Very difficult in legacy scripting as he command setTakeOffFromPlanet has a bug. It is not setting the orientation of a ship, it only sets a desired range. Ships spawned near the surface will just fly in the random direction they were added. (Half of them crashing into the surface). The bug was filed long ago, but recently Kaks took it up to fix it for the 1.71 release.Roberto wrote:Another question: adding ships to take off from the planet. I'm guessing I should use addShipsAt to call them into existence at some point far away from anywhere, then have setTakeOffFromPlanet in the ships' AI to (almost) instantly move them to a suitable position/set them off. Does this sound about right? (I'm not sure how Oolite itself does it.)
I use ships launching from the surface in UPS. There I let them start at the witchpoint side of the planet. I needed this side as now I can make them turn into the witchpoint direction and i know they will fly from the surface. Originally I also wanted to let ships start from the back of the planet, but in legacy I did not see a way to give them a direction.
But this is only a suitable guess. You would have to try it out first.
Oh, and the last should of course be addShipsAtPrecisely: name 1 pwp 0 0 1.02. (Note the change of order between 1 and pwp.Eric Walch wrote:When you look in UPS, you will find upsSatelliteDefenseAI.plist and risingUpsShuttleAI.plist that take care of this lift of. You add them with addShipsAtPrecisely: name pwp 1 0 0 1.02
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
No, I have been working on this extensively. When I add a ship I always see him fly in an other direction. When I add a bunch of 5 ships I see them depart in a star like patron. On flight they turn into the direction I gave them and that takes time and is done with the AI scripting.I think (read: I'm not sure, but it's a suitable guess) ships are not added in a random direction, but always along the internal z-axis, which happens to be very close to the wp-axis.
EDIT: Also on addition of the four satellites they all had an other orientation. Then I experimented with secondary role "station". This did the trick that the satellites now all have the same orientation. I also needed the station role for this to be able to work with alert levels, but that is an other issue. /EDIT
On the AddShips you are right I switched two values. In ups I use a distance of 1.01 not 1.02. But this value also depends on the size of your ship and if you first turn before you start flying. Just experiment with the value. You don't see a real planetary surface as reference so even a start at a 1000 meters above surface looks as surface start.
Last edited by Eric Walch on Wed Mar 12, 2008 11:04 am, edited 2 times in total.
UPS-Courier & DeepSpacePirates & others at the box and some older versions
Clearly I've done something horrendously stupid with the second function here, as Oolite objects to it:
Do I need to stick some more quotes in somewhere?
Code: Select all
this.launchtaranistrafficwitch = function ()
{
system.legacy_addShips("taranis_traffic_witch", 1);
}
this.launchtaranistrafficplanet = function ()
{
system.legacy_addShipsAtPrecisely("taranis_traffic_planet", 1 pwp 0 0 1.02);
}
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
It should be:Roberto wrote:Clearly I've done something horrendously stupid with the second function here, as Oolite objects to it:
Code: Select all
this.launchtaranistrafficwitch = function ()
{
system.legacy_addShips("taranis_traffic_witch", 1);
}
this.launchtaranistrafficplanet = function ()
{
system.legacy_addShipsAtPrecisely("taranis_traffic_planet", 1, "pwp", 0, 0, 1.02);
}
UPS-Courier & DeepSpacePirates & others at the box and some older versions
OK, as LB suggested (quite a while ago now), I've created a new system station using like_ship in order to launch extra traffic. I've had to modify the AI a bit more than I expected, as the constant switching between IDLE and CHECK_FOR_DEBRIS was messing things up. I've basically combined them into one:
Here's the thing - I've been dumping cargo like crazy (that is what it scans for, right?), but I haven't seen any scavengers being launched in response. Is this my bad, or some kind of wider problem? I ask because I noticed this on the Wiki, in the definition for scanForLoot:
*EDIT* One other thing - LB, I noticed that your replacement station (in AsteroidStorm) has the role "rotating-station" (in addition to "station" with a low probability). Does that do anything behind the scenes that I need to know about? I've left it off and everything *seems* to be working just fine... Well, apart from the scavenging!
Code: Select all
IDLE = {
ATTACKED = (setTargetToPrimaryAggressor, increaseAlertLevel, "setStateTo: DEFENSE_MODE");
"OFFENCE_COMMITTED" = (setTargetToFoundTarget, "markTargetForOffence: 15", launchDefenseShip, increaseAlertLevel);
"INCOMING_MISSILE" = (fireECM, increaseAlertLevel);
ENTER = ();
EXIT = ();
"ROLL_1" = ("launchShipWithRole: taranis_traffic_sysstation");
"ROLL_2" = ("launchShipWithRole: taranis_traffic_sysstation");
"ROLL_3" = ("launchShipWithRole: taranis_traffic_sysstation_nohyp");
"TARGET_FOUND" = (launchScavenger, "sendCommsMessage: Scouter launched!");
UPDATE = ("rollD: 12600", decreaseAlertLevel, scanForLoot);
};
If scanForLoot doesn't work for stations... why is it in the default station AI?Returns: "HOLD_FULL", "TARGET_FOUND" or "NOTHING_FOUND". If scanning ship is station or has no scoop it always return: "NOTHING_FOUND".
*EDIT* One other thing - LB, I noticed that your replacement station (in AsteroidStorm) has the role "rotating-station" (in addition to "station" with a low probability). Does that do anything behind the scenes that I need to know about? I've left it off and everything *seems* to be working just fine... Well, apart from the scavenging!
It is working. You can see it clearly that scavengers were launched if there is something to collect. Has your station scavengers? Shipdata.plist:Roberto wrote:If scanForLoot doesn't work for stations... why is it in the default station AI?
Code: Select all
<key>max_scavengers</key>
<integer>10</integer>
Code: Select all
UPDATE = ("rollD: 12600", decreaseAlertLevel, scanForLoot);
EDIT: You don't want to handle every rollD, right?
Ah! It does work after all. I think when I tested it before there must have been too many other things going on. A very strange entry on the Wiki, then!
@Svengali
The idea is to launch ships at random intervals (though I think you've already guessed this). A long wait instead would cause launches to be boringly predictable (and "freeze" the station, making it incapable of responding to attacks etc).
@Svengali
The idea is to launch ships at random intervals (though I think you've already guessed this). A long wait instead would cause launches to be boringly predictable (and "freeze" the station, making it incapable of responding to attacks etc).
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
I am probably to blame for that entry. I just looked better I the code. There is a special check for stations in the scanForLoot, but it also checks the station speed. Meaning it returns only nothing found if the station is moving. like carriers with a station definition inside (Added the word "moving" in the wiki entry now).Roberto wrote:Ah! It does work after all. I think when I tested it before there must have been too many other things going on. A very strange entry on the Wiki, then!
rotating-station is an old way to do this and can be left out. It is replaced by a key. Rotating = YES
UPS-Courier & DeepSpacePirates & others at the box and some older versions
Yes, I'm using something similiar in my harkovtransportAI, but I thought the ATTACKED-Message is a high-priority message and causes a immediate reaction.Roberto wrote:The idea is to launch ships at random intervals (though I think you've already guessed this). A long wait instead would cause launches to be boringly predictable (and "freeze" the station, making it incapable of responding to attacks etc).
Ah - I understand now. Thanks Eric.
I'm almost done on the AI/ship side of things - I just need to modify planetinfo.plist so the frigate doesn't always appear in the same place. Here's what I'm about to test (this is under script_actions):
Have I got the "nesting" right, and am I right in thinking that pseudoFixedD100_number, once "invoked" for the first time, remains the same for as long as you're in the system - and that if you return to the same system later, it (probably) won't give the same result?
@Svengali
You might be right on ATTACKED actually - I bet Eric knows
I'm almost done on the AI/ship side of things - I just need to modify planetinfo.plist so the frigate doesn't always appear in the same place. Here's what I'm about to test (this is under script_actions):
Code: Select all
<string>checkForShips: taranis_frigate</string>
<dict>
<key>conditions</key>
<array>
<string>shipsFound_number lessthan 1</string>
</array>
<key>do</key>
<array>
<key>conditions</key>
<array>
<string>pseudoFixedD100_number lessthan 50</string>
</array>
<key>do</key>
<array>
<string>addShipsAtPrecisely: taranis_frigate 1 pwm 145000 -29000 60500</string>
</array>
<key>conditions</key>
<array>
<string>pseudoFixedD100_number greaterthan 49</string>
</array>
<key>do</key>
<array>
<string>addShipsAtPrecisely: taranis_frigate 1 pwm 250024.81 25.77 -102991.52</string>
</array>
</array>
</dict>
@Svengali
You might be right on ATTACKED actually - I bet Eric knows