My Dystopian Robot Girlfriend 0.87 modding guide By Sheep 1 Contents Contents....................................................................................................................................... 0 How to make a mod?...................................................................................................................2 What about the colors?.............................................................................................................16 Layers......................................................................................................................................... 21 Modifying the textures at runtime............................................................................................ 33 PSD files..................................................................................................................................... 37 Details about files in the mods.................................................................................................38 mod.json................................................................................................................................ 38 Lua files................................................................................................................................. 39 Other data files...................................................................................................................... 40 More info about packed texture containers......................................................................41 Advanced Lua............................................................................................................................ 41 Item prefab.............................................................................................................................42 Making items come in pairs or sets....................................................................................... 45 Making usable items.............................................................................................................. 48 Personality modules.............................................................................................................. 50 Basic................................................................................................................................ 50 Multiple branches and conditions.....................................................................................55 Room mods........................................................................................................................... 56 Basic................................................................................................................................ 56 Coroutines........................................................................................................................60 All room sprites................................................................................................................ 62 Lua documentation................................................................................................................ 63 2 How to make a mod? It’s very simple. To make new items you don’t need any prior coding or modding experience as the modding process is very much automated. The mods allow you to change textures of things already in the game, so adding something that isn’t similar to something already in the game is quite hard. First you need access to the game's debug tools by enabling the developer mode to do that click the version number 7 times. 3 Start by clicking “Create new mod” and then “Advanced mod with items”. Press the circled “Add” button and choose the item you want to use as a base of your new modded item. In this tutorial I will add cat ears, so I selected “Hypercamo Cat Ears”. 4 This is what I get after adding the item. It’s possible to add more, but let’s keep it simple for now. On the left are all the items included in the mod. On the right you see all the textures included in the currently selected item. Some of them will have more and some of them less. To give an example, “Skirt” isn’t visible in the blowjob scene, so it doesn’t need a texture there. Feel free to click on the textures on the right and see how they look. 5 If you are also going with cat ears you might notice that some of the textures are identical. For example: Missionary and interaction scene’s textures look exactly the same. In 0.86’s game version I added a new feature that allows you to join them, saving space and making modifying them easier. 6 To do that click the circled “Other” button and click “Optimize selected item textures”. 7 Here you can see the result of doing that. It turns out that cat ears use identical textures for blowjob, cowgirl, interaction and missionary scenes, which will make things a lot simpler for us. This is all we have to do in the mod creator for now. Let’s export the mod and see what we are working with. Press the “Export the mod!” button and choose somewhere where you can find the file. In my case I chose the desktop. 8 ​ File on the left is how the mod looks after you export it (The icon might be different if you don’t have 7Zip). All a mod is is a zip file with all the data inside. Zip file is a way to compress, put multiple files together and make them a bit smaller. Zip files are very common and Windows can extract them even without any other programs. All you have to do to get the files out is right click on it and press “Extract All…”. After you do so, you will see the following files. ●​ mod.json - File containing information about the mod. It contains mod’s name, target game version etc. ●​ script.lua - It’s a script which gets run when the mod is started. This is probably one of the most important parts of the mod. ●​ Folders with textures - In this case “Hypercamo Cat Ears” as that’s the only item I added. You can read more details about these files here, but for now this explanation is all you need. 9 Let’s edit some of the things now. First is “mod.json”. Open it in a text editor of your choice. I recommend Notepad++. “mod.json” before changes This is how the inside of mod.json looks. Let’s change the mod's name and description. “mod.json” after changes 10 Second thing we should modify is the script file “script.lua”. Remember you don’t need to know programming. All you have to do is modify what’s already there. There are quite a lot of things here, but we can ignore most of these for now. 11 I only changed the name and description. Be careful about including characters such as ‘ (apostrophes) in the name and description. They have to be escaped to be properly parsed. If you don’t know what that means don’t use them! 12 Now let’s move to the most important part, the textures. Once you go to the “Hypercamo Cat Ears” folder, you will see something like this. For now you can ignore the .json files. They store additional data about the textures, but changing them isn’t necessary to make a simple mod. Open the images in an image editor of your choice that supports transparency. Here I used GIMP and added some stripes. Textures after changes 13 We are pretty much done. All you have to do now is to zip the mod files. Select all the files and compress them like this. After doing so you should get something like this. Your mod is complete! Now let’s load it into the game. 14 This is what you should see if everything went correctly. Now let’s see if our item works as intended and open the game. You should see the “Debug” button in the equipment menu(If you don’t go to the top and read how to enable developer mode). It allows you to add an item to your inventory. Find the item you added. It will probably be near the end of the list and equip it. 15 Mod works just as intended! We can check out other scenes too. Cowgirl and doggy scenes with the new item equipped This is the very basic knowledge you need to make a mod. To learn more advanced concepts keep reading this guide! If something went wrong and you want to compare you can download the mod I made here. 16 What about the colors? Let’s look closer at this screenshot from the first part of this guide. Everything seems correct until you look at the colors. For some reason the second color isn’t used. The entire ears are green. This is a pretty simple thing to change. To show some capabilities of this system I’m going to add one more color. Let’s open script.lua and find “ColorSlots” script.lua before changes This is pretty hard to read, but we can see that we create two instances of “ColorSlot” first one is called “Main color” , the second one is called “Fluff color” and we use a palette named “partpalette” for both of them. Let’s add one more slot called “Back color”. script.lua after changes This is all we have to do to add a new color to the item. Make sure you put “,” between items and make sure all “(“ and “)” match up. Now we just have to tell the game how to use the colors. We define that in the json files that are stored next to textures. Let’s take a look at one related to doggy. 17 tex 2 - doggy.json before changes We can see that there are 3 drawables in this file “CatearBackR” “CatearMidR” “CatearFrontR”. The part that defines the color is the ColorIndex. Color index tells the game which color to use. What does 0 mean though? It’s simple. It tells the game which color slot to use. It works like this: 18 One thing worthy of note is that ColorIndex can also be set to “-1” if you do that it will ignore color slots completely and just remain the color the texture is. So let’s set “CatearFrontR” to ColorIndex 0, “CatearMidR” to ColorIndex 1 and “CatearBackR” to ColorIndex 2. tex 2 - doggy.json after changes To make it work in all of the scenes “tex 1 - blowjob, cowgirl, interaction, missionary.json” has to be modified like that too! 19 After the changes let’s zip the mod and load it into the game. We can see that all the color slots are there. 20 We can see all the colors work as intended! It also works in the doggy scene. If you followed this part of the tutorial and something went wrong feel free to check out the mod I made here. 21 Layers So far in the guide I used cat ears which have 3 separate drawables and we replaced their textures. What if you want to add something that goes above something instead of replacing it? To give some examples. You might want a tattoo above the skin or a bracelet on the arm. It’d be wasteful to have to include the entire arm in the mod if all you want to do is add a bracelet. The way to do that is layers. Let’s go through a simple example to show how it works. Let’s make a simple tattoo. Let’s start by creating an item based on Hypercamo Skin. It has a lot of drawables and finding out which ones we want is quite hard. You can use the PSD files to help yourself a bit. 22 Let’s make the tattoo go on the bot's tummy. Starting with doggy we must split the textures and after splitting use the trash can button to delete the other texture with all the drawables we don’t need. You can access these options using the “+” button. 23 After some trial and error I found these drawables in all the scenes: 24 In the blowjob scene her tummy isn’t visible, so let’s delete it. Let’s make the tattoo multicolored. To simplify things we can duplicate all the textures in the mod creator. Why do we have to duplicate them? We have to separate the parts that get colored using a different color. If we want to have two colors we need two layers. Do this for all the scenes. Till you get something like this on all the scenes. 25 Once you are done export the mod using the big green “Export mod” item and extract it. You should get something like this: 26 Let’s take a look at one of the json files “tex 1 - doggy.json” We can see here that there are two textures. The difference between them is the ●​ ColorIndex. It’s 0 in the first one and 1 in the second one. ●​ Layer. It’s 0 in the first one and 1 in the second one. 27 You should know what ColorIndex does by now, but what about layers? In short, layers allow you to define what should be drawn on top of something else. The higher the number the higher it is. Keep in mind that it only means higher on the same drawable to give an example even if you set the layer to 10000000 on skin it will never go above a shirt or a hoodie. Maximum value for layer number is 2147483647, but it’s best to keep the number pretty low for things close to skin. Go a bit higher like 1000 for things above skin like glasses or other accessories. Warning: Layer 0 is a special layer. If the packed texture doesn’t have a texture with layer 0, the game will use its default texture. This is used for example in items such as striped socks, that achieve the effect of having two layers while using only one texture. There can also be ONLY one texture at layer 0. If you set something to layer 0 it will replace the default texture. With that in mind what we want to achieve in this case is: 1.​ Default skin texture(by not including layer 0) 2.​ First part of the tattoo - layer 100 (This number is pretty arbitrary, but it must be above 0) 3.​ Second part of the tattoo - layer 200 28 tex 1 - doggy.json after changes We must of course do this for all the json files! 29 Now let’s just modify the images itself to have our tattoo Important part when creating items whose colors you can change in game. Game colorizes textures using color multiplication. Above image shows how it works. You can imagine having a red flashlight. If you shine on something perfectly black it will still be black. If you shine it on something white it will turn red. Which means that if something is black on your texture it won’t be affected at all by the color. It will stay black. Above image I made in paint shows how color multiplication works in the game. To make the item colorable you should make the texture grayscale. 30 Keeping that in mind I created those textures. This was quite a lot of work, but there goes my cannon and with two cannonballs tattoo. Now there is one last thing to do. Modify the script.lua. I need to do a couple of things ●​ Add a color slot and change the color slot’s names. ●​ Change the name and description. ●​ Change the equipment slot the item goes into. If we don’t do that we wouldn’t be able to wear the original hypercamo skin with it. ●​ Remove the SusModifiers. These are used to specify which sus area item effects. Most of the time you want to remove those on your modded items that aren’t modules. script.lua after changes I highlighted all the areas that were changed. 31 Let’s zip the mod and load it into the game! Also remember to change mod’s name in mod.json! I added the item into my inventory using the debug button. Let’s see if everything works as intended. The color slots are correct. The interaction scene looks right. Same with missionary. 32 Same with cowgirl and doggy You can download this mod to see how it works here. 33 Modifying the textures at runtime Very often during making mods you have to modify the textures many times before you get the desired look. This very quickly gets annoying because to reload mods you have to restart the game. Luckily in 0.86 there is a way around this. In this version mod data gets stored on the hard drive as opposed to ram before. You can access that data, modify it and then force the game to reload textures. To do so follow these steps: Click the “Debug” button and then “Open mod’s working directory” 34 You will see something like that. I found a texture for interaction and modified it by adding a text “This was modified at runtime” 35 After modifying it I can now reload textures: 36 And we can see that the change worked. To reload textures while not in the equipment menu hold R then press T. (R-Reload T-Textures) It will reload all textures of modded items currently equipped. Important things to keep in mind when using this feature ●​ Only textures get reloaded. You can see all mod’s files in mod working directory, but modifying things other than textures has no effect. As they are only loaded at startup. ●​ ModWorking directory gets cleared when you exit the game! To save space for the user ModWorking directory gets cleared when you exit the game. If you don’t copy your modified data before closing the game it will be lost forever. 37 PSD files I uploaded psd files of all the scenes here. You can find out the names of all drawables there and get some idea of how these things work. Good luck! 38 Details about files in the mods Mods have 3 main parts: mod.json Example mod.json file It has the mod’s name, description and some other information. It also allows you to execute lua script during “windows”. As of 0.86 there is only one scripting “window” called “OnGameStart”. Most important part here is the guid. It stands for “globally unique identifier” and does exactly that. Every mod gets one when it’s created. It’s what identifies the mod and makes sure items added by them never collide. Game will not let you load two mods with identical guid’s. If you try, the new one replaces the old one. 39 Lua files Example script.lua file Mods generated by the game have a script called “script.lua”. If you want to learn more about Lua I recommend this website. You don’t need any Lua knowledge to make basic mods, but it can be useful to make more advanced things. Game is using moonsharp to make Lua work. Some of the more advanced things possible with Lua are included in chapter Advanced Lua 40 Other data files It can be anything you want your mod to use. As of 0.86 it’s mostly packed texture containers that look like this. 41 More info about packed texture containers You usually just change the Layer and ColorIndex in packed textures, but sometimes you might want to do more. Here’s an explanation of all the data in packed texture containers. PackedTextures - List of packed textures in one packed texture container TextureName - Relative location of the texture file PackedDrawables - List of all drawables in packed texture RectInt - Position and size of the drawable in pixels on the texture ColorIndex - Color used when drawing this texture. If -1 uses white. DrawableType - Most of the time it’s going to be 0, but for the new logos on tshirts and hoodies you might see the following values ​ 0 - Default 1 - Logo. Treat this drawable as a logo. That means that if the image has a different aspect ratio it will be scaled down to fit inside of it. Useful for logos. 2 - Same as the logo, but the image gets flipped horizontally 3 - Same as the logo, but the image gets flipped vertically 4 - Same as the logo, but the image gets flipped horizontally and vertically. BypassColorScaler - By default colors of some drawables get scaled to fit nicer. For example, the grayscale image used for arms is a bit darker than the one used for the body. (Look at one of the PSD files to see what I’m talking about) To make it fit nicely there are color scalers that scale it appropriately. For your own custom items it might be better to bypass that mechanic. That’s what happens when you set this to true. 42 Advanced Lua Item prefab Item prefab’s generated by using ModUtilities.GenerateItemPrefab() have many fields(That’s how it’s called in programming lingo). Let’s go through all of them and explain what their values can do. I will keep the types used in code. Here’s some of them explained along with possible values for some of them. ●​ int - Integer number. For example 10, 50 ●​ string - string of text for example ‘Asshole’ or ‘Butthole’ ●​ bool - boolean value. possible values are true or false ●​ List - list of strings of text. For example {“One”, “Two”} ●​ List> - list of lists of strings of text. For example {{“A”}, {“B”, “C”}} ●​ Func - function returning B and accepting A as a parameter. string Name; Item’s name string Description; Item’s description int Price; Item’s base price. Keep in mind the price is also affected by quality in case when the item has quality. List PossibleEquipmentSlots; Slots the item can go into. Theoretically it’s possible to make an item go into multiple slots. Packed textures don’t really support it right now, so it’s usually just one slot. List> ControllerElementOverrides; This is slightly complicated, but it tells the game what elements the item should activate when in slot with the same index. It’s used for example compare Pants itemprefab1.PossibleEquipmentSlots = {'LowerBody'} itemprefab1.ControllerElementOverrides = {{'LowerBody_Pants'}} Skirt itemprefab0.PossibleEquipmentSlots = {'LowerBody'} itemprefab0.ControllerElementOverrides = {{'LowerBody_Skirt'}} They go into the same slot, but activate a different element. If ControllerElementOverrides is empty then element with the name of the slot is activated 43 Func OnUse Function called when item is used. If the returned value is true, the item will get removed from the inventory. Example usage is explained in Making usable items Action SpecialEffectAction Special function that: ●​ Is called with true on loading current save and equipping this item ●​ Is called with false when closing current save and unequipping this item Was created in order to make pixel glasses effect work properly. This might also be used to create items modifying the room, but this guide doesn’t cover that. Action RandomItemPostProcessing Items have random color(If they have color) and quality(If they have quality) when they are randomly generated to for example appear in the shop. This function is called after that. It allows you to for example force items to always appear in a certain color or quality. bool IsIllegal If an item is illegal you can’t easily throw it out bool CanChangeColor If true item’s color can be changed in inventory. Used for hypercamo items. bool HasQuality If it is true, the item has quality and scratches will appear on it if it’s not new quality. Quality will also affect price. List ColorSlots Accepts a list of color slots created using ColorSlot.CreateInstance. For example itemprefab0.ColorSlots = {ColorSlot.CreateInstance('Main color', ColorPaletteManager.GetColorPaletteByName('partpalette'))} Most important palettes included in main game are: ‘grayscalepalette’ - has grayscale colors in a couple of steps from black to white ‘partpalette’ - Main color palette, has a lot of different colors ScratchTextureType ScratchType It’s an enum with following values public enum ScratchTextureType { Universal = 0,//For everything Hard = 1,//For harder items } 44 bool IsStackable If true you can have multiple items in one “item” used for example for food. DO NOT use it on items with HasQuality set to true. If an item is stackable and the player has multiple of them, OnUse will only remove one of them! List Partners Used for merch items for contracts. It has the id's of partners that consider the item their merch. For modded items you probably want to leave this empty. List RequiredSlots Names of slots required to equip this item. For example if you make a glove for the left hand you want to put {"ArmL"} in there. List SusModifiers Used to determine how sus bot looks. For example: itemprefab0.SusModifiers = {SusModifier.CreateInstance(SusArea.LowerBody, 0.7)} Would mean. This item cowers the lower body with 70% coverage SusArea has following values public enum SusArea { ArmL = 0, ArmR, LegL, LegR, UpperBody, Boobs, LowerBody, Pussy, Skin, } Sprite OverrideIcon Used to set this icon to a different texture 45 Making items come in pairs or sets. This part of the guide was copied from an older version of the guide. The script will have slightly different variables, but the way this works is still the same! A problem you might encounter while making mods that have items which come in pairs(shoes, socks) is that they will appear separately in the shops. There is a quite simple way to make your item come in pairs. Example script file adding two sneakers. I created a mod which has left and right sneakers. First we remove items not in a pair from the shop by removing “AddSingleBuyItemToShop”. 46 Example script file after removing both items from shop. What we have to do now is create a new item which will be used to represent items still in their packaging. All we have to do is add the following code below the code seen in the picture above. itemsetprefab = ModUtilities.CreateItemPrefab() itemsetprefab.Name = 'Pair of snakers' itemsetprefab.Description = 'Pair of sneakers' itemsetprefab.Price = 1600 itemsetprefab.ColorSlots = {ColorSlot.CreateInstance('Main color', ColorPaletteManager.GetColorPaletteByName('partpalette'))} itemsetprefab.MakePair(item0, item1) itemset = ModUtilities.CreateNewItemAutoAssignId(CurrentModGuid, itemsetprefab) ModUtilities.AddSingleBuyItemToShop('clothier', itemset) 47 How MakePair works: Category will be set to ItemCategory.Package Description will get "\nThis item is still in its packaging. You have to use it to unpack it!" appended to it. OnUse function which adds both of the items to your inventory and consumes this one will be created and set. This function will copy color to them, so make sure ColorSlots are the same in all of these items. More than 2 items in a set? There is an equivalent method to MakePair which accepts a list of GameId’s public ItemPrefab MakePair(GameId i1, GameId i2) public ItemPrefab MakeSet(List id) itemsetprefab.MakePair(item0, item1) Is the same as itemsetprefab.MakeSet({item0, item1}) But can accept more than 2 items itemsetprefab.MakeSet({item0, item1, item2, item3}) Like so. Mod Creator window doesn’t support exporting item’s functions such as OnUse (They are c# functions and cannot be transferred to lua). You should make items come in sets as the last part of the mod making as you won’t be able to edit it with the Mod Creator anymore! 48 Making usable items It’s hard to cover making usable items as they can do a lot of different things.​ Most important variables that you can use in your usable items are: gv - Stands for game variables. That’s the container all variables in the current save are stored in. To give some examples: gv.money - current money gv.casinoTokens - current casino tokens UiOverlay - Allows you to show all kinds of popups.To give some examples: public void OkPopup(string title, string text, Action okaction = null) public void OpenShop(string id, Action onFinished) public SimplePopup SimplePopup(string title, string text, Action yesaction, Action noaction = null) public void BuyPopup(string title, int price, Action boughtaction, string text = null, Action noaction = null, Action nomoneyaction = null) Here’s an example script for a mood fixer item. itemprefab0 = ModUtilities.CreateItemPrefab() itemprefab0.Name = 'Mood fixer' itemprefab0.Description = 'For some reason makes bot\'s mood great!' itemprefab0.Price = 500 itemprefab0.IsStackable = true function OnUse(item) gv.Mood = gv.Mood + 2.0 ​ UiOverlay.OkPopup("Magic", "Magic happened. Bot's mood became great! You have " .. (item.GetCount()-1) .. " of this item left!") ​ return true --we return true to remove the item on use end itemprefab0.OnUse = OnUse item0 = ModUtilities.CreateNewItemAutoAssignId(CurrentModGuid, itemprefab0) ModUtilities.AddGenericItemToShop('grocery', item0) --We reset all variables back to nil(null) itemprefab0 = nil item0 = nil ​ 49 Here’s how it looks when you use this item. If you want to try it out, here's the mod. 50 Personality modules Basic Making personality modules is quite easy. Go to advanced mod creator and click the following button. It will generate the following file: 51 To use it add a new item based on a random personality module using the add item button. Export the mod and paste the previously generated script into the mod’s script. 52 And you will get something like All you have to do to create a new personality module now is to modify the dialogues. To do that keep two things in mind: Special character escaping​ You have to escape special characters. Read more about it here. 53 Special dialogue syntax​ You can see things such as #pickrandom #r #end those are used to easily add more variations to the dialogues.​ Here’s a couple examples of how it works: 1. The following 3 are equivalent. #end is not required at the end of the line. #pickrandom and #r are equivalent #pickrandom Bot: 1 Bot: 2 Bot: 3 #end #pickrandom Bot: 1 Bot: 2 Bot: 3 #r Bot: 1 Bot: 2 Bot: 3 Possible outcomes: Bot says “1” Bot says “2” Bot says “3” 54 2. #case usage #r #case Bot: 1.1 Bot: 1.2 #end #case Bot: 2.1 Bot: 2.2 #end Bot: 3 Bot: 4 #end Bot: End Possible outcomes: Bot says “1.1”​ Bot says “2.1”​ Bot says “3” Bot says “4” Bot says “1.2” Bot says “2.2” Bot says “End” Bot says “End” Bot says “End” Bot says “End” 3. Multiple randoms #r Bot: 1.1 Bot: 1.2 Bot: 1.3 #end #r Bot: 2.1 Bot: 2.2 Bot: 2.3 #end Possible outcomes: First Bot says “1.1” Bot says “1.2” Bot says “1.3” Then Bot says “2.1” Bot says “2.2” Bot says “2.3” Keep one thing in mind! The text has to be properly escaped. So for example the above example would become the following string: "#r\nBot: 1.1\nBot: 1.2\nBot: 1.3\n#end\n#r\nBot: 2.1\nBot: 2.2\nBot: 2.3\n#end\n" You can use a tool like this to do it for you. 55 Multiple branches and conditions It’s possible to include multiple branches in a single “container”. To do so take the generate line like this. personality.PrepareContainer('Frick_CumInside').AddBranch(StoryBotDialogueBranch.__new('#r\nBot: Cum inside me!\nBot: Fill me up!\nBot: Mmmm~~', CurrentModGuid, 0)) And modify it like so: local container = personality.PrepareContainer('Frick_CumInside') container.AddBranch(StoryBotDialogueBranch.__new('Bot: Cum inside me 1!', CurrentModGuid, 50)) container.AddBranch(StoryBotDialogueBranch.__new('Bot: Cum inside me 2!'', CurrentModGuid, 51)) (The last number. In this case 50, 51. Should be unique between branches in the same mod!) You can also add conditions like this: local isMillionaire = function() return gv.money>1000000 end local isMillionaireCondition = StoryCondition.Delegate(isMillionaire) local isNotMillionaireCondition = StoryCondition.Delegate(isMillionaire, true) -- passing true as the second argument can be used negate the function local container = personality.PrepareContainer('Frick_CumInside') container.AddBranch(StoryBotDialogueBranch.__new('Bot: Cum inside you brokie!', CurrentModGuid, 50)).AddConditions(isNotMillionaireCondition) container.AddBranch(StoryBotDialogueBranch.__new('Bot: Cum inside me you millionaire!'', CurrentModGuid, 51)).AddConditions(isMillionaireCondition) Most of the game's variables are inside of the “gv” in the global table. Look at the lua documentation to see all the things you can access.​ 56 Room mods Basic First let’s create a new mod with items to generate most of the script for us. Choosing the spider plush as that’s what will be used for the base. Here’s the generated mod: 57 And the script: Now we need to create a new image. Let’s quickly draw something. Important thing to keep in mind is that the size of the room items isn’t scaled in any way. They are the same size as the image is. The room is 1920x1080 pixels for reference. I will make the plush 128x128 to keep it pretty small. Here’s the plush of an evil cat I drew. (I know. It’s amazing) 58 Drop it into the mod’s folder. Now it’s time to modify the script. In 0.87 it’s pretty easy. You just have to add these two lines -- Prepare the sprite reference local evilCatSprite = ModUtilities.GetSpriteReference(CurrentModGuid, "evilcat.png") -- Assign the special effects action local seAction = TextureOverriderManager.RoomManager.GetSpecialEffectsAction("/Room/SpiderPlush", evilCatSprite) itemprefab0.SpecialEffectAction = function(value, item) seAction(value, item) end (The second line could’ve been “itemprefab0.SpecialEffectAction = seAction”, but it looks like for some reason the conversion doesn’t play nice and we need the function wrapper…) What does "/Room/SpiderPlush" mean? It specifies what object gets its texture changed. All possible values for this can be found in All room sprites. 59 I modified mod.json with a proper mod’s name, zipped the contents and loaded the mod into the game. Here’s the result: You can get this mod to play with here. 60 Coroutines What are coroutines? They are a simple way to run asynchronous code. What does that mean? They allow us to run code over multiple frames and stop it at certain points instead of running it all at once. What does it allow you to do? You can for example make animated room sprites! Let’s start from the evilcat mod made in the above chapter. First I created a new sprite. evilcat2.png Now we have to edit the script to start the coroutine when the item is equipped and stop it when it’s over. Here’s the special effects action required to achieve that. 61 And here’s how to add it to the itemprefab And here’s the result after running it! Download the mod to easily copy the script here. 62 All room sprites Here’s a list of all objects and the sprites they use. "/Room/back" - default sprite in "Sprites/Backgrounds/Room/back" "/Room/Door" - default sprite in "Sprites/Backgrounds/Room/DynamicRoom/Door" "/Room/mat" - default sprite in "Sprites/Backgrounds/Room/DynamicRoom/mat" "/Room/GhostBackground" - no default sprite "/Room/couch" - default sprite in "Sprites/Backgrounds/Room/DynamicRoom/couch2" "/Room/SpiderPlush" - no default sprite "/Room/Cupboard" - default sprite in "Sprites/Backgrounds/Room/DynamicRoom/Cupboard" "/Room/Bed" - default sprite in "Sprites/Backgrounds/Room/DynamicRoom/Bed" "/Room/BatBanner" - no default sprite "/Room/Window" - default sprite in "Sprites/Backgrounds/Room/DynamicRoom/Window" "/Room/TV/TV" - default sprite in "Sprites/Backgrounds/Room/DynamicRoom/TV" "/Room/TV/TV light" - default sprite in "Sprites/Backgrounds/Room/DynamicRoom/TV light" "/Room/PC/PC desk" - default sprite in "Sprites/Backgrounds/Room/DynamicRoom/PC desk" "/Room/PC/PC" - default sprite in "Sprites/Backgrounds/Room/DynamicRoom/PC" "/Room/PC/Screen light" - default sprite in "Sprites/Backgrounds/Room/DynamicRoom/PC light" "/Room/PC/PC rgb" - default sprite in "Sprites/Backgrounds/Room/DynamicRoom/PC rgb" "/Room/Light Multiply" - default sprite in "Sprites/Backgrounds/Room/DynamicRoom/Light/white" "/Room/Light" - default sprite in "Sprites/Backgrounds/Room/DynamicRoom/Light/windowLight" "/Room/Morning Light" - default sprite in "Sprites/Backgrounds/Room/DynamicRoom/Light/morningLight" Here is the content of the DynamicRoom folder which you can use as a base to make new items. 63 Lua documentation It was quite hard to find all the things you can access from lua, so I wrote some code to automatically generate some documentation about things you can use. It can be found in the advanced mod creator. It first lists all the things stored in the global table. Then all the objects and their members. To interpret this you need a bit more programming knowledge, but it should allow you to at least see what’s accessible. Here’s an explanation of the common types: ●​ String​ Text of some kind. ​ Example values: “You gay”, “5102 adfsf”, “This is a string” ●​ System.Single​ Floating point number.​ Example values: 0.3, 0.7, 10000.04, 42​ It’s often used from 0.0 to 1.0 where 0.0 means 0% and 1.0 means 100%! ●​ System.Int32​ Integer number. ​ Example values: 1, 2, 3, 4, 5, 1000, 69, 420, -50 ●​ System.Boolean​ Boolean value. Has two values: true or false.