Hi, Rustybolts! Nice to see a new contributor doing something else than just ship models!
May I generally suggest that you consult the scripting documentation in the wiki while scripting? Personally, while working on an OXP, I have
all the relevant documents opened in my browser (tabs are
such a nice invention
). Everything is available through the
Category:Oolite Scripting-page. This will help ask a lot of questions and solve a lot of problems. For instance:
Rustybolts wrote:Anyways ship appeared but was close too space station i thought this was set to be closer to witchpoint oh well will change the 0.90 to 0.10 that should do it.
For all information concerning script.plist the
Methods-page is the right address. In your case the
Looking for, and adding ships-section of that page, where it says:
Code: Select all
addSystemShips: <role> <number> <position>
// causes a number of ships matching the given role to appear near a point
// on a line from the witchpoint to the planet's station. <position> should be a floating point
// number where 0.0 represents the witchpoint and 1.0 represents the station
So, indeed, number close to 0 => witchpoint. Number close to 1 => station. By the way: any other number works as well. So -1 will make the ship appear behind the witchpoint, but at the double distance, as seen from the station. And 100 will make it appear far behind the station, as seen from the witchpoint. And so on. Also note that the two reference points, as far as
addSystemShips: is concerned, are the
witchpoint and the
station. This is different from all other ship-adding methods. In all other methods the position of the
planet is the point of reference, not the position of the
station.
Rustybolts wrote:I have now come across another small problem
in shipdata i have
Code: Select all
<key>cargo_type</key>
<string>CARGO_NOT_CARGO</string>
<key>cargo_carried</key>
<string>Gold</string>
Once ship has been killed i have only seen 1 cargo cannister despite the ship having max cargo of 55. Can i specify a set amount of cargo to despatch upon ships death.
Not sure. Have a look at the
Shipdata.plist-page. The information there seems to suggest that
max_cargo actually only works for ships added by the
system populator, therefore not for ships added by script.
A workaround would be to spawn a suitable amount of cannisters through the ship's
death_actions. Just take the example as it is and replace "explosive_shrapnel" with "Gold" and the number with anything you like. There is an in-built random factor, because some of the spawned entities will immediatly collide with each other and disappear, so the actual number of cargo created will always be something between 0 and the number you specified.