Basic OXP help!
Moderators: winston, another_commander
- drew
- ---- E L I T E ----
- Posts: 2190
- Joined: Fri May 19, 2006 9:29 am
- Location: In front of a laptop writing a book.
- Contact:
Basic OXP help!
Probably a dumb question, but I'm mucking about with my Tianve.oxp and have the following question.
If I want to create a bunch of 'standard' ships that are built into the game (eg. vipers, kraits, sidewinders etc...) do I need to copy the .dat models for these ships across to my oxp directory, make a shipdata.plist entry for each type I want and then use say addShipsAtPrecisely in planetinfo.plist to create them?
Seems a bit long winded that's all. Is there a way to 'generically' create standard vessels?
Cheers,
Drew.
If I want to create a bunch of 'standard' ships that are built into the game (eg. vipers, kraits, sidewinders etc...) do I need to copy the .dat models for these ships across to my oxp directory, make a shipdata.plist entry for each type I want and then use say addShipsAtPrecisely in planetinfo.plist to create them?
Seems a bit long winded that's all. Is there a way to 'generically' create standard vessels?
Cheers,
Drew.
If ships are present in the game (provided either in the trunk or via another OXP) then your OXP can make full use of them.
This gets a little dodgy if they're in another OXP (as of course that has to be installed for your OXP to be able to make use of them), but trunk ships etc are safe to reference for obvious reasons.
So to answer your question, just go ahead and use them, no need for your OXP to duplicate them (unless you want them to do something different from the standard set-up of course or to have some different parameters, and even then you can just "like_ship" them via a shipdata.plist in your OXP and only tweak what you need).
If you want the shipdata.plist information for them, it's under oolite.app/resources/config (at least on Windows).
This gets a little dodgy if they're in another OXP (as of course that has to be installed for your OXP to be able to make use of them), but trunk ships etc are safe to reference for obvious reasons.
So to answer your question, just go ahead and use them, no need for your OXP to duplicate them (unless you want them to do something different from the standard set-up of course or to have some different parameters, and even then you can just "like_ship" them via a shipdata.plist in your OXP and only tweak what you need).
If you want the shipdata.plist information for them, it's under oolite.app/resources/config (at least on Windows).
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
- drew
- ---- E L I T E ----
- Posts: 2190
- Joined: Fri May 19, 2006 9:29 am
- Location: In front of a laptop writing a book.
- Contact:
Thanks for that...
If I want to create a viper for instance, do I need to create an entry in my OXPs shipdata.plist to tell it where to find the viper info?,
I tried to put just an entry in my planetinfo.plist as follows:
"addShipsAtPrecisely: viper 1 pwm 14000 70000 23000"
but stderr says
[script.addShips.failed]: SCRIPT ERROR in <anonymous actions> ***** CANNOT addShipsAtPrecisely: 'viper 1 pwm 14000 70000 23000' (should be addShipsAt: role number coordinate_system x y z)
Cheers,
Drew.
If I want to create a viper for instance, do I need to create an entry in my OXPs shipdata.plist to tell it where to find the viper info?,
I tried to put just an entry in my planetinfo.plist as follows:
"addShipsAtPrecisely: viper 1 pwm 14000 70000 23000"
but stderr says
[script.addShips.failed]: SCRIPT ERROR in <anonymous actions> ***** CANNOT addShipsAtPrecisely: 'viper 1 pwm 14000 70000 23000' (should be addShipsAt: role number coordinate_system x y z)
Cheers,
Drew.
viper is the ship's internal name. AddShips adds by ships role (see below, which is a reproduction of the shipdata.plist code for the trunk viper, the arrows are my addition for highlighting).
If you replace "viper" with "oolite-viper" (one of the ships roles) then you should have more success. Alternatively you can use the role "police" instead (the ship's primary role) but then any ship with role "police" will be spawned in that position (you may not specifically get a viper).
oolite-viper is specific to that ship, it's the only one with that role in the game (or at least it should be, that's what the oolite- is meant to mean).
[/color]
If you replace "viper" with "oolite-viper" (one of the ships roles) then you should have more success. Alternatively you can use the role "police" instead (the ship's primary role) but then any ship with role "police" will be spawned in that position (you may not specifically get a viper).
oolite-viper is specific to that ship, it's the only one with that role in the game (or at least it should be, that's what the oolite- is meant to mean).
Code: Select all
viper = <----internal name
{
aft_eject_position = "0.0 6.5 -28.0";
ai_type = "route1patrolAI.plist";
cargo_type = "CARGO_NOT_CARGO";
energy_recharge_rate = 4;
exhaust = ("12.5 0.0 -27.5 6.0 6.0 6.0", "-12.5 0.0 -27.5 6.0 6.0 6.0");
forward_weapon_type = "WEAPON_BEAM_LASER";
has_ecm = yes;
laser_color = "magentaColor";
max_energy = 180;
max_flight_pitch = 1.8;
max_flight_roll = 2.8;
max_flight_speed = 320;
missile_launch_position = "0.0 -8.5 -11.0";
missiles = 1;
model = "viper_redux.dat";
name = "GalCop Viper";
roles = "police oolite-viper"; <----these are the entries you want for addShips
scanClass = "CLASS_POLICE";
subentities = (
"*FLASHER* -25.00 0.0 -27.50 260.0 2 0.5 8",
"*FLASHER* -21.88 0.0 -20.63 260.0 2 0.6 8",
"*FLASHER* -18.75 0.0 -13.75 260.0 2 0.7 8",
"*FLASHER* -15.63 0.0 -6.88 260.0 2 0.8 8",
"*FLASHER* -12.50 0.0 0.00 260.0 2 0.9 8",
"*FLASHER* 25.00 0.0 -27.50 310.0 2 0 8",
"*FLASHER* 21.88 0.0 -20.63 310.0 2 0.1 8",
"*FLASHER* 18.75 0.0 -13.75 310.0 2 0.2 8",
"*FLASHER* 15.63 0.0 -6.88 310.0 2 0.3 8",
"*FLASHER* 12.50 0.0 0.00 310.0 2 0.4 8",
"*FLASHER* -12.50 8.0 -27.50 260.0 2 0 8",
"*FLASHER* 12.50 8.0 -27.50 310.0 2 0.25 8"
);
thrust = 32;
weapon_position_aft = "0.0 0.0 -27.5";
weapon_position_forward = "0.0 -2.67 18.33";
weapon_position_port = "-12.5 0.0 0.0";
weapon_position_starboard = "12.5 0.0 0.0";
};
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
- 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:
And that's by the way the whole secret behind the whole role-system. You can choose whether you want to spawn a specific ship (then you use its unique role, which is more or less like a shipname among the roles), or any ship of a defined group of ships (in which case you use the generic role defined for that group, like "police" in case of the viper, and you won't know which of the ships belonging to the group "police" will be spawned, but you can be sure that one of them will be spawned; just make sure that the ships you want to be selectible for spawning actually have the role in question).
And of course you can create your own group of ships to select from, if you give one common role to a couple of ships.
In an ideal Ooniverse every ship would have one (or more) group role(s) and its own unique role, so it could be spawned either by chance as a group member, or specifically. All ships in the original set follow that rule. But of course in many cases OXPers do not intend their ships to be member of any group (especially true for ships that are spawned only once during the cause of a mission), so they give it only a unique role, and it would make no sense to do otherwise. In the opposite case, where a ship only has one or more of the generic roles, it would do no harm to give it a unique role as well, in order to enable other scripters to call for the ship specifically.
And of course you can create your own group of ships to select from, if you give one common role to a couple of ships.
In an ideal Ooniverse every ship would have one (or more) group role(s) and its own unique role, so it could be spawned either by chance as a group member, or specifically. All ships in the original set follow that rule. But of course in many cases OXPers do not intend their ships to be member of any group (especially true for ships that are spawned only once during the cause of a mission), so they give it only a unique role, and it would make no sense to do otherwise. In the opposite case, where a ship only has one or more of the generic roles, it would do no harm to give it a unique role as well, in order to enable other scripters to call for the ship specifically.
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
Hello drew,
This oolite-viper is programmed to patrol between witchpoint and planet. You will see that your vipers go first to the witchpoint and when a player arrives at the pulsar, he wont see any special ships at all.
probably you need the other by thargoid described method, to make a copy with "like_ship" and give it your own role and an AI.plist that somehow lets it patrol around the pulsar. Patrol between two fixed coordinates which will mean to write an AI of your own, or at least modify the existing patrolAI.
Instead of going to a planet with:
you could define absolute coordinates:
You could for example look into dictators.oxp. into the tanker AI. (Or give me a PM with the coordinates to patrol between). It will be a simple replacement of only a few lines in the standard route1patrolAI.
(While looking for an example in dictators.oxp, I noticed that the two police AI's have a bug. In their patrol they should turn at the witchpoint. In my version they refer to the HEAD_FOR_PLANET state that is not pressent. But I have not downloaded the latest version, so It could be correct already in the current release.)
You will however encounter one major problem in your specific situation."addShipsAtPrecisely: oolite-viper 5 pwm 14000 70000 23000",
That works fine and dandy. Tianve can now be populated with lots of busy tourist traffic!
This oolite-viper is programmed to patrol between witchpoint and planet. You will see that your vipers go first to the witchpoint and when a player arrives at the pulsar, he wont see any special ships at all.
probably you need the other by thargoid described method, to make a copy with "like_ship" and give it your own role and an AI.plist that somehow lets it patrol around the pulsar. Patrol between two fixed coordinates which will mean to write an AI of your own, or at least modify the existing patrolAI.
Instead of going to a planet with:
Code: Select all
ENTER = (setCourseToPlanet, "setDesiredRangeTo: 50000.0", checkCourseToDestination);
Code: Select all
ENTER = ("setCoordinates: wpu 0 0 0.3", setDestinationFromCoordinates, "setDesiredRangeTo: 2500.0", checkCourseToDestination);
(While looking for an example in dictators.oxp, I noticed that the two police AI's have a bug. In their patrol they should turn at the witchpoint. In my version they refer to the HEAD_FOR_PLANET state that is not pressent. But I have not downloaded the latest version, so It could be correct already in the current release.)
Last edited by Eric Walch on Mon Oct 06, 2008 11:54 am, edited 2 times in total.
UPS-Courier & DeepSpacePirates & others at the box and some older versions
- Lestradae
- ---- E L I T E ----
- Posts: 3095
- Joined: Tue Apr 17, 2007 10:30 pm
- Location: Vienna, Austria
...
*takes note* ... good idea.Commander McLane wrote:In an ideal Ooniverse every ship would have one (or more) group role(s) and its own unique role, so it could be spawned either by chance as a group member, or specifically. All ships in the original set follow that rule. ... In the opposite case, where a ship only has one or more of the generic roles, it would do no harm to give it a unique role as well, in order to enable other scripters to call for the ship specifically.
BTW, Drew, kindly have a look here:
http://wiki.alioth.net/index.php/Role
... a few people including Cmdr McLane had a go at explaining "how the roles work" and their input was compiled there.
Cheers
L
- drew
- ---- E L I T E ----
- Posts: 2190
- Joined: Fri May 19, 2006 9:29 am
- Location: In front of a laptop writing a book.
- Contact:
Thanks chaps.
Quick question - is the default AI for role 'police' different from 'oolite-viper'?
I have created a LinerAI.plist that has a series of waypoints on the way to, around, and back from the pulsar to the station. That works well for me.
I was thinking of doing a number of variations of this, going in opposite directions etc, in order to generate my own pulsar 'space lane' as well as the normal one, and stick some objects of interest on the way.
Another question I have is as follows.
I'd like to be able to send a message to the player when they either:
a. Arrive in the tianve system by witchdrive.
b. leave the station / dock at the station
c. arrive in mass-lock range of the pulsar
...
Then I get stuck again...
I had a look in the hoopycasino oxp to try to figure out how it 'announces' itself, but I can't figure it out.
Cheers,
Drew.
Quick question - is the default AI for role 'police' different from 'oolite-viper'?
I have created a LinerAI.plist that has a series of waypoints on the way to, around, and back from the pulsar to the station. That works well for me.
I was thinking of doing a number of variations of this, going in opposite directions etc, in order to generate my own pulsar 'space lane' as well as the normal one, and stick some objects of interest on the way.
Another question I have is as follows.
I'd like to be able to send a message to the player when they either:
a. Arrive in the tianve system by witchdrive.
b. leave the station / dock at the station
c. arrive in mass-lock range of the pulsar
...
Then I get stuck again...
I had a look in the hoopycasino oxp to try to figure out how it 'announces' itself, but I can't figure it out.
Cheers,
Drew.
The short answer to your first question is no.
Police is a group role, so the AI depends on which ship within that group (viper or something else) gets picked - the AI is ship-dependent. In most cases though if you spawn a "police" role the auto_AI key will change the ship's AI to route1patrolAI. (Oolite-viper has that AI set as standard anyway). This key is set as on (true) by default (if it's not defined in the plist), although some OXP ships may have it set to off (false) in their shipdata.plist. In that way you could get a police scanclass vessel on a different AI if one is set and the auto key is false.
For your second quesiton, this wiki page about world scripts should give you some pointers. It covers a and b anyway, and a lot of c
For mass lock, do you want it any mass lock or for a specific mass lock (e.g. planetary/station approach)? For the latter you can specifically trigger when you get near the planet/station (see the world scripts page). For more generic mass locks then it's the world script event this.alertConditionChanged and a check on the player.alertMassLocked flag (true when you are, false when not - again see the wiki page). It will depend a little on how the pulsar is set up (presumably as an extra planet or moon) so you could use either way, and then check for proximity to the pulsar.
I'd also recommend looking over Ahruman's Javascript Test OXP as a reference of various possibilities. Maybe also have a look at my script in the new version of Famous Planets as that's along similar lines to your thoughts in places.
Police is a group role, so the AI depends on which ship within that group (viper or something else) gets picked - the AI is ship-dependent. In most cases though if you spawn a "police" role the auto_AI key will change the ship's AI to route1patrolAI. (Oolite-viper has that AI set as standard anyway). This key is set as on (true) by default (if it's not defined in the plist), although some OXP ships may have it set to off (false) in their shipdata.plist. In that way you could get a police scanclass vessel on a different AI if one is set and the auto key is false.
For your second quesiton, this wiki page about world scripts should give you some pointers. It covers a and b anyway, and a lot of c
For mass lock, do you want it any mass lock or for a specific mass lock (e.g. planetary/station approach)? For the latter you can specifically trigger when you get near the planet/station (see the world scripts page). For more generic mass locks then it's the world script event this.alertConditionChanged and a check on the player.alertMassLocked flag (true when you are, false when not - again see the wiki page). It will depend a little on how the pulsar is set up (presumably as an extra planet or moon) so you could use either way, and then check for proximity to the pulsar.
I'd also recommend looking over Ahruman's Javascript Test OXP as a reference of various possibilities. Maybe also have a look at my script in the new version of Famous Planets as that's along similar lines to your thoughts in places.
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
.I have created a LinerAI.plist that has a series of waypoints on the way to, around, and back from the pulsar to the station. That works well for me
Better rename that one to a more unique name. Currently there are more oxp.s with that AI name. (e.g. transports.oxp) Oolite will choose the one it loads last for all oxp's.
UPS-Courier & DeepSpacePirates & others at the box and some older versions
- drew
- ---- E L I T E ----
- Posts: 2190
- Joined: Fri May 19, 2006 9:29 am
- Location: In front of a laptop writing a book.
- Contact:
Thanks all!
Better get coding - will concentrate on tianve.oxp once Mutabilis is out of the way.
Another question.
If I call up a ship with role 'escort' - how does that new ship know what to escort? Does it lock onto the nearest ship or something?
i.e. If I call up a tianveliner, how do call up a handful of escorts to ..er.. escort that liner?
Just found the wikipage - looks complicated!
Cheers,
Drew.[/s]
Better get coding - will concentrate on tianve.oxp once Mutabilis is out of the way.
If I call up a ship with role 'escort' - how does that new ship know what to escort? Does it lock onto the nearest ship or something?
i.e. If I call up a tianveliner, how do call up a handful of escorts to ..er.. escort that liner?
Just found the wikipage - looks complicated!
Cheers,
Drew.[/s]