Page 1 of 2

Newby attempting first mod and failing...

Posted: Tue Jul 15, 2008 11:05 am
by Davidtq
OK I've somehow only just discovered oolite (how has a long term elite fan like me, managed to not find it before...), and started downloading allsorts of weird and wonderful oxp's.

Its given me some taste for what can be done with the game, and of course I want to start adding things myself, so I thought Id start simple.

Somehow despite reading a lot and trying to understand how things work Ive gone wrong :(

orginally I scribbled over an original texture to make a new look for a ship. nice and simple, all standard cobra mk3's now look like my new paint job. I then decided that rather than all cobra mk3's looking like that I want to "create" a new ship with my paint job and a new name (ideally Id prefer to make it unique to me once Ive brought it at a ship yard, but thats a later step no doubt...) I restored the original cobra mk3 texture and set about creating an oxp so I have my under the addons directory created my main directory:-

DSHcobra3.oxp and within that Ive created Config, Models, and Textures subdirectories

Ive copied the original cobra3_redux.dat into the models directory and my revised cobra3_redux.png into the textures directory and then created a shipdata.plist in the config directory that looks like this :-
<plist version="1.0">

<key>like_ship</key>
<string>Cobra Mark III</string>
<key>model</key.
<string>cobra3_redux.dat</string>
<key>name</key>
<string>DSHspecial</string>
Shamelessly copied, pasted and edited from other sources but to my simple mind this should be creating a new ship the "DSHspecial" using the original cobra mk3 specs and model?

Ive then created a shipyard.plist file in the config file that looks like this:-
<plist version="1.0">
<dict>
<key>DSHspecial</key>

<dict>

<key>chance</key>

<real>0.9</real>

<key>optional_equipment</key>

<array>

<string>EQ_CARGO_BAY</string>

<string>EQ_ECM</string>

<string>EQ_FUEL_SCOOPS</string>

<string>EQ_PASSENGER_BERTH</string>

<string>EQ_ESCAPE_POD</string>

<string>EQ_ENERGY_BOMB</string>

<string>EQ_ENERGY_UNIT</string>

<string>EQ_NAVAL_ENERGY_UNIT</string>

<string>EQ_DOCK_COMP</string>

<string>EQ_WEAPON_PULSE_LASER</string>

<string>EQ_WEAPON_BEAM_LASER</string>

<string>EQ_WEAPON_MINING_LASER</string>

<string>EQ_WEAPON_MILITARY_LASER</string>

<string>EQ_FUEL_INJECTION</string>

<string>EQ_SCANNER_SHOW_MISSILE_TARGET</string>

<string>EQ_MULTI_TARGET</string>

<string>EQ_GAL_DRIVE</string>

<string>EQ_ADVANCED_COMPASS</string>

<string>EQ_SHIELD_BOOSTER</string>

<string>EQ_NAVAL_SHIELD_BOOSTER</string>

<string>EQ_HEAT_SHIELD</string>

</array>

<key>price</key>

<integer>150000</integer>

<key>standard_equipment</key>

<dict>

<key>extras</key>

<array/>

<key>forward_weapon_type</key>

<string>EQ_WEAPON_PULSE_LASER</string>

<key>missiles</key>

<integer>3</integer>

</dict>

<key>techlevel</key>

<integer>2</integer>

<key>weapon_facings</key>

<integer>15</integer>

</dict>

</dict>
</plist><plist version="1.0">
<dict>
<key>DSHspecial</key>

<dict>

<key>chance</key>

<real>0.9</real>

<key>optional_equipment</key>

<array>

<string>EQ_CARGO_BAY</string>

<string>EQ_ECM</string>

<string>EQ_FUEL_SCOOPS</string>

<string>EQ_PASSENGER_BERTH</string>

<string>EQ_ESCAPE_POD</string>

<string>EQ_ENERGY_BOMB</string>

<string>EQ_ENERGY_UNIT</string>

<string>EQ_NAVAL_ENERGY_UNIT</string>

<string>EQ_DOCK_COMP</string>

<string>EQ_WEAPON_PULSE_LASER</string>

<string>EQ_WEAPON_BEAM_LASER</string>

<string>EQ_WEAPON_MINING_LASER</string>

<string>EQ_WEAPON_MILITARY_LASER</string>

<string>EQ_FUEL_INJECTION</string>

<string>EQ_SCANNER_SHOW_MISSILE_TARGET</string>

<string>EQ_MULTI_TARGET</string>

<string>EQ_GAL_DRIVE</string>

<string>EQ_ADVANCED_COMPASS</string>

<string>EQ_SHIELD_BOOSTER</string>

<string>EQ_NAVAL_SHIELD_BOOSTER</string>

<string>EQ_HEAT_SHIELD</string>

</array>

<key>price</key>

<integer>150000</integer>

<key>standard_equipment</key>

<dict>

<key>extras</key>

<array/>

<key>forward_weapon_type</key>

<string>EQ_WEAPON_PULSE_LASER</string>

<key>missiles</key>

<integer>3</integer>

</dict>

<key>techlevel</key>

<integer>2</integer>

<key>weapon_facings</key>

<integer>15</integer>

</dict>

</dict>
</plist>
Again copied, pasted and badly edited by me, I figured this should be enough to inject the "special" ive created into most planets ships for sale list (tech level 2 and high "chance")

But Im not seeing any sign of my "new" ship on any saved game or planet I land at.

I was hoping that even if the program automatically went to the standard cobramk3 models and textures in the main directory instead of picking up my custom texture in the oxps directories Id at least see the name "dshspecial" in the ships for sale listing, but im not which I think means Ive went wrong somewhere...

I realise the headers could do with standardising and the format needs tidying up a bit but for now im just trying to "inject" an new ship based on an old one into the game. and getting it wrong...

Could anyone tell me what I am doing wrong here?[/quote]

Posted: Tue Jul 15, 2008 11:14 am
by Commander McLane
Hi, Davidtq, and first of all welcome to the boards and of course to this great game! :D

Nice to have another old eliteer here. :wink:

As far as your problem is concerned: You are on the right track, but not yet there.

On plists: You definitely need all headers and all <dict>s and <array>s. Best thing is to take an existing shipdata.plist and shipyard.plist and just replace the entries with yours. If your plists look actually like you posted them they are missing essential parts and won't be recognized by the game at all. Result: Your ship is not there.

Perhaps (it's not quite clear from your description) you overlooked another step as well: The texture used for a ship is specified in the dat-file of that ship. So if you have taken the original Cobra III dat-file and renamed it, you also have to open it with a text editor, and find and replace all occurences of the original texture-name with your custom texture-name. Then save your changes.

With these two steps you should be able to see your ship as an addition to the existing ship-set.

Right On, Commander! :D

*****

P.S.: Reading again I realise that there is another problem as well. It is not enough to copy and paste existing files into another directory. You have to rename them as well. Because out of two equally named files only one will be loaded by the game. So if you just use a different texture with the same name, you still will change all ships in the game, regardless where you save it.

Posted: Tue Jul 15, 2008 11:53 am
by Davidtq
OK I've edited the shipdata.plist to the following:-

Its now pointing to a new model name, the model has been edited running a search and replace on the original texture name to a new texture name (dshspecial
<plist version="1.0">

<key>DSHspecial</key>
<dict>
<key>like_ship</key>
<string>Cobra Mark III</string>
<key>model</key.
<string>dshspecial.dat</string>
<key>name</key>
<string>DSHspecial</string>
</dict>
Is that correct with all appropriate headers \ information? from what I read the "like_ship" key should allow it to grab all appropriate information from the ship in the key? and only replace where necesary with new keys where defined?

So what I was hoping for was it to look at the original cobra mk3 and go to the new copy of the model (and its related texture) and give it a new name

the shipyard.plist remains identical to before.

Using the quote function seems to remove the tidy tab mark formatting :( but apart from "formatting" the plists are exactly as Ive put them here - copied and pasted from the text editor.

Ive got a couple of new models Ive done in wings that im hoping to improve and add once i get the hang of this basic mod :D (also need to get the 3d files converted to dat - Im a pc user...) But right now I need to get to grips with the basics :D

Posted: Tue Jul 15, 2008 12:18 pm
by Eric Walch
Hi, Davidtq,
P.S.: Reading again I realise that there is another problem as well.
And even a possible third: Oolite uses a cache for it's oxp's. Very useful for plain users but annoying for programmers. When the modification date of an OXP does not change, Oolite assumes it is the same oxp and works with the old content of the cache. As said, this speeds things up for plain users.

However, when you change a file inside the oxp, the modification date of the oxp does not change and Oolite assumes nothing has changed and keeps working with the old cache. To force Oolite to load the oxp you internally changed, you need to hold down the shift key during the initial part of the startup.

Posted: Tue Jul 15, 2008 12:26 pm
by Davidtq
Eric Walch wrote:
Hi, Davidtq,
P.S.: Reading again I realise that there is another problem as well.
And even a possible third: Oolite uses a cache for it's oxp's. Very useful for plain users but annoying for programmers. When the modification date of an OXP does not change, Oolite assumes it is the same oxp and works with the old content of the cache. As said, this speeds things up for plain users.

However, when you change a file inside the oxp, the modification date of the oxp does not change and Oolite assumes nothing has changed and keeps working with the old cache. To force Oolite to load the oxp you internally changed, you need to hold down the shift key during the initial part of the startup.
I was REALLY hoping this would fix it :D sadly still no dshspecial (will get given a real name once I figure out where im going wrong)

Posted: Tue Jul 15, 2008 12:48 pm
by Davidtq
OK chipping away at this, I decided to hack someone elses oxp to get my ship working by taking the rusties pack shipdata and shipyard plists and reducing them to just the cobra mk3 data and then replacing the appropriate textures with my own Ive now managed to get my ship on the shipyard! as often as the rusty one does leaving original cobras and darkwheel cobras in place! now its time to change file names so this can coexist with the rusties pack (I like the rusties pack)

Posted: Tue Jul 15, 2008 1:03 pm
by Amen Brick
Its a good idea to save your original file before tinkering. I know. I got the same bad result when I tried to custom my own cobra and wasted a lovely save position. When I learnt where I had gone wrong (demoship and save game require the top name of the ship (I mean the ship title at the top of the file to clarify) , not the designated model title name under the model key, I'd deleted the file and will have to start again.

Posted: Tue Jul 15, 2008 1:10 pm
by Davidtq
Amen Brick wrote:
Its a good idea to save your original file before tinkering. I know. I got the same bad result when I tried to custom my own cobra and wasted a lovely save position. When I learnt where I had gone wrong (demoship and save game require the top name of the ship (I mean the ship title at the top of the file to clarify) , not the designated model title name under the model key, I'd deleted the file and will have to start again.
Ive got original files on a usb stick, current working files on this pc, and the actual pc I play on is a seperate machine entirely :D Going to get the OXP working here before it goes near my gaming machine :D

I didnt copy over the whole rusties pack from usb stick to this machine created my own oxp folder and sub folders then coppied over just the cobra models and textures and all the plists, before cutting down the plists to just cobra information.

so far so good

Got my custom cobra appearing in the shipyard and am playing around with it there, going to see if I can remove non player versions next... final stage will be the model and texture rename... then my shiney new personal cobra will be ready to go, Im assuming that once Ive brought my ship I can stop it appearing in the shipyard again by changeing the chance key to 0 after Ive brought the ship

Posted: Tue Jul 15, 2008 1:28 pm
by Davidtq
OK now Ive sucessfully cut out the bits of info for other roles and just left the player version in ship data, to my (simple) mind that should now mean the ship is only available to the player :D, now to get rid of "rusty" specs and give it back stock cobra specs...

Posted: Tue Jul 15, 2008 1:33 pm
by Amen Brick
Davidtq wrote:
Amen Brick wrote:
Its a good idea to save your original file before tinkering. I know. I got the same bad result when I tried to custom my own cobra and wasted a lovely save position. When I learnt where I had gone wrong (demoship and save game require the top name of the ship (I mean the ship title at the top of the file to clarify) , not the designated model title name under the model key, I'd deleted the file and will have to start again.
Ive got original files on a usb stick, current working files on this pc, and the actual pc I play on is a seperate machine entirely :D Going to get the OXP working here before it goes near my gaming machine :D

I didnt copy over the whole rusties pack from usb stick to this machine created my own oxp folder and sub folders then coppied over just the cobra models and textures and all the plists, before cutting down the plists to just cobra information.

so far so good

Got my custom cobra appearing in the shipyard and am playing around with it there, going to see if I can remove non player versions next... final stage will be the model and texture rename... then my shiney new personal cobra will be ready to go, Im assuming that once Ive brought my ship I can stop it appearing in the shipyard again by changeing the chance key to 0 after Ive brought the ship
the way i was shown to do it is....

https://bb.oolite.space/viewtopic.php?t=4677&highlight=

Posted: Tue Jul 15, 2008 1:37 pm
by Amen Brick
EDIT: doh, multi tabs leading to posting in wrong thread.

Posted: Tue Jul 15, 2008 2:01 pm
by LittleBear
The like_ship needs to be to the <key></key> that defines the orginal entry. Other than that it looks OK. At work ATM so can't remember what the cobra III is called as its entry name. Have a look in the native shipdata file, but it needs to be cobra3_trader (or whatever its called) rather than by the name of the ship.

Posted: Tue Jul 15, 2008 3:03 pm
by JensAyton
Davidtq wrote:

Code: Select all

<plist version="1.0">

<key>DSHspecial</key>
    <dict>
        <key>like_ship</key>
        <string>Cobra Mark III</string>
        <key>model</key.
        <string>dshspecial.dat</string>
        <key>name</key>
        <string>DSHspecial</string>
    </dict>
If you have this in the appropriate place, your run log should have a helpful message like:
XML parser error:
Encountered unexpected character . on line 7
This is actually only the first of a number of errors… but I’d recommend not even trying to write in XML format. There’s no need with the test releases. Use OpenStep syntax instead.

There’s an overview of both plist syntaxes on EliteWiki. Having fixed the . error mentioned above, your plist translates to OpenStep syntax as:

Code: Select all

DSHspecial = 
{
    like_ship = "Cobra Mark III";
    model = "dshspecial.dat";
    name = "DSHspecial";
}
But what it should look like is:

Code: Select all

{
    DSHspecial = 
    {
        like_ship = "Cobra Mark III";
        model = "dshspecial.dat";
        name = "DSHspecial";
    }
}
(In XML, the corresponding fix would be to add a <dict> immediately after the <plist>, and another </dict> at the end; you’re also missing a </plist>.)

Having defeated the evil syntax errors, you should have a “roles” entry for every ship.

Posted: Tue Jul 15, 2008 3:23 pm
by Davidtq
Right will play around with the like-ship version later as it looks more efficient than creating a whole new entry...

Got my custom ship down to player only under a seperate name entry from the rusty and seperate texture and model names so its now completely compatible with the rusty oxp as well :D

all in all its a good start.

I also think that having a "working" single ship oxp will be a good tool for playing with new models etc as I know the plist side works and Ive just got to alter variables to work etc :D

Posted: Tue Jul 15, 2008 10:41 pm
by pagroove
And how does your variant look? (screenshot asked 8) )