Page 1 of 1

Question regarding shipdata.plist commands

Posted: Thu Apr 17, 2008 6:40 pm
by Lestradae
Hye to all who might know or could point me to a FAQ or readme or the like:

Is it possible to somehow tell the game to ...

Code: Select all

<key>equivalent_tech_level</key>
<integer>systemTechLevel_number + 3</integer>
... you know what I mean?

Please let me know 8)

L

Re: Question regarding shipdata.plist commands

Posted: Fri Apr 18, 2008 5:46 am
by Commander McLane
Not as such, but I can imagine two workarounds.

(1) Make a clone of your station for every techlevel. In the one for techlevel 0 you put

Code: Select all

<key>equivalent_tech_level</key>
<integer>3</integer>
The clone for techlevel 1 gets

Code: Select all

<key>equivalent_tech_level</key>
<integer>4</integer>
and so on.

Then you have to spawn the correct station in relation to the system's techlevel. This you do either in planetinfo.plist or in script.plist. (I don't know what you're planning to do.)

(2) Maybe, and this is a big maybe, it is possible to achieve what you want either in setup_actions or in launch_actions (these work similar to script_actions, which you have already used, but are performed earlier).

Code: Select all

		<key>setup_actions</key>
		<array>
			<string>set: local_tech_level [systemTechLevel_number]</string>
			<string>add: local_tech_level 3</string>
		</array>
		<key>equivalent_tech_level</key>
		<integer>[local_tech_level]</integer>
It all depends on what is performed earlier, the whatever_actions or the assignment of equivalent_tech_level. If the latter is the earlier, the variable would not yet be defined, and the whole thing would not work. If the equivalent_tech_level is assigned later, then it could work (but still no guarantee).

One problem is that in 1.70 local_variables don't seem to work properly. So you may have to use another version to test it. Or replace it with a mission_variable. Another problem is that in 1.70 also the correct functioning of setup_actions and launch_actions cannot be guaranteed.

So it is probably safer to go with the first option.

Thanks for your reply ...

Posted: Fri Apr 18, 2008 8:59 am
by Lestradae
Hi,

hm, your reply made it obvious to me how many things I still don`t know about scripting :oops:

What I`m actually trying to do is utilise the old SIRFYard oxp, obviously for a future Realistic Shipyards version.

I did rename the station into "Special Interstellar Repair & Shipyard Facility" and want one to appear in the main station aegis every fourth time or so with a shipyard facility of two or three tech levels higher than the system it is in; and with an equipment dock that is a bit more expensive (1.1 or 1.2) than the norm, but for that offers equipment that the main station doesn`t have (because of the higher TL).

That`s what I need the "system_tech_level +3" thing for.

I also haven`t understood how to slow down the rotation of the ringthings on the station. I changed the ships on display`s rotation to more fitting, but didn`t find how to do this with the rings.

And how to make it appear at random every fourth time.

Thanks for the possibilities you explained above,

still trying to learn 8)

L

Posted: Fri Apr 18, 2008 11:36 am
by Commander McLane
Okay, never mind. :wink:

Let's try step by step. (Sorry, this is very short, I'm a bit in a hurry. Hope you understand it nevertheless.)

The first thing you need for your new station (apart from the model and texture, of course, but those are already there) is a shipdata-entry. I think you already know how that looks like. For a start just take the one from the original SIRFYard.oxp. Copy and paste it to your own shipdata.plist.

Now rename it. (That's the whole entry, not the <key>name</key>-thing.) Give it a unique name, which has to be particularly different from its original name. Let's say "realistic-shipyards-sirfyard-0".

Insert the techlevel-key (if it isn't already there), give it a value of "3". This will be your station for all techlevel 0-systems (hence the name). Finally you have to give it a unique role. It should be something like "realistic_shipyards_sirfyard_0" (there is sort of a convention that entry-names have dashes and roles have underscores, but it's not necessary).

Now copy and paste the whole thing again. This time you name it "realistic-shipyards-sirfyard-1", give it a techlevel of "4" and the role "realistic_shipyards_sirfyard_1". This will be for all techlevel 1-systems.

Copy and paste again, name it "realistic-shipyards-sirfyard-2", give it a techlevel of "5" and the role "realistic_shipyards_sirfyard_2"...

And so on, until you have 15 copies of that same entry in your shipdata.plist, each one with its own number at the end of its name and role, and its corresponding equivalent_tech_level, which should always be 3 more than the number in the name and role.

This is what we call "clones" of a station. They look the same, for the player they are indistinguishable, except that at different places he will meet a different clone.

Now you want to put them in systems. One quarter of all systems. For this we need some random. Complete random, however, means that the player will come to a certain system, let's say Diso, once and meet a SIRFYard there. The next time he returns the SIRFYard may be gone, because this time it doesn't get a random chance. Not satisfactory.

But this is what pseudo-random is for. "pseudoFixedD100_number" creates a random number between 0 and 99 for each system, and every time it creates the same number for the same system. This is what you need.

So now you can write your script.plist. First you need the condition STATUS_EXITING_WITCHSPACE. This is when you create your station. Then you need the condition pseudoFixedD100_number lessthen 25. This will create it in 25% of all systems. Finally a couple of conditions to figure out which of the clones has to be created.

Here is the script:

Code: Select all

                {
                    conditions = ("status_string equal STATUS_EXITING_WITCHSPACE"); 
                    do = (
                        {
                            conditions = ("pseudoFixedD100_number lessthan 25"); 
                            do = (
                                {
                                    conditions = ("systemTechLevel_number equal 0"); 
                                    do = ("addSystemShips: realistic_shipyards_sirfyard_0 1 0.99"); 
                                },
                                {
                                    conditions = ("systemTechLevel_number equal 1"); 
                                    do = ("addSystemShips: realistic_shipyards_sirfyard_1 1 0.99"); 
                                },
                                {
                                    conditions = ("systemTechLevel_number equal 2"); 
                                    do = ("addSystemShips: realistic_shipyards_sirfyard_2 1 0.99"); 
                                },
                                 . 
                                 .
                                 .
                            ); 
                        }
                    ); 
                }

Posted: Fri Apr 18, 2008 12:57 pm
by matt634
Lestradae, I did something very similar to this in galactic navy for the SecComs on advice from Commander McLane. It might be helpful to look at the shipdata.plist and script and see what I did.

.

Posted: Fri Apr 18, 2008 5:37 pm
by Lestradae
Thanks, both of you, especially Commander McLane, for the patient and detailed explanation!

I will look into it as sson as I find the time in RL.

Cheers :)

L

Now that`s weird ...

Posted: Fri Apr 18, 2008 10:24 pm
by Lestradae
Hm, I have run into a problem that might have to do with me being blind again :x (which is entirely possible) or something does not work as intended with "hasShipyard" and "equivalent_tech_level" in combination.

I am experimenting with something that is not much more than a (very) slightly edited version of the original SIRFYard oxp (yet).

After inserting the following into its shipdata.plist:

Code: Select all

<key>name</key>
                <string>Special Interstellar Repairs & Shipyard Facility</string>
                <key>hasShipyard</key>
                <true/>
                <key>equipment_price_factor</key>
                <real>1.1</real>
                <key>equivalent_tech_level</key>
                <integer>3</integer>
... I made a testflight. Started up Oolite, pressed the SHIFT key, loaded a savegame in a TL 15 system.

A look into the equipment store of the main station, all the TL 15 equipment there. Another look into the main station shipyard, exactly the kind of ships there that the Realistic Shipyards place into such a TL.

I get out the station. There it is, the Special Interstellar Repairs & Shipyard Facility. OK, I dock, have a look at the equipment shop again. Interesting: Only Pulse Laser, Plasma Cannon etc., all costs 10% more. So only TL 4 equipment there as testwise intended.

But then I have a look into the shipyard. It contains exactly the same ships as the main station shipyard, not the TL 4 ones.

Strange. I compared with Random Hits oxp`s solution to this which has also shipyards enabled in the Space Bars. It was done there the same way I did it.

Someone any wiser than me? Did I use some wrong sequence or whatever? Or is some command in the core game not working as intended? I did read through the whole shipdata.plist how-to entry on the wiki but was none the wiser. Is this working in Random Hits?

Help? :oops:

L

Posted: Sat Apr 19, 2008 11:11 am
by LittleBear
I'd need to check it out with a playtest, but I think in Random Hits the Space Bar has the EQUIPMENT at the correct equivalent_tech_level but has the same SHIPS FOR SALE as the Main Station's Tech Level. Ie:- In a Tech 4 Anarchy the Bar may have Military Lasers etc for sale, but only has SHIPs at the Tech 4 level. I think equivalent_tech_level only effects the equipment for sale not the ships.

Posted: Mon Apr 21, 2008 7:25 am
by Commander McLane
I tend to agree with LB, that equivalent_tech_level influences only the prices of equipment, not the shipyard. This is unfortunate, but seems to be just the way the game engine works. (Unless you request a change of that.)

Apart from that I'm happy to see that I could be helpful and it seems to work. One question, though: Shouldn't the SIRFYard in a TL 15 system have a TL of 18, not 4? Which brings me to a small issue: Of course on the high end TL worlds the whole thing doesn't really make sense anymore. In a TL 14 or TL 15 system the player wouldn't have anything to gain anymore, because he already gets all equipment in the main station.

.

Posted: Mon Apr 21, 2008 7:47 am
by Lestradae
Hye! :)
I tend to agree with LB, that equivalent_tech_level influences only the prices of equipment, not the shipyard. This is unfortunate, but seems to be just the way the game engine works. (Unless you request a change of that.)
I did, and I think it was changed in 1.71 as far as I understand the changes list and Ahruman`s comment to "wait for two days" two days ago. :wink:

Still have to test if it really works now, though.
Apart from that I'm happy to see that I could be helpful and it seems to work.
Yes, thanks again. You could, and it seems. :)
Shouldn't the SIRFYard in a TL 15 system have a TL of 18, not 4? Which brings me to a small issue: Of course on the high end TL worlds the whole thing doesn't really make sense anymore. In a TL 14 or TL 15 system the player wouldn't have anything to gain anymore, because he already gets all equipment in the main station.
I thought of two ways to do something about this. One way would be to give a TL 16-18 station something new to do. For example, split some of the ultra veteran ships into even higher TLs so that you can only get them at a SIRFYard in an already ultra-high tech system.

Or alternatively, from TL 12-13 (system standard) onwards the range of equipment and ships that are offered at a SIRFYard basically stays the same, but the equipment offered gets cheaper than more expensive, thereby a TL 18 SIRFYard in a TL 15 system would still offer something new to the player.

Timed with Oolite 1.71, I am aiming for an as usual megalomanic re-release of the Realistic Shipyards OXP anyways - if you have a look under my signature, there already is a bit of information on that on my wiki page. :wink:

Thanks again for the extensive step-by-step explanation! :D

L