Boogie Brando Posted May 8, 2021 Share Posted May 8, 2021 I'm trying to do some simple reskins to a character template but I wanted to throw in some extra features such as the natural urge to poop! What I want specificially is for a character to 'spawn' a poop at their location if their hunger drops to certain intervals (70% full, 40% full, 10% full). As well as the character making a variety (~3) of comments whenever such event occurs. I have zero experience in coding apart from rewording phrases so I don't know if this is an easy or complex thing to achieve, but I was hoping that I could find someone here experienced enough that they would know what lines to put in for this function to work. Any assistance or recommendation is appreciated! Link to comment https://forums.kleientertainment.com/forums/topic/129746-modding-a-custom-character-to-poop/ Share on other sites More sharing options...
Gleenus Posted May 8, 2021 Share Posted May 8, 2021 There are several approaches to do what you want, but they require a lot of effort to make it work The way I would approach it would be like this: I would attach to the "inst.components.hunger.DoDelta" an extra verification to see if the current variation would make you pass (10, 40, 70) This can be achieved by storing the DoDelta function to your character and routing it to another function, something like this inst.old_hunger_DoDelta = inst.components.hunger.DoDelta inst.components.hunger.DoDelta = function(self, delta, overtime, ignore_invincible) -- HERE YOU DO YOUR VERIFICATION AND ROUTINES return inst.old_hunger_DoDelta(self, delta, overtime, ignore_invincible) end This will make that everytime the DoDelta was called, it will pass through your function before returning the original one Now in your verification you need to check if the 10-40-70 thing and make the poop spawn To say the phrases, you can use the Talker component and add your phrases by hand Like inst.components.talker:Say("I poop") Link to comment https://forums.kleientertainment.com/forums/topic/129746-modding-a-custom-character-to-poop/#findComment-1457929 Share on other sites More sharing options...
Boogie Brando Posted May 8, 2021 Author Share Posted May 8, 2021 Man I'm feeling really dumb reading all that and realising all I want is to make a character poop lmao, and to be helped out by the plane mod guy.. super appreciate it! I think I'm kinda wrapping my head around it? I have no idea how to write out my verification and routines apart from guessing what functions I'd use to run the verification, but i think I've got your sample script pasted in correctly, however after that I honestly have no idea where to go. Personally I mostly understand the 'grammar' to programming, but I'm lost in the dark when it comes to using symbols and functions. Spent ages trying to find what I should put afterwards online and can't quite come up with anything. I should be able to manage the 'Talker' component on my own (hopefully) but I think I need a bit more help if that's alright! Link to comment https://forums.kleientertainment.com/forums/topic/129746-modding-a-custom-character-to-poop/#findComment-1457956 Share on other sites More sharing options...
Gleenus Posted May 8, 2021 Share Posted May 8, 2021 3 hours ago, Boogie Brando said: Man I'm feeling really dumb reading all that and realising all I want is to make a character poop lmao, and to be helped out by the plane mod guy.. super appreciate it! I think I'm kinda wrapping my head around it? I have no idea how to write out my verification and routines apart from guessing what functions I'd use to run the verification, but i think I've got your sample script pasted in correctly, however after that I honestly have no idea where to go. Personally I mostly understand the 'grammar' to programming, but I'm lost in the dark when it comes to using symbols and functions. Spent ages trying to find what I should put afterwards online and can't quite come up with anything. I should be able to manage the 'Talker' component on my own (hopefully) but I think I need a bit more help if that's alright! Don't feel dumb, making mods is very confusing in the beginning Making characters is one of hardest things for me I think people always should start making mods by making a "machine that produces something" Usually when you are making a character you need to "edit existing things" instead of "creating new things", and editing is much harder Making a custom machine would be much easier and I think you will learn a lot of how the functions and symbols work However, about the topic To make your character say, you run in the server this function inst.components.talker:Say("HERE WHAT YOU WANT TO SAY") your verifications should be performed with some "if"s in your code Like When you go for the DoDelta function, you can determine your current value of hunger and the final value after the delta is applied So, in the "DoDelta" function, in the region you should input your customization if self.current <= 70 and self.current+delta > 70 then -- If you take a look in this verification, this only be satisfied when your go trough the value of 70 local poop = SpawnPrefab("poop") -- Spawn a poop poop.Transform:SetPosition(self.inst:GetPosition():Get()) -- Move poop to the player instance end Note that this will spawn a poop when you get through the "70", both eating or starving (could be used to farm poops) A hint: Try to develop in a dedicated server, so you can use the print function to see if things are happening as you expect without opening the server log Link to comment https://forums.kleientertainment.com/forums/topic/129746-modding-a-custom-character-to-poop/#findComment-1458009 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