Starbound

Starbound

Not enough ratings
OmeLib Guide
By Oмεяυıп
This guide will explain how to use the various different scripts in OmeLib!

Warning: This guide expects you to understand basic patching, JSON editing, and file creation.
   
Award
Favorite
Favorited
Unfavorite
Restricted NPC Color Pool Script
Silver Sokolova made the original script, and I heavily edited it. This script makes it so that you can force certain NPC types to spawn with a restricted set of bodyDirectives, emoteDirectives, and hairDirectives options.
For example, The Nomadic De'nelaun has various Tribes that have a certain color scheme. Green Tribes have NPCs that mostly spawn with green or blue colors. It wouldn't make sense to have total color randomization!



How does it work?
Well, there's two important aspects. The config file, and giving your NPC the correct key.
First, let's tackle the config. In OmeLib, it's a completely blank slate, with nothing in it!
But don't worry, I have an example patch!
You'll find the config under:
\OmeLib\npcs\om_replacenpc.config
I'll use the aforementioned The Nomadic De'nelaun from earlier, this is ONE of their patches to the config:
[ {"op":"add","path":"/om_denelaun-GreenTribe","value":{ "bodyDirectives":[ "?replace;ffe2c5=e1b98d;ffc181=c88959;d39c6c=9e6a4d;c7815b=784930", "?replace;ffe2c5=c9b181;ffc181=ac8348;d39c6c=87633f;c7815b=694c31", "?replace;ffe2c5=e8cebc;ffc181=cfa97d;d39c6c=ae774b;c7815b=804e34", "?replace;ffe2c5=f4e0ba;ffc181=e9b768;d39c6c=c18f54;c7815b=a2683d", "?replace;ffe2c5=ffe9d3;ffc181=ffc181;d39c6c=d39c6c;c7815b=b97551", "?replace;ffe2c5=fbe1d4;ffc181=f6baa2;d39c6c=cc9582;c7815b=ac7261", "?replace;ffe2c5=fff7ec;ffc181=f9d3a9;d39c6c=d3a57c;c7815b=b37c5d", "?replace;ffe2c5=fff6f6;ffc181=f7d5d3;d39c6c=d1aaa1;c7815b=a27f70", "?replace;ffe2c5=F9FFD8;ffc181=EEFF99;d39c6c=C3D84B;c7815b=9DB223", "?replace;ffe2c5=EEFF99;ffc181=C3D84B;d39c6c=9DB223;c7815b=788C07", "?replace;ffe2c5=C3D84B;ffc181=9DB223;d39c6c=788C07;c7815b=566600", "?replace;ffe2c5=9DB223;ffc181=788C07;d39c6c=566600;c7815b=414C00", "?replace;ffe2c5=DFFFD8;ffc181=ABFF99;d39c6c=75E55B;c7815b=40B223", "?replace;ffe2c5=ABFF99;ffc181=75E55B;d39c6c=40B223;c7815b=257F0C", "?replace;ffe2c5=75E55B;ffc181=40B223;d39c6c=257F0C;c7815b=186605", "?replace;ffe2c5=40B223;ffc181=257F0C;d39c6c=186605;c7815b=0F4C00", "?replace;ffe2c5=D8FFEC;ffc181=99FFCC;d39c6c=5BE5A0;c7815b=2CB26F", "?replace;ffe2c5=99FFCC;ffc181=5BE5A0;d39c6c=2CB26F;c7815b=137F49", "?replace;ffe2c5=5BE5A0;ffc181=2CB26F;d39c6c=137F49;c7815b=04592E", "?replace;ffe2c5=2CB26F;ffc181=137F49;d39c6c=04592E;c7815b=003318", "?replace;ffe2c5=D8FFFF;ffc181=99FFFF;d39c6c=5BE5E5;c7815b=1AB2B2", "?replace;ffe2c5=99FFFF;ffc181=5BE5E5;d39c6c=1AB2B2;c7815b=0E8C8C", "?replace;ffe2c5=5BE5E5;ffc181=1AB2B2;d39c6c=0E8C8C;c7815b=006666", "?replace;ffe2c5=1AB2B2;ffc181=0E8C8C;d39c6c=006666;c7815b=004C4C", "?replace;ffe2c5=D8EFFF;ffc181=B2DFFF;d39c6c=67B3E5;c7815b=2F85BF", "?replace;ffe2c5=B2DFFF;ffc181=67B3E5;d39c6c=2F85BF;c7815b=0F6199", "?replace;ffe2c5=67B3E5;ffc181=2F85BF;d39c6c=0F6199;c7815b=054772", "?replace;ffe2c5=2F85BF;ffc181=0F6199;d39c6c=054772;c7815b=002D4C" ], "emoteDirectives":[ "?replace;dc1f00=E3BC3A;be1b00=A88614;951500=846508", "?replace;dc1f00=e3e13a;be1b00=a8a614;951500=848008", "?replace;dc1f00=9CB841;be1b00=6D902F;951500=476219", "?replace;dc1f00=6ab841;be1b00=45902f;951500=296219", "?replace;dc1f00=41B87B;be1b00=2F906A;951500=196246", "?replace;dc1f00=4ba0a8;be1b00=397e84;951500=205459", "?replace;dc1f00=4d76ad;be1b00=395187;951500=20325b", "?replace;dc1f00=535353;be1b00=363636;951500=111111" ], "hairDirectives":[ "?replace;d9c189=7d3c1c;a38d59=4d240b;735e3a=2d1606", "?replace;d9c189=7f5a39;a38d59=5b3523;735e3a=3b1f15", "?replace;d9c189=eaa758;a38d59=cd8b3d;735e3a=93682c", "?replace;d9c189=e6e756;a38d59=c7ac3f;735e3a=a9882f", "?replace;d9c189=f1d992;a38d59=daba5e;735e3a=b59a4d", "?replace;d9c189=f2eba3;a38d59=dcd28c;735e3a=c2b677", "?replace;d9c189=A7D13D;a38d59=83AD22;735e3a=6B880B", "?replace;d9c189=4ece61;a38d59=34ae47;735e3a=228a38", "?replace;d9c189=3b7f44;a38d59=2e6a38;735e3a=1d4b28", "?replace;d9c189=5BD5B6;a38d59=4AA9AD;735e3a=237082", "?replace;d9c189=49E193;a38d59=3BA380;735e3a=197C81", "?replace;d9c189=61BCDE;a38d59=5381CC;735e3a=2C489E", "?replace;d9c189=5d8bc7;a38d59=4d55b0;735e3a=2e2a73", "?replace;d9c189=425879;a38d59=343965;735e3a=242247", "?replace;d9c189=50422f;a38d59=36261e;735e3a=170f0d", "?replace;d9c189=525252;a38d59=363636;735e3a=161616", "?replace;d9c189=74726f;a38d59=53504d;735e3a=2a251e", "?replace;d9c189=6f6d85;a38d59=525269;735e3a=3e4352", "?replace;d9c189=b8b8b8;a38d59=828282;735e3a=555555", "?replace;d9c189=eaeaea;a38d59=b8b8b8;735e3a=828282" ] } } ]
The "path" is simply the name of THIS one set. You can patch it multiple times, with different sets! Since this is called "om_denelaun-GreenTribe", these are all colors related to the Green Tribe. So, mostly greens, blues, and other gentle forest colors. The fun part about this is that you DO NOT need to use colors specifically from the species file!



Next, we need to go to the specific NPC type that will use this restricted color pool.
For me, it's...
\The Nomadic De'nelaun\npcs\Green Tribe\om_greentribeguard.npctype
Then, we simply add a brand new key that is NOT nested into anything else:
{ "type": "om_greentribeguard", "baseType": "base", "levelVariance": [1, 3], "persistent": true, "om_ColorPool" : "om_denelaun-GreenTribe", "damageTeamType" : "friendly", "dropPools" : [ "guardtreasure" ], "scriptConfig" : { "behavior" : "villageguard", "behaviorConfig" : { "greetingChance" : 0.40, "hostileDamageTeam" : { "type" : "enemy", "team" : 1 } },
This isn't the entire NPC file, but notice the brand new "om_ColorPool" key? That is the key we want to add! And see how the value is "om_denelaun-GreenTribe"? That matches the data we patched into the config!
It's going to automatically grab that data and use that to respawn the NPC type within the restrictions we desire. That's it!
Armor Set Detection Script
This is a script used for giving armor sets a fun little bonus. It's pretty simple, as it only applies a positive status effect if the full armor set is worn. You add unique values to the head, chest, and leg armors. The chest has the status effect that uses the script that detects if all are being worn, and then it applies the given status effect. If the set is taken off, or a piece is missing, the status effect won't apply.



How does it work?
Well, there's two important aspects. Making a custom status effect, and attaching specific keys and values to your armor pieces.
First, let's tackle the status effect. OmeLib has the Lua to make the status effect function, but we need to actually make one! I'll be using The Nomadic De'nelaun yet again as the main example.
\The Nomadic De'nelaun\stats\effects\om_detectarmourset
You don't need to put the status effect(s) here, as long as you reference the Lua path correctly.
But let's continue!
I'm naming my status effect,
denelaun_detectarmourset_ice
And this is how it looks:
{ "name" : "denelaun_detectarmourset_ice", "effectConfig" : { "setName" : "denelaunelder", "fullStatusEffect" : "iceblock" }, "defaultDuration" : 1, "scripts" : [ "/stats/effects/om_detectarmourset/om_detectarmourset.lua" ] }
Do NOT change the "scripts" pathing.
There's not a lot going on here, except the effectConfig! Notice the "setName" key? The value should be whatever you want the set name to be. "fullStatusEffect" should be pretty obvious, but it's whatever status effect you want to be applied when the full armor set is worn, positive or negative, vanilla or modded!
...As long as you have the necessary mods, of course.



Next, we need to add the relevant keys and values to our armor set.
For the head and leg pieces, we need to add just a single key, so:
{ "itemName" : "denelaunelderhead", "price" : 1920, "inventoryIcon" : "icons.png:head", "maxStack" : 1, "rarity" : "Uncommon", "category" : "headarmour", "description" : "A sharp helm made of rigid ice. Only those with great strength can withstand the cold.", "shortdescription" : "Elder's Helm", "tooltipKind" : "armor", "statusEffects" : [ {"stat" : "denelaunelderhead","amount" : 1} ],
{ "itemName" : "denelaunelderlegs", "price" : 1280, "inventoryIcon" : "icons.png:pants", "maxStack" : 1, "rarity" : "Uncommon", "category" : "legarmour", "description" : "Made from ice, these tassets provide great protection... If one can handle the freezing temperature.", "shortdescription" : "Elder's Tassets", "tooltipKind" : "armor", "statusEffects" : [ {"stat" : "denelaunelderlegs","amount" : 1} ],
You see the "statusEffects" section? Notice how it's the same full set name from the status effect, but with "head" or "legs" added at the end? Let's continue!

The chest piece is different, as it actually applies the custom status effect we made.
{ "itemName" : "denelaunelderchest", "price" : 3200, "inventoryIcon" : "icons.png:chest", "maxStack" : 1, "rarity" : "Uncommon", "category" : "chestarmour", "description" : "Armour that has been carved from freezing ice. A test of durability.", "shortdescription" : "Elder's Breastplate", "tooltipKind" : "armor", "statusEffects" : [ "denelaun_detectarmourset_ice", {"stat" : "denelaunelderchest","amount" : 1} ],
So, now we're applying the custom status effect we made, but also still adding the final set key, this time appended with "chest".
Therefore, in total, we have: denelaunelderhead, denelaunelderchest, denelaunelderlegs as a part of the "denelaunelder" set.
And since the chest piece applies our custom status effect, we should get the "iceblock" status effect as a positive set bonus for wearing all pieces together!
RPG Growth Support Script
This is a very interesting script by Silver Sokolova. Basically, if RPG Growth is detected, spawn experience orbs! But if it isn't, replace that item with pixels (money) instead.



How does it work?
Well, there's just one thing we need to do!
Whether it's for a custom NPC type, or a harvest for a custom crop, we need to add this section to our treasure pool:
"fill" : [ {"item": ["xrc_isrpgg", 25]} ],
The "25" can be changed to any amount you think is fitting for your content.
Here it is used in a full example:
[ {"op": "add","path": "/om_mm-mothTreasure","value": [ [1, { "fill" : [ {"item": ["xrc_isrpgg", 25]} ], "pool" : [ {"weight" : 0.50, "pool" : "noMeatMonsterTreasure"}, {"weight" : 0.35, "item" : "silkfibre"}, {"weight" : 0.15, "item" : ["cotton", 1, { "price" : 5, "rarity" : "Common", "category" : "craftingMaterial", "inventoryIcon":"/items/generic/crafting/om_mm-mothfluff.png", "description" : "This is so soft and woolly, it can be ^green;substituted for cotton fibre!^reset;", "shortdescription" : "Moth Fluff", "itemTags" : [ "reagent" ] }]} ], "poolRounds" : [ [0.10, 3], [0.10, 0], [0.80, 1] ], "allowDuplication" : false } ] ] } ]
"fill" guarantees that something will drop, just as it is in RPG Growth. However, if RPG Growth isn't installed, that same amount will be dropped as pixels (money) instead. That's it!