How do you set the frequency of a ship appearing?
Moderators: winston, another_commander
- Smivs
- Retired Assassin
- Posts: 8408
- Joined: Tue Feb 09, 2010 11:31 am
- Location: Lost in space
- Contact:
How do you set the frequency of a ship appearing?
Hi,
I'm hard at work on my next OXP and would like to set how frequently a ship appears as a pirate. I've specified the pirateAI.plist and set the role as Pirate/Hunter in the ship's shipdata.plist, and it's working fine, but I want this particular ship to only appear very infrequently.
Can this be done via the shipdata.plist, or will I have to 'import' the pirateAI.plist into an AI folder within the OXP and change some parameters? If so, what will I need to change?
Any help or advice gratefully received.
I'm hard at work on my next OXP and would like to set how frequently a ship appears as a pirate. I've specified the pirateAI.plist and set the role as Pirate/Hunter in the ship's shipdata.plist, and it's working fine, but I want this particular ship to only appear very infrequently.
Can this be done via the shipdata.plist, or will I have to 'import' the pirateAI.plist into an AI folder within the OXP and change some parameters? If so, what will I need to change?
Any help or advice gratefully received.
Commander Smivs, the friendliest Gourd this side of Riedquat.
You do it in the shipdata.plist, in the role line. For example if you set pirate(0.1) then the ship's chances are 10x less than a "standard" pirate (ie they will appear less often when the populator is called on to add a pirate). Similarly putting pirate(1000) will make them almost always appear when one is called for (but that's bad manners against other OXP writers and their ships if it's a generic role), and pirate(0) would make them never appear - useful if you want to use a role in a check (ship.hasRole("x") in JS or some-such) but don't want it to actually be included in the pool of ships with that role. Note that there is no space between the role and the weight (the number in the bracket).
The populator works by basically putting all ships available with that particular role into a hat (ok a space helmet) and picking one at random. Hence the more OXPs you have which add ships with a particular role ("pirate" or "trader" for examples) the less chance there is of seeing any particular one of them when you encounter a pirate or a trader or whatever. Similarly if you give a particular ship a higher or lower weighting as per the above, you similarly affect the chances of seeing that ship compared to all the other available in the pool.
Hope that makes sense - it works for any role, not just pirate. In your case just make it's role "pirate(0.1)" or something like that (in addition to any other roles you may want to give it).
The populator works by basically putting all ships available with that particular role into a hat (ok a space helmet) and picking one at random. Hence the more OXPs you have which add ships with a particular role ("pirate" or "trader" for examples) the less chance there is of seeing any particular one of them when you encounter a pirate or a trader or whatever. Similarly if you give a particular ship a higher or lower weighting as per the above, you similarly affect the chances of seeing that ship compared to all the other available in the pool.
Hope that makes sense - it works for any role, not just pirate. In your case just make it's role "pirate(0.1)" or something like that (in addition to any other roles you may want to give it).
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
- Smivs
- Retired Assassin
- Posts: 8408
- Joined: Tue Feb 09, 2010 11:31 am
- Location: Lost in space
- Contact:
That's great, Thargoid, thanks a lot. I'll try it out.
Commander Smivs, the friendliest Gourd this side of Riedquat.
- JazHaz
- ---- E L I T E ----
- Posts: 2991
- Joined: Tue Sep 22, 2009 11:07 am
- Location: Enfield, Middlesex
- Contact:
I assume that if I want to increase the availablity for purchase of a particular OXP ship in the shipyard, I have to edit the OXP's shipyard.plist?
JazHaz
Thanks to Gimi, I got an eBook in my inbox tonight (31st May 2014 - Release of Elite Reclamation)!Gimi wrote:Maybe you could start a Kickstarter Campaign to found your £4500 pledge.drew wrote:£4,500 though! <Faints>
Cheers,
Drew.
- Smivs
- Retired Assassin
- Posts: 8408
- Joined: Tue Feb 09, 2010 11:31 am
- Location: Lost in space
- Contact:
That's right. I think the way to do that is to reduce the Tech Level they're available at.JazHaz wrote:I assume that if I want to increase the availablity for purchase of a particular OXP ship in the shipyard, I have to edit the OXP's shipyard.plist?
Commander Smivs, the friendliest Gourd this side of Riedquat.
- Disembodied
- Jedi Spam Assassin
- Posts: 6885
- Joined: Thu Jul 12, 2007 10:54 pm
- Location: Carter's Snort
Editing the tech level will obviously allow the ship to be sold on a wider range of planets, but the bit you have to edit in the Shipyard.plist isJazHaz wrote:I assume that if I want to increase the availablity for purchase of a particular OXP ship in the shipyard, I have to edit the OXP's shipyard.plist?
Code: Select all
<key>chance</key>
<real>0.4</real>
If you want to give yourself a unique, custom ship by making an OXP, obviously you need to set the chance to 0.0 so you don't ever find your own ship for sale ...
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
But, how do you get it than in the first place?Disembodied wrote:If you want to give yourself a unique, custom ship by making an OXP, obviously you need to set the chance to 0.0 so you don't ever find your own ship for sale ...
I know of one oxp that uses the conditions to manipulate appearance. Chance is set to 1 but because of the condition it only starts appearing for sale when the oxp decides to set the missionVariable to the correct value.
Code: Select all
<key>chance</key>
<real>1</real>
<key>conditions</key>
<array>
<string>mission_xxxxx equal AVAILABLE</string>
</array>
UPS-Courier & DeepSpacePirates & others at the box and some older versions
- Smivs
- Retired Assassin
- Posts: 8408
- Joined: Tue Feb 09, 2010 11:31 am
- Location: Lost in space
- Contact:
It's worth noting that this is also relevant to equipment fitted, so a vaue of 1 will probably mean all the ships for sale will have all the optional equipment fitted.Disembodied wrote:
Editing the tech level will obviously allow the ship to be sold on a wider range of planets, but the bit you have to edit in the Shipyard.plist is
A value of 1 will make it available everywhere with a shipyard and a sufficiently high TL. 0.4, in the example above, gives it a 40% chance of appearing where there's a shipyard and a sufficiently high TL. See here for details.Code: Select all
<key>chance</key> <real>0.4</real>
If you want to buy a 'New' ship to test it, you can always set it to TL1 to find one quickly, then reset the TL in the shipyard.plist afterwards. You might be tempted to set a silly low price as well, but don't...it will have no resale value even if you then change the shipyard price to a sensible level.
Commander Smivs, the friendliest Gourd this side of Riedquat.
- Smivs
- Retired Assassin
- Posts: 8408
- Joined: Tue Feb 09, 2010 11:31 am
- Location: Lost in space
- Contact:
I'm OK with all that, thanks. I'm actually going off on a different tack now, and want to create a bounty hunter role. I've written an AI for it (called bountyhunterAI.plist which I've placed in a AIs folder in the oxp) but can't find a bounty hunter anywhere to test it (I've set the shipdata.plist to 'role=bountyhunter(1000)' to try to generate some). I don't know how the populator works. Will it know about the new role, or are the roles set in stone?Thargoid wrote:
The populator works by basically putting all ships available with that particular role into a hat (ok a space helmet) and picking one at random. Hence the more OXPs you have which add ships with a particular role ("pirate" or "trader" for examples) the less chance there is of seeing any particular one of them when you encounter a pirate or a trader or whatever.
Commander Smivs, the friendliest Gourd this side of Riedquat.
OK, a couple of points. Firstly bountyhunterAI.plist isn't a good name, as it's very generic. There's a fair chance along the line that someone else may write an OXP and re-use that name (or indeed may have done so in the past). If that happens and both OXPs are installed, one bountyhunterAI.plist will overwrite the other and so at least one OXP may not work properly or as expected. It's better for all things (roles specific to OXPs, ship keys (their unique names), models, textures, scripts etc) to use something that will be unique to you. For example your AI could be smivs_bountyhunterAI.plist or prefix it with the OXP name or something like that. Then there's no (or at least minimal) chance of clashes and overwrites.
As to your main question, basically the populator won't see it at all nor will it use it. There are a fixed number of roles that it uses (police, trader, pirate, thargoid, asteroid, station and some others like the buoys) and nothing else. If you want something "individual" like your proposed ships, then you need to write your own populator script (usually in js these days) to spawn and add ships with roles not in the trunk populator. Many OXPs have examples of those in so have a look through them (an example of the top of my head is bigShips OXP, but there are a lot of others). If you get really stuck let me know what roles you want to appear and under what conditions and I'll write you an example script.
Lastly there is the inbuilt role "hunter", which I think is along the lines of what you are thinking of (it's the game's generic bounty hunter role). That one is used by the trunk populator, so if you give your ship that role in its role set then it may appear in the game anyway. If I remember correctly the role acts like police but without the scan class or ability for levying fines and such.
As to your main question, basically the populator won't see it at all nor will it use it. There are a fixed number of roles that it uses (police, trader, pirate, thargoid, asteroid, station and some others like the buoys) and nothing else. If you want something "individual" like your proposed ships, then you need to write your own populator script (usually in js these days) to spawn and add ships with roles not in the trunk populator. Many OXPs have examples of those in so have a look through them (an example of the top of my head is bigShips OXP, but there are a lot of others). If you get really stuck let me know what roles you want to appear and under what conditions and I'll write you an example script.
Lastly there is the inbuilt role "hunter", which I think is along the lines of what you are thinking of (it's the game's generic bounty hunter role). That one is used by the trunk populator, so if you give your ship that role in its role set then it may appear in the game anyway. If I remember correctly the role acts like police but without the scan class or ability for levying fines and such.
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
The other almost mandatory thing if you're beginning to get into OXP writing is to download the javascript console and debug OXP (debug OXP is here in the wiki and the console itself is here on Berlios except for Mac where it's built into the game itself).
You can use that to directly run scripts on the game whilst it's running. Amongst many other things you can use it to directly spawn ships into the game (:spawn <role> is the relevant shortcut command).
As it runs JS commands it's useful to know some, but the basic ones are quite easy (search the wiki for Javascript and look at the various pages it offers) and there are macros like :spawn for simple usage like ship generation for testing purposes.
You can use that to directly run scripts on the game whilst it's running. Amongst many other things you can use it to directly spawn ships into the game (:spawn <role> is the relevant shortcut command).
As it runs JS commands it's useful to know some, but the basic ones are quite easy (search the wiki for Javascript and look at the various pages it offers) and there are macros like :spawn for simple usage like ship generation for testing purposes.
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
- Smivs
- Retired Assassin
- Posts: 8408
- Joined: Tue Feb 09, 2010 11:31 am
- Location: Lost in space
- Contact:
Thanks Thargoid,Thargoid wrote:The other almost mandatory thing if you're beginning to get into OXP writing is to download the javascript console and debug OXP (debug OXP is here in the wiki and the console itself is here on Berlios except for Mac where it's built into the game itself).
You can use that to directly run scripts on the game whilst it's running. Amongst many other things you can use it to directly spawn ships into the game (:spawn <role> is the relevant shortcut command).
As it runs JS commands it's useful to know some, but the basic ones are quite easy (search the wiki for Javascript and look at the various pages it offers) and there are macros like :spawn for simple usage like ship generation for testing purposes.
I think I'm getting in a bit deeper than I wanted to, at least for my current project which is more or less complete and where using the pirate AI is doing 95% of what I want anyway. The detail tweaks I had in mind would have been nice if quick and easy to achieve, but are far from essential. Right now I'm thinking 'It ain't broke...don't fix it'.
The AI and javascript side of things is something that interests me but I don't know much about right now, but I will certainly look into it at some point. Again Thanks for all the help and advice.
Smivs.
Commander Smivs, the friendliest Gourd this side of Riedquat.
- Disembodied
- Jedi Spam Assassin
- Posts: 6885
- Joined: Thu Jul 12, 2007 10:54 pm
- Location: Carter's Snort
I used this method to give myself a named ship. Basically, I saved up for, hunted down and bought a Wolf Mark II SE. Then I made a simple OXP using the same model and stats (player version only), gave it a custom skin, and renamed the ship the "Wolf Mark II SE: Radio Maru". Then I edited my savefile so I was flying the Radio Maru, instead of a generic Wolf II SE. I had to give the custom ship a shipyard.plist, otherwise it would have had a basic resale value of 0, so I also gave it a zero chance of ever appearing for sale, to stop me from encountering a doppelganger sitting in a shipyard ...Eric Walch wrote:But, how do you get it than in the first place?Disembodied wrote:If you want to give yourself a unique, custom ship by making an OXP, obviously you need to set the chance to 0.0 so you don't ever find your own ship for sale ...
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
Sort of cheating than? On the other han not as you replaced it with one of equal value.Disembodied wrote:I used this method to give myself a named ship. Basically, I saved up for, hunted down and bought a Wolf Mark II SE. Then I made a simple OXP using the same model and stats (player version only), gave it a custom skin, and renamed the ship the "Wolf Mark II SE: Radio Maru". Then I edited my savefile so I was flying the Radio Maru, instead of a generic Wolf II SE. I had to give the custom ship a shipyard.plist, otherwise it would have had a basic resale value of 0, so I also gave it a zero chance of ever appearing for sale, to stop me from encountering a doppelganger sitting in a shipyard ...
When you look closely in your save file, you'll find an entry: "shipyard_record". It contains a list of all ships the player once bought. Those will not be offered anymore for sale, when I am right. So with a normal bought ship you won't get a doppelganger offered at all. Editing itself is a bit
Would be a method to prevent players from editing in their own ship when double checking if the loaded ship is in that list.
UPS-Courier & DeepSpacePirates & others at the box and some older versions