Thomas Die Posted July 30, 2019 Share Posted July 30, 2019 (edited) This little project is to help beginners in coding by giving simple lines of code to help them out, i'll try to start them out by give some simple codes for perks/debuffs. these codes should be easily able to implement into their fan characters (these are food perks\debuffs) if inst.components.eater ~= nil then inst.components.eater:SetPrefersEatingTag("preparedfood") - (warly's debuff on only eating prepared foods) inst.components.eater.strongstomach = true - (webber's abilities to eat monster meat) inst.components.eater.ignoresspoilage = true - (wx's ability to ignore food spoilage) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ (this ones a bit more complicated but it't basically so that it has no hunger) (add this to your modmain) local function removeStomach(self, inst) if inst and inst.prefab == "your charcter's name" then self.brain:SetPosition(self.stomach:GetPosition()) --moves brain to where stomach was self.stomach:SetPosition(self.heart:GetPosition()) --moves stomach behind heart, JUST in case? inst:DoTaskInTime(1, function() self.stomach:Hide() end) inst:ListenForEvent("ms_playerspawn", function() self.stomach:Hide() end) inst:ListenForEvent("playeractivated", function() self.stomach:Hide() end) inst:ListenForEvent("ms_respawnedfromghost", function() self.stomach:Hide() end) inst:ListenForEvent("hungerdelta", function() self.stomach:Hide() end) end end AddClassPostConstruct("widgets/statusdisplays", removeStomach) (add this to your character) inst.components.hunger.DoDelta = function(self, delta, overtime, ignore_invincible) return end ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- (these are for if you want special items) (examining and the name of your item) STRINGS.NAMES.your item = "name of your item" STRINGS.CHARACTERS.GENERIC.DESCRIBE.your item = "generic character thinks your item is good" STRINGS.RECIPE_DESC.your item = "your item good" (crafting your item) AddRecipe("item name", { Ingredient("type of ingredient 1", amount), Ingredient("type of ingredient 2", amount), }, RECIPETABS.MAGIC, TECH.NONE, nil, nil, nil, nil, 'the tag you select for your character', "images/inventoryimages/image name.xml") (i'm sorry if this is not alot i hope that the community can help out by giving out more codes,i'll add more as i can :p) Edited July 31, 2019 by thomas4845 Link to comment Share on other sites More sharing options...
Ultroman Posted July 30, 2019 Share Posted July 30, 2019 Great initiative! You're missing an end in the first one. Also, it's easier to read if you put the code in code tags, preferably separate tags for each thing. Also, you should probably put in some information like where to put the code. Remember, you're writing for people who don't know anything about Lua or the game code. Link to comment Share on other sites More sharing options...
Stormish Posted July 30, 2019 Share Posted July 30, 2019 (edited) Actually for the no hunger code part for the character, you could just do this: inst.components.hunger.DoDelta = function(self, delta, overtime, ignore_invincible) return end What that does is it makes the hunger component DoDelta return no value at all, and because the DoDelta function is responsible for changing many things for the hunger meter (losing hunger overtime, gaining hunger by eating and vice versa), returning the function's value to 0 will make it not do much and instead the hunger meter will stay as it is, a static meter that won't and can't change at all, I tried it myself for my character mod and it works pretty well, it's easier to write and I guarantee you it doesn't crash the game at all, however the other code mentioned in this thread works too and I guess if you want to play safe you can use that other code, but imo I kind of recommend the code I have here more. Edited July 30, 2019 by Stormish Link to comment Share on other sites More sharing options...
Thomas Die Posted July 31, 2019 Author Share Posted July 31, 2019 thanks guys, seriously i want to keep this updated so that beginners can have some easy code to use Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now