Page 1 of 1

Help - how to change the randomness of cargo pod contents?

Posted: Mon Sep 19, 2011 4:02 am
by hangar18
I downloaded the pods OXP (under mechanics) which changes not only the chance of getting > 1t of cargo but also cargo jams, explosions, empty pods and the like. I want to increase the probabilities of each outcome but cannot see anywhere under the config or scripts folders where to do this. I can confirm the mod works and as the author states, each probability is small.

E.g.

Excerpt from shipdata.plist in config....

"pods_emptybarrel" =
{
like_ship = "barrel";
cargo_type = "CARGO_SCRIPTED_ITEM";
roles = "cargopod(0.1) pods_emptypod emptyPod emptypod";
scanClass = "CLASS_CARGO";
script = "pods_emptypod.js";
};


Now the line that says roles="Cargopod(0.1) pods.... I thought that the 0.1 might mean 10% chance of this happening but have tweaked the 0.1 to all sorts of numbers (0.9,1.0, 100, 1000) and it doesnt make any difference


Excerpt from the scripts folder for determining the amount of cargo (in tons). I can see random()*10 equates to 1-10 tons as stated in the readme but dont know what the function scooper is all about or where the probabilities lie.

this.shipWasScooped = function(scooper)
{
if(scooper.isPlayer && player.ship.cargoSpaceAvailable > 0)
{
let award = (Math.ceil(Math.random()*10));
let cargo = expandDescription('[pod_content_tons]');
if(player.ship.cargoSpaceAvailable > award)
{
player.consoleMessage(award + " tons " + cargo, 6);
manifest[cargo] += award;
}
else
{
player.consoleMessage(player.ship.cargoSpaceAvailable + " tons " + cargo + " - hold full", 6);
manifest[cargo] += player.ship.cargoSpaceAvailable;
}
}
}


If anyone can help I would be most grateful!

Cheers

Re: Help - how to change the randomness of cargo pod content

Posted: Mon Sep 19, 2011 4:49 am
by Thargoid
The 0.1 is the thing you need to change, but after doing so you also need to restart the game with the shift key held down to clear the cache. Otherwise even though you've editted the OXP your change isn't seen as it still uses the old cached version (at least until you shift-start or add/remove completely an OXP at which point the cache is rebuilt anyway).

The figure represents the weighting of that particular entity within the pool of entities with that role. So for example if you have two OXPs, one with a role "superDuperShip(0.1)" and the other with "superDuperShip" then you'll have a 1 in 11 chance of seeing the first one and a 10 in 11 chance of seeing the second one. So it's not really a 10% chance per-se as if you only had the first OXP installed then you would always see the first ship, regardless of the 0.1 (as it's the only possibility, even with a low weighting).

However in this case you have the built-in cargo pods from the trunk shipdata.plist, so they will be the most common (as they have a role weighting of 1), but as there are many different pods from the OXP then at least one of them will still appear reasonably often (the sum of the role weightings of all the pods in the OXP is probably quite close to 1, or even maybe a little more than 1).

Oh and don't edit the script files themselves unless you want to change how the pods actually work, or you may risk breaking things. The scooper in the script is the ship which scooped them pod in this case (the function triggers when the pod is scooped) and deals with what should happen ( in this case calculating a random amount of booty and awarding it). The probability isn't in there, only what happens once that particular pod (the ton value big pod in this case) is scooped.

Hope that makes sense (as I'm typing this at 5:50am having been awake for about 15 minutes), but in a nutshell I think you may need the shift-restart to see your changes in-game.

Re: Help - how to change the randomness of cargo pod content

Posted: Mon Sep 19, 2011 7:12 am
by hangar18
Wow thanks for that, makes sense!

I'll give the shift key a whirl tonight and see if it works.

Cheers