DevilsRoost Posted April 3, 2018 Share Posted April 3, 2018 (edited) So I made this guy http://steamcommunity.com/sharedfiles/filedetails/?id=1327870383 And I would love for him to refuse to eat specific items only. Lets say for instance he refuses to eat ratatouille, the way all characters refuse to eat the Eternal Fruitcake. Now onto the hard one. I want to give him a cigar. I found an amazing character that already has a cigar http://steamcommunity.com/sharedfiles/filedetails/?id=950167662&searchtext=cigar I've been trying to gather what it is I'll have to do to get something similar for my character but I'm quite lost and everything I've tried makes it crash. Any help would be greatly appreciated. Edited June 9, 2018 by DevilsRoost Link to comment Share on other sites More sharing options...
IronHunter Posted April 3, 2018 Share Posted April 3, 2018 Spoiler local meh = { ratatouille = true, --add more items in a list format } local _PrefersToEat = inst.components.eater.PrefersToEat inst.components.eater.PrefersToEat = function(self, food) return _PrefersToEat(self, food) and not meh[food.prefab] end add to your master_postinit of your character As for the cigar, I will need to know what you are doing wrong. I do know that the other mod's cigar only allows that particular character to use it. So if you are copying it you would need to update your version to either be exclusive or remove that part of the code. Link to comment Share on other sites More sharing options...
DevilsRoost Posted April 4, 2018 Author Share Posted April 4, 2018 Amazing! The food refusal works great, thanks! as for the cigar, I have no doubt that this is insanely wrong, but I tried to rip it straight from the character Kaiden and transplant it into mine just for testing purposes. Predictably, it's very broken. Attached is the code and crash log Test.rar client_log.txt Link to comment Share on other sites More sharing options...
K1NGT1GER609 Posted April 5, 2018 Share Posted April 5, 2018 According to client_log your missing the actual files(zip files in the anim folder) for the cigar, i think your missing a asset in the modmain. Otherwise judging from the coding and preview on that link looks like it came from this mod: All in all creating your cigar from this mod is a bit easier at least in my opinion than what you were trying to do. Link to comment Share on other sites More sharing options...
DevilsRoost Posted May 30, 2018 Author Share Posted May 30, 2018 I've been trying to follow making the hat from scratch, which is great! Before I began the game I wanted to see what the hat would look like in game so I could figure out where to position the cigar, but even this hat, with no tweaking at all, makes the game crash. I've been trying to follow this tutorial, but it looks like I keep running into problems with the anim file as I've been fiddling about? I don't know how to fix this as I thought it just auto compiled as it did with the EscTemplate character mod. Link to comment Share on other sites More sharing options...
RedHairedHero Posted May 30, 2018 Share Posted May 30, 2018 (edited) The error listed is saying inside of your modmain.lua file on line 6 there's an issue. If it's attempting to index nil that means it's being given a piece of code that doesn't seem to exist. If you can share your modmain.lua file then we'll be able to troubleshoot it further. Edited May 30, 2018 by RedHairedHero Link to comment Share on other sites More sharing options...
DevilsRoost Posted May 31, 2018 Author Share Posted May 31, 2018 It's literally just the unedited one from the hat example above. I haven't touched it and it gives me that error. (I wanted to see if in game first) Here's the modmain modmain.lua Link to comment Share on other sites More sharing options...
DevilsRoost Posted May 31, 2018 Author Share Posted May 31, 2018 (edited) Also, my attempt at the cigar, which is super broken. Ill just attach the whole thing. In this all I tried to do was rename it and do the pics, so far, while trying to follow the tutorial. hat cigar.rar Edited May 31, 2018 by DevilsRoost Link to comment Share on other sites More sharing options...
IronHunter Posted May 31, 2018 Share Posted May 31, 2018 (edited) This tutorial is not really updated for don't starve together, its missing important parts like if not TheWorld.ismastersim then return inst end inst.entity:SetPristine() Honestly, it is much better in general to grab properly coded lua files from other people's mods or the games and modify them to your design and you can still use the spriter files for the hat template from the tutorial. One other thing your spriter files folder structure doesn't match the spriter files code structure, you can easily edit this by opening spriter in a text editor and renaming the swap_hat to match your folders if desired. Not really a big concern unless the objects symbols are important. Also it isn't really neccessary to make a swap spriter file as they are identical to each other. You'll probably also not want to hide symbols like a conventional hat as this is more like the earmuffs where it doesn't really hide anything. I updated the code to better match the earmuffs version as it is wierd seeing the top of a characters head getting chopped off or their hair vanishing because they smoked a cigar. lols Attached below is a fixed version of your mod, if you want to test it just use c_give("cigar", 1) in the console. You'll probably eventually want to add smoke/flame at the tip so I recommend you check out how torches/lighters do it. hat cigar.rar Edited May 31, 2018 by IronHunter typographical errors Link to comment Share on other sites More sharing options...
DevilsRoost Posted June 1, 2018 Author Share Posted June 1, 2018 Amazing!! Thank you so much!! Yes I did want to add a smoke a small light effect to it, and also have to degrade over time too so I'll likely be back once I can;t figure out how that works, HAH! Link to comment Share on other sites More sharing options...
DevilsRoost Posted June 2, 2018 Author Share Posted June 2, 2018 As predicted, I return. Attached is the thing I'm very pleased with it, (as you did most of the work to fix it!? Thank you) But the lighter fire prefab I assume sticks to the arm animation. How would I get it to be on the hat animation? I also would like to ad smoke more than I would a flame, I suppose that will comne with fiddling between the torchfire and lighterfire things. hat cigar.rar Link to comment Share on other sites More sharing options...
IronHunter Posted June 2, 2018 Share Posted June 2, 2018 Fixed your CIGAR string, cleaned up your file, created a smoke particle effect for your cigar, added a follower symbol for your cigar lols... Also repositioned the cigar so it looks nice when is wilson's mouth. This is good practice for my own particle stuff. I commented out the flame aspect of the thing(not sure if it works didn't test the flame part) probably needs some tweaks. But you got smoke for sure. Screenshot Left some comments so you can adjust its position etc to your liking. hat cigar.rar Link to comment Share on other sites More sharing options...
DevilsRoost Posted June 2, 2018 Author Share Posted June 2, 2018 You beautiful genius, you!! Amazing! And it's also great learning to see how it is you did this too so I can work on future failing at stuff and then coming here to whine for help! Thanks so much! Link to comment Share on other sites More sharing options...
DevilsRoost Posted June 2, 2018 Author Share Posted June 2, 2018 BACK AGAIN! For the LAST TIME!? Maybe... Now I want to add it to my custom character... I've been trying to follow the same stuff as this character. as a no frills character with a self custom item, but somewhere along the line I fudged it, and it doesn't work. Crashes when I get to character selection Doc cigar.rar Link to comment Share on other sites More sharing options...
IronHunter Posted June 4, 2018 Share Posted June 4, 2018 You forgot to comment out one of your comments on line 64. Otherwise I spawn into a game as bendy and everything seems to be in order. Doc cigar.rar 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