Garage - Storing Ships

General discussion for players of Oolite.

Moderators: winston, another_commander

Post Reply
User avatar
Lone_Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 546
Joined: Wed Aug 08, 2007 10:59 pm
Location: Netherlands

Garage - Storing Ships

Post by Lone_Wolf »

I've seen several (good) mission ideas where people were asking if there was a way to store the current ship of a player, give them a specific ship for the missions, and after the missions had finished give them back the original ship.
The answer has always been that Oolite does not have a mechanism for 'parking' ships.

I have an idea how this MIGHT be made possible.

preparation

create a shipdata.plist with entries like these :

Code: Select all

"cobra3-player-parked" = 
{
like_ship = "cobra3-player";
}
Also add 1 entry for the temporary ship

create a shipyard.plist for all parked ships :

Code: Select all

"cobra3-player-parked"
{
chance =1;
price = 1;
techlevel = xyz;
// any techlevel that does not occur in the game / oxp would work
}

add 1 entry for temporary ship, techlevel xyz-1

create 2 stations :
Garage1 with techlevel xyz-1
Garage2 with techlevel xyz
Both should not be placed anywhere

end of preparation
----------------------

Mission Start :
player gets screen asking if they are interested to execute the missions :
If yes,
store ship type and equipment using mission vars
store player money temporary
place garage1 station in system and have player dock there automatically
player sells his ship
player buys temporary ship
reset player money to original amount
dock player to main station, remove garage1 station

Player completed mission(s)


store player money temporary
create garage2 station, have player dock there
player sells temporary ship
player buys his original ship type
dock player to main station once they have bought back their original ship

remove garage2 station
restore equipment for original ship (award.equipment)
restore player money
Missions completed = true

Player continues with his original ship and equipment

Would this be possible with the current (1.74.2) / next stable version OXP options ?

Can it be done in a simpler way ?
User avatar
Mauiby de Fug
---- E L I T E ----
---- E L I T E ----
Posts: 847
Joined: Tue Sep 07, 2010 2:23 pm

Post by Mauiby de Fug »

I'd been thinking along similar lines, but as far as I can tell there is no way to guarantee what ships will be for sale in a specific shipyard...
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

You can select which ships are for sale at specific shipyards using conditions.

However: how would you magically transform the cobra3-player-parked ship into cobra3-player as you buy it?
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

And how do you know what ship type the player is flying when they arrive? Easy to cover the trunk ships, but OXP ships are also around and being added occasionally...
User avatar
Lone_Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 546
Joined: Wed Aug 08, 2007 10:59 pm
Location: Netherlands

Post by Lone_Wolf »

Kaks wrote:
You can select which ships are for sale at specific shipyards using conditions.
Can those conditions be set only from shipyard.plists or also from normal scripts ?
Thargoid wrote:
And how do you know what ship type the player is flying when they arrive? Easy to cover the trunk ships, but OXP ships are also around and being added occasionally...
Yes, adding all those ships would be a lot of work.
Kaks wrote:
However: how would you magically transform the cobra3-player-parked ship into cobra3-player as you buy it?
You're right, i have to rethink how to do it.

Using an external program that changes the savegame would be much simpler, but i'd prefer an ingame solution.
Last edited by Lone_Wolf on Sat Nov 13, 2010 4:25 pm, edited 1 time in total.
User avatar
Mauiby de Fug
---- E L I T E ----
---- E L I T E ----
Posts: 847
Joined: Tue Sep 07, 2010 2:23 pm

Post by Mauiby de Fug »

Kaks wrote:
You can select which ships are for sale at specific shipyards using conditions.
From what I could work out on the wiki and forum threads, setting conditions only defines what ships are actually available as options for the shipyard to choose from; they would not guarantee that the shipyard would necessarily choose that particular ship. Have I misunderstood things?
Thargoid wrote:
And how do you know what ship type the player is flying when they arrive? Easy to cover the trunk ships, but OXP ships are also around and being added occasionally...
I was think of storing the relevant information as a mission variable in the savegame, which would contain the ship name and what equipment it was carrying. But I couldn't work out how to handle the shipyard issue, so I gave up thinking about it and as a result I may be talking complete nonsense!
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Post by Thargoid »

Mauiby de Fug wrote:
I was think of storing the relevant information as a mission variable in the savegame, which would contain the ship name and what equipment it was carrying. But I couldn't work out how to handle the shipyard issue, so I gave up thinking about it and as a result I may be talking complete nonsense!
My meaning was more you write the OXP and get everything working, then I write a new player ship ("flying_spaghetti_monster_player" for example) then suddenly I'm flying a ship that has no "_parked" version in your OXP, and it breaks down until you update.

Hence it'd be a lot of work for you to maintain, and potentially quite easy to have ships that don't work with it.

And as I'm here, the answer to your question to Kaks is yes. You can weight the chances of appearance in shipyard.plist, but you can't guarantee anything.
User avatar
Lone_Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 546
Joined: Wed Aug 08, 2007 10:59 pm
Location: Netherlands

Post by Lone_Wolf »

Kaks, Mauiby de Fug, Thargoid thanks for your responses.

Without a way to give a specific ship (which is only known at runtime) to player, i don't think anymore parking/retrieving ships can be done using oolite oxp/JS options only.

Time for a slightly different apporach, using 1 external program for retrieval.

example :

OXP police patrol requires player to fly a viper during executing

needed : shipdata.plist and shipyard.plist for a Player Viper.
chance = 1; price = 1; techlevel = 127.
// could be any level acceptable to game that is not used for other purposes.

Garage station with techlevel 127 , but placed nowhere by game needs to be designed.

store player ship type and equipment using mission vars
store player money temporary
place Garage station in system and have player dock there automatically
player sells ship
player buys viper-player
// with chance 1, and only 1 ship that matches techlevel of garagestation, i ASSUME it will be available
reset player money to original amount
dock player to main station, remove Garage station

Player completed mission(s)
player saves and quits oolite

player runs external program garage_retrieve
garage_retrieve reads the savegame,

IF !police patrol mission= completed
then Exit
Else
uses the stored variables to write a new savegame where ship and equipment are reset to the type/values they had before the police patrol missions were started.
User avatar
Commander McLane
---- E L I T E ----
---- 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:

Post by Commander McLane »

Lone_Wolf wrote:
player buys viper-player
// with chance 1, and only 1 ship that matches techlevel of garagestation, i ASSUME it will be available
Here's a flaw in your thinking. A station of a certain techlevel can sell all ships with the same or lesser techlevel. In a techlevel 15 station you find very simply ships which could also be sold in a techlevel 5 station. The restriction works only the other way round: no station can sell a ship which has a techlevel higher than the station.

The consequence for your plan is that the shipyard of your extremely high techlevel station would be flooded with every ship there is, making it highly unlikely that the only ship which you are interested in would be offered at all.

I had the same problem in Cataclysm.oxp, where the player is offered a very special ship as a reward after finishing the mission. In order for him to get it I created a station with TL 0. There is no native ship with such a low techlevel, so this way is the only way to make sure that only my ship is offered. However, there is also the risk that no ship will be offered at all. In my tests it worked most of the time. I decided that this was good enough for me, because it doesn't get any better.
User avatar
Lone_Wolf
---- E L I T E ----
---- E L I T E ----
Posts: 546
Joined: Wed Aug 08, 2007 10:59 pm
Location: Netherlands

Post by Lone_Wolf »

I know that ships of a lower techlevel are also available, but am 90% sure that the difference between the ship techlevel and the shipyard level plays a role in the chance.

At 1 point i was looking for a tiger MK I techlevel 8, checked many systems of lvl 8 and above. I only found the tiger at systems below level 12.

I also remember seeing a reference on this forum (can't find it anymore) that the bigger the diff between ship techlevel and shipyard level, the lower the chance becomes.
If that is correct, a shipyard with tech level 127 should have a very low chance to have ships of lvl 15 and below available.

1 of the programmers can probably verify this.
Post Reply