RimWorld

RimWorld

38 ratings
Simple Loot Box
   
Award
Favorite
Favorited
Unfavorite
Mod, 1.5, 1.6
File Size
Posted
Updated
1.337 MB
11 May @ 9:13am
12 Jun @ 9:28pm
4 Change Notes ( view )

Subscribe to download
Simple Loot Box

Description
This mod does not do anything on its own. It is more like a framework for other modders to make loot boxes with only XML-level modding knowledge.

The idea and basic design of the loot box are originally from the mod LootBoxes - Rimworld Surprise Mechanics by OniJechto. The original mod scans through the game's defs and sets a mathematical curve to pick potential prizes based on their market values. This might not work very well for a heavily-modded game where hundreds of thousands of modded items may exist, and some may even have strict restrictions. Also, it does not include pawns as rewards. So, I rewrote the mod to allow a smaller pool of prizes and added many more functionalities to make the loot box more immersive and enjoyable.

Incompatibilities? The only mod that might cause problems is Real Faction Guest, because it changes how the pawn generation is handled.

If you need help making a loot box or want me to add more functions to this mod, you can leave a comment. I will see if I can do something.

Language support: All strings in the code have been replaced with translation keys. The languages folder includes examples keyed in English and Simplified Chinese.

This is a mod requested by NHUX, made by Verniy709.

If you want to know how to make a loot box, please refer to the examples. These examples include all functions you might need to create a lootbox with different items, pawns, and themes.

https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=3479904886


Available parameters for loot boxes:

CompProperties_LootBox

lootBoxOpenSound: The sound effect played when entering the loot box opening screen.

lootBoxSpinningSound: The sound effect played during the spinning.

lootBoxBackgroundMusicSound: Background music for the loot box opening window.

lootBoxBackgroundTexturePath: Background image for the loot box window.

lootBoxOpenCost: The item required to open the loot box. It can be silver, a custom key, or any other item.

lootBoxOpenCostCount: The number of items required to open the loot box.

CompProperties_LootBox - lootBoxThingDef

thingDef : The defName of items that can be obtained from the loot box.

count: The quantity of the item to be generated.

weight: The generation weight of this reward.

stuff: If this item is stuffable, it will use the stuff specified here.

quality: If the item has quality, it will use the specified quality here.

effecterDef: An optional effect to play when this reward is generated.

lootBoxFinalizingRewardSound: The sound effect played when this reward is selected.
isHidden: Whether this item should be hidden from the visible reward list. If you want to surprise the player, set this to true.

CompProperties_LootBox - lootBoxPawnKindDef

pawnKindDef: The defName of a pawn that can be obtained from the loot box.

count: The number of pawns to be generated.

weight: The generation weight of this reward.

effecterDef: An optional effect to play when this reward is generated.

lootBoxFinalizingRewardSound: The sound effect played when this reward is selected.

isHostile: Whether the generated pawn is hostile to the player.

isHidden: Whether this item should be hidden from the visible reward list. If you want to surprise the player, set this to true.

CompProperties_SpawnLootBox - lootBoxList
thingDef: The loot box's defName, added to the global drop list for killing creatures; if you have a custom key item, consider adding it here as well.

chance: The drop chance of this loot box after killing a creature.

lootBoxSpawnGroup: To spawn a loot box every designated day in the game map(daysBetweenLootBoxSpawns), assign it to a lootBoxSpawnGroup. All loot boxes in the same group share the chance to spawn, based on their assigned weightInGroup.

weightInGroup: The generation weight of this loot box in its group

daysBetweenLootBoxSpawns: The frequency of spawning the loot box. daysBetweenLootBoxSpawns = 7, meaning spawn of a such a lootbox every 7 days in the game. All loot boxes in the same lootBoxSpawnGroup should have the same daysBetweenLootBoxSpawns



8 Comments
乐正汐弦 14 Jul @ 2:14am 
太带派了老铁
Genocide 21 Jun @ 4:36am 
I actively kiss creators of loot box mechanics
GeekyRaptorStudios 16 Jun @ 8:26am 
I actively hate loot box mechanics
阿尔莱德·阿基曼 23 May @ 6:55am 
怪,很怪啊
孤独梦游者 18 May @ 7:07am 
哈人
DinoSplash 18 May @ 6:36am 
While this look interesting
Make this mods can customize loot box in game would be better
Կyryη 15 May @ 11:42am 
пиздец
PiccoloDom 11 May @ 10:30pm 
东北雨姐还在追我