when a ship is painted, i start up oolite and go first to gallery ( very handy ) but the ship can still
look a little different ingame
So for educational purpose ingame viewing I would like to spawn a specific ship,
I am looking for script/code which spawns 5x the same ship on different positions at a radius of 3000 units surrounding the station
and which does this unconditional, so not 1 or 2 or 5 but 5...
spawning a specific ship ?
Moderators: winston, another_commander
- phkb
- Impressively Grand Sub-Admiral
- Posts: 4830
- Joined: Tue Jan 21, 2014 10:37 pm
- Location: Writing more OXPs, because the world needs more OXPs.
Re: spawning a specific ship ?
Does this help at all? http://wiki.alioth.net/index.php/Oolite ... m#addShips
If you want a specific ship key to be spawned, make the role “[my-ship-data-key]”.
If you want a specific ship key to be spawned, make the role “[my-ship-data-key]”.
Re: spawning a specific ship ?
I am using this mischmasch mix, but it is not always certain a ship is spawned even after several station launches...
Code: Select all
"use strict";
this.shipLaunchedFromStation = function() {
var v1 = system.mainPlanet.position;
var v2 = system.sun.position.subtract(v1);
var v3 = v1.cross(v2).direction();
var v4 = v1.add(v3.multiply(system.mainPlanet.radius*1.5));
var md = system.addShips("medica",1,v4,10E3)[0];
var md = system.addShips("smivs-liner",4,system.mainStation.position,2E4)[0];
if (md) {
md.orientation = v3.multiply(-1).rotationTo([0,0,1]);
}
}
- montana05
- ---- E L I T E ----
- Posts: 1166
- Joined: Mon May 30, 2016 3:54 am
- Location: lurking in The Devils Triangle (G1)
Re: spawning a specific ship ?
This one is quite similar and easy to adapt, I am using it all the time to check my modifications:
Code: Select all
this.name = "GNSS Testrun";
this.author = "Montana05";
this.copyright = "This script is hereby placed in the public domain.";
this.version = "1.0";
this.description = "Spawns ships at the witchpoint or on W-P route after a witchspace jump."
this.shipWillExitWitchspace = function()
{
var pos1 = Vector3D(0, 0, -0.03).fromCoordinateSystem("wpu");
system.addShips("navy-behemoth-battlegroup", 1, pos1, 5000);
system.addShips("GNSS-leviathan_carrier_group", 1, pos1, 8000);
system.addShips("GNSS-condor_carrier_group", 1, pos1, 10000);
system.addShips("GNSS-orion", 1, pos1, 12000);
}
Scars remind us where we've been. They don't have to dictate where we're going.
- phkb
- Impressively Grand Sub-Admiral
- Posts: 4830
- Joined: Tue Jan 21, 2014 10:37 pm
- Location: Writing more OXPs, because the world needs more OXPs.
Re: spawning a specific ship ?
Can I suggest, if you need to do test spawning of ships, that you investigate the JavaScript Debug Console? It makes your life so much easier when it comes to running test scripts. See this thread: https://bb.oolite.space/viewtopic.php?t=4589
Remember, if you usecbr wrote:I am using this mischmasch mix, but it is not always certain a ship is spawned even after several station launches...
system.addShips("rolename", <etc>)
, Oolite will pick a random ship from any ship that has that role, based on the frequency, which means you might not get the ship you actually want. If you want a specific ship spawned, get the ship data key from the shipdata.plist file, and use the form system.addShips("[shipdatakey]", <etc>)
instead.-
- Quite Grand Sub-Admiral
- Posts: 6682
- Joined: Wed Feb 28, 2007 7:54 am
Re: spawning a specific ship ?
Debug console for the win. Use the or and you are set. If you want to approach the ship and admire it without worrying about it escaping (or opeining fire on you), you can spawn it and immediately execute on the console:
The T is an automatic variable that refers to whatever ship has just been generated.
When docked, you can also use the
:spawn
console macro to generate any ship you want in-game.
Code: Select all
:spawn [ship-key]
Code: Select all
:spawn shipRole
Code: Select all
T.setAI("dumbAI.plist")
When docked, you can also use the
:test
macro, which has the exact same parameters as :spawn (i.e. ship key in brackets or ship role) and creates a mission screen with the requested ship rotating in the middle. This is the best way of showing the ship in detail.Re: spawning a specific ship ?
Thanks for all the different options.
Currently using the 'oolite-debug-console-master' with pySimpleConsole.py and the ': spawn' command
which neatly adds the required ship in the current system
Currently using the 'oolite-debug-console-master' with pySimpleConsole.py and the ': spawn' command
which neatly adds the required ship in the current system