Relative rarity isnāt much of a flaw. Percentages are more appealing, but itās hard to tell what percentage is good. Usually you express issues relative to the current spawnrates anyway; you donāt know that, hypothetically, a 65% chance of a welder is right, you just know welders are too rare right now.
The big issues I see with the current system are these:
[ol][li]As noted, the rarity of items is shared in every location they spawn in.[/li]
[li]Your only control over how many items spawn is place_items()'s āchanceā parameter, which is inadequate for a lot of purposes. You canāt try to spawn 1-2 random, rare items without having a chance of spawning eight items. You canāt try to spawn a backpackās worth of junk without a chance that youāll flub the first roll and spawn nothing. For the vast majority of purposes, it would be better to just spawn an exact number of items passed as a parameter, and give full control of any randomization in that regard to whateverās calling the function.[/li]
[li]You canāt easily make a list that spawns a bunch of separate entries at once; this makes it impossible to spawn a sensible suit of clothes, or a gun and matching ammo, without an awkward hack.[/li]
[li]You canāt nest spawn lists in each other, meaning you need to redefine common components of a more specific list, such as clothing.[/li][/ol]
The last two problems are big issues for complex cases like āa dead soldier, with a random set of equipmentā. In my mind, something broadly similar to this is ideal:
[ul][li]100% chance of 1 human corpse[/li]
[li]100% chance of 1 set of military clothing[/li]
[li]50% chance of 1 possibly-loaded military primary weapon and ammo[/li]
[li]25% chance of 1 possibly-loaded military side arm and ammo[/li]
[li]75% chance of 1 combat knife[/li]
[li]20% chance of 1-3 military grenades[/li]
[li]20% chance of 1-2 military medicines[/li]
[li]60% chance of 1-2 military food items[/li][/ul]
Spawning a bunch of subentries separately and nesting further lists makes this a lot easier, because you can say āI need a soldierās uniformā or āI need a loaded rifle and maybe ammoā and cut to the more important features. The alternative is to hammer out ā1 shirt, 1 pants, 1 boots, maybe a vest, maybe a helmet, blah blah blahā¦ā every time you want to give someone a uniform. This way, you can give a dead soldier, a dead soldier zombie, and a locker in the barracks the same type of uniform easily, and itās guaranteed to result in a coherent uniform rather than something inane.
This kind of list where you have a separate chance of spawning every item on the list is very useful, but the existing kind of raffle-style list is still better for simpler cases. If youāre spawning prescription drugs at a pharmacy, and you just want a bunch of random prescription drugs, you still want to have lists where where each entry is just āx amount of y drug, with z raffle ticketsā and you just choose one entry, then probably repeat a bunch of times.
The other downside to this style is that excessive predefined detail and a dearth of random elements can make the world feel flat. You might want dead soldiers to have a low chance of carrying two rifles for whatever reason, or a spare pair of pants, or a bag of pretzels; the above list wonāt do that unless you remember to add them. You can mollify the issue by adding low chances of spawning additional items with a very wide range of possible types. Itās still best to reserve this degree of structure for instances where excessive randomness is very noticeable, like the gear on a corpse; itās acceptable to find a crate or locker holding a weird mix of junk, or a gun shop stocking weapons and ammunition that prove
These lists are the way itās done in Bethesda Softworks RPGs; I didnāt come up with the system myself. Itās intricate, but not really moreso than necessary, and the system doesnāt need to be conveyed to the player.