Overriding shipdata entries in the core game and in other OXPs

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: another_commander, winston

Post Reply
UK_Eliter
---- E L I T E ----
---- E L I T E ----
Posts: 1134
Joined: Sat Sep 12, 2009 11:58 pm
Location: Essex (mainly industrial and occasionally anarchic)

Overriding shipdata entries in the core game and in other OXPs

Post by UK_Eliter »

Hi all

I'd like to toughen up rock hermits. I thought I'd do this via an OXP - well OXZ - containing a `shipdata-overrides.plist` but . . I'm pretty rusty. (Like an old rockhermit.) So, some questions.

1) Can I use wildcards in an entry in `shipdata-overrides.plist`, so as to match multiple ship names?
2) Can one generate random mumbers within shipdata?

If the answer(1) to 1 and/or is 'no', then is there some javascript way of doing these things? I think I used to know this stuff, and I'm sorry if I'm asking for spoon-feeding.

User avatar
Milo
---- E L I T E ----
---- E L I T E ----
Posts: 361
Joined: Mon Sep 17, 2018 5:01 pm

Re: Overriding shipdata entries in the core game and in other OXPs

Post by Milo »

Hi UK_Eliter! I use several of your OXPs (Interstellar Tweaks, Extra Thargoids, Ferdelance_3G and Nexus Missile), so thanks for your contributions to the Ooniverse!

What kind of toughening up do you have in mind? Depending what you are doing, you might be able to just override the three rockhermit templates:

oolite_template_rock-hermit
oolite_template_rock-hermit-chaotic
oolite_template_rock-hermit-pirate

You can't use wildcards for overrides, the key names have to match exactly.

I don't think you can put any string expansions into the shipdata, so you would probably need to use Javascript for any randomization. There are several ways to locate existing hermits with Javascript and apply changes to them. Since there are variations in how OXPs spawn hermits and name them, you may want to use a flexible matching approach like system.entitiesWithScanClass("CLASS_ROCK") to find all rock class objects in the system and then check if the name or shipClassName property contains (indexOf) the substring "hermit" ...

See http://wiki.alioth.net/index.php/Oolite ... hScanClass for details on optional parameters.

Thinking about this a bit more, if the kind of randomization you want to do involves randomization of what what types and quantities of defense ships hermits will have... you could override the max_defense_ships property of the templates and create new non-override shipdata entries that are like_ship of the various defense ships you want to use but have roles corresponding to the roles defined for hermits’ defense ships ("hermit-ship"), with varying chance percentages in the roles property. For random quantities, you can provide one shipdata entry with the same role as the defense ships but with an attached script to remove itself, effectively adding a “nothing” chance. This idea is a variation of the "OVERRIDE" shipdata entry you used in Extra Thargoids to reduce spawn rates of TCAT drones and controllers by adding a chance to spawn regular tharglets with the same role as the drones and controllers.

UK_Eliter
---- E L I T E ----
---- E L I T E ----
Posts: 1134
Joined: Sat Sep 12, 2009 11:58 pm
Location: Essex (mainly industrial and occasionally anarchic)

Re: Overriding shipdata entries in the core game and in other OXPs

Post by UK_Eliter »

Thank you for your detailed reply, and for your thanks! (I may not have contributed to the universe, but I have contributed to the Ooniverse!)

What I had in mind: primarily just increasing energy levels. However, your idea of changing or adding defence ships is a good one (and having them, as a kind of easter egg, very rarely launch tharglets - that would be fun! Also, though, just launching some 'heavy' or 'hard' pirates would be good). Furthermore: if it is not too hard - it might be too involved - adding a random number of turrets would be good.

I do not think that I (myself!) have the energy for this right now, though - even though you reminded me of some useful techniques (one of which was my own anyway!). So, I'll file away a link to this post and hope to return to it later.

User avatar
Milo
---- E L I T E ----
---- E L I T E ----
Posts: 361
Joined: Mon Sep 17, 2018 5:01 pm

Re: Overriding shipdata entries in the core game and in other OXPs

Post by Milo »

Having learned a bit more about the internal workings of the game, I think the "nothing" chance idea might not fly, so to speak. The station might keep trying to launch more defense ships to fill its quota. I haven't looked into this. Of course if that's the case, you could just put something armed with a mining laser in the role.

dybal
---- E L I T E ----
---- E L I T E ----
Posts: 407
Joined: Mon Feb 10, 2020 12:47 pm
Location: São Paulo, Brasil

Re: Overriding shipdata entries in the core game and in other OXPs

Post by dybal »

Milo wrote:
Fri Jul 10, 2020 12:02 am
There are several ways to locate existing hermits with Javascript and apply changes to them. Since there are variations in how OXPs spawn hermits and name them, you may want to use a flexible matching approach like system.entitiesWithScanClass("CLASS_ROCK") to find all rock class objects in the system and then check if the name or shipClassName property contains (indexOf) the substring "hermit" ...
I do it using the Rock Hermit roles (rockhermit, rockhermit-chaotic, rockhermit-pirate, pirate-cove) and system.shipsWithPrimaryRole

UK_Eliter
---- E L I T E ----
---- E L I T E ----
Posts: 1134
Joined: Sat Sep 12, 2009 11:58 pm
Location: Essex (mainly industrial and occasionally anarchic)

Re: Overriding shipdata entries in the core game and in other OXPs

Post by UK_Eliter »

Thanks, dybal. Which OXP(s) do you use that in? (I think I'll keep using 'OXP' to mean expansion pack, i.e. OXP and OXZ - for, I'm used to that term.)

dybal
---- E L I T E ----
---- E L I T E ----
Posts: 407
Joined: Mon Feb 10, 2020 12:47 pm
Location: São Paulo, Brasil

Re: Overriding shipdata entries in the core game and in other OXPs

Post by dybal »

I've been working on a replacement for Rock Hermit Locator, but adding the Beacons to the Rock Hermit themselves instead of creating Navigation Buys with the beacons (by phkb suggestion), and breaking it up into two OXPs, one to create the beacons and make RH visible on ASC (no extra equipment necessary) and the F4 In-system distances screen when docked, and another one (which requires the first) to restrict the ASC visibility of the RH beacons to the existence of a functional RH Locator in the player ship (for TANSTAAFL ooniverses).

It's in hold right now for some ideas about the RHs that shouldn't have a beacon develop themselves...

UK_Eliter
---- E L I T E ----
---- E L I T E ----
Posts: 1134
Joined: Sat Sep 12, 2009 11:58 pm
Location: Essex (mainly industrial and occasionally anarchic)

Re: Overriding shipdata entries in the core game and in other OXPs

Post by UK_Eliter »

Oops.

Just now I spend an hour or so staring to create a 'HarderHermits' OXP. Once I'd made a first version that I was about to test, I decide - a little late . . - to see whether any other OXP existed already that was similar. And . . there's Sparas' Spicy Hermits, which toughens up hermits, and does more. So, I've reinvented the wheel.

Now, the hermits are still not hard enough for my liking, and so I'd like to make an OXP that adds to Spara's. But I find that Spara's OXP already uses shipdata overrides - as mine does - so I do not know what to do or even what I want to do. To explain that last bit - 'or even what I want to do' - do I want to add more types of hermit? Do I want to beef up Spara's already-beefed-up-hermits? Or what?

UK_Eliter
---- E L I T E ----
---- E L I T E ----
Posts: 1134
Joined: Sat Sep 12, 2009 11:58 pm
Location: Essex (mainly industrial and occasionally anarchic)

Re: Overriding shipdata entries in the core game and in other OXPs

Post by UK_Eliter »

OK, I think I will use the 'shipspawned' event, through a worldscript. That way I can detect ships that have one of the hermit primary roles and then do some randomised increasing of any such ships' maxEnergy. This will beef up both 'un-spiced' hermits and 'spiced' ones. And it should be easy to do. But since Spicy Hermits saves hermit locations, I suppose I'd better check whether any 'beefing' that I do will get saved too (and, if it doesn't, I shall insert some HandWavium).

Post Reply