Kiibie 0 Report post Posted August 15, 2017 Hi! I started my first character mod and everything is going fine until I have to make 2 custom abilities! I'm bad with coding so I search threads or existing mods to help me with codes, but I can't seem to find anything up to date for what I look for. My character would have: 1- Sanity unaffected by ghosts 2- Boosting effects from mushrooms / or no bad effects from mushrooms. Now, I wanted to start with the mushroom one, and found an old topic with someone trying to achieve the same thing: link: This is two years old and even though I have been inspiring myself from the codes there, nothing seems to work for Don't Starve Together. I do have the feeling that this Alice character never came to an end or made this ability work, but as time passed I was wondering if anyone had an idea about this in the present? c: I attached the coding that was started back then, to this thread, for reference! Thank you to anyone willing to help! ~ fungusfanatic.lua Share this post Link to post Share on other sites
ZupaleX 270 Report post Posted August 16, 2017 The best place to start is to look at hte actual components that you are trying to affect (here sanity.lua and eater.lua), try to identify which functions inside this components are performing the tasks you want to modify and try to get the logic behind it. Then you are ready to try to alter them. Share this post Link to post Share on other sites
Kiibie 0 Report post Posted August 16, 2017 31 minutes ago, ZupaleX said: The best place to start is to look at hte actual components that you are trying to affect (here sanity.lua and eater.lua), try to identify which functions inside this components are performing the tasks you want to modify and try to get the logic behind it. Then you are ready to try to alter them. Alright, thanks! I'll start checking into that, I actually was not sure where to start off without that lead. I'd say I'm pretty good so far, but it is necessary to ask coding help for me ;_; I'd help anyone with art if any pro coder need it Can I come back to you if I have a question after checking all that out? Share this post Link to post Share on other sites
ZupaleX 270 Report post Posted August 16, 2017 After checking out these scripts and making sense out of them, try to do something that you think would make sense as well. Then if it doesn't work, come back here and post your attempt with the difficulties you are encountering. If you find yourself not able to even puzzle out what's happening in these codes, don't hesitate to ask specific question as well. Share this post Link to post Share on other sites
Kiibie 0 Report post Posted August 16, 2017 (edited) 22 hours ago, ZupaleX said: After checking out these scripts and making sense out of them, try to do something that you think would make sense as well. Then if it doesn't work, come back here and post your attempt with the difficulties you are encountering. If you find yourself not able to even puzzle out what's happening in these codes, don't hesitate to ask specific question as well. I succeeded in having no negative effects from the mushrooms! Though, I worked all day on trying to make the effects work to no avail. The game crashes after choosing the character and sends the error: "variation nillocal is not declared." I know this is VERY messy, as it is the first time I try to code anything, but if anything seems to be broken, I'd really love to know: *edit* Deleted the picture I took of my code Edited August 17, 2017 by Kiibie Share this post Link to post Share on other sites
Lumina 2150 Report post Posted August 16, 2017 (edited) There is an option to copy/paste code, it will be easier to read. It's the <> option. Also, copying the error could help too Edited August 16, 2017 by Lumina Share this post Link to post Share on other sites
Kiibie 0 Report post Posted August 17, 2017 (edited) 1 hour ago, Lumina said: There is an option to copy/paste code, it will be easier to read. It's the <> option. Also, copying the error could help too Ah! Thanks, I'll do that here! Sorry! -- Mushroom boosts local speed_task = nillocal strength_task = nillocal mushroomfns = {} mushroomfns.blue_cap_cooked = function(eater) if eater.wormlight then eater.wormlight.components.spell.lifetime = 0 eater.wormlight.components.spell:ResumeSpell() else local light = SpawnPrefab("wormlight_light") light.components.spell:SetTarget(eater) if not light.components.spell.target then light:Remove() end light.components.spell:StartSpell() end end mushroomfns.green_cap_cooked = function(eater) local key = "alice speedy mushroom" eater.components.locomotor:SetExternalSpeedMultiplier(eater, key, 1.5) if speed_task then speed_task:Cancel() end speed_task = eater:DoTaskInTime(30, function() eater.components.locomotor:RemoveExternalSpeedMultiplier(eater, key) speed_task = nil end) end mushroomfns.red_cap_cooked = function(eater) eater.components.combat.damagemultiplier = 1.5 if strength_task then strength_task:Cancel() end strength_task = eater:DoTaskInTime(30, function() eater.components.combat.damagemultiplier = 1 strength_task = nil end) end local oldoneat = inst.components.eater.oneatfn inst.components.eater.oneatfn = function(inst, food) if oldoneat then oldoneat(inst, food) end local oneaten = mushroomfns[food.prefab] if oneaten then oneaten(inst) end end And the error file is attached below! client_log.txt Edited August 17, 2017 by Kiibie Share this post Link to post Share on other sites
ZupaleX 270 Report post Posted August 17, 2017 What is nillocal?? Share this post Link to post Share on other sites
Kiibie 0 Report post Posted August 17, 2017 (edited) 10 hours ago, ZupaleX said: What is nillocal?? OHH. Omg I'm a potato. The fact that you have no idea what nillocal is, made me realize that it simply was that NIL and LOCAL were into one word while it should've been on two different lines. Has I fixed that, the effects work!!! Now that I tried the effects, I see that like the older post I linked, the cooldown for the blue mushroom is attributed to the Glowberry, which is 90 seconds. I wonder how I can make this shorter, like 10 sec? I don't know how to proceed to code a timer, or effective cooldown... If anyone has advice, hints or ideas about this, I'm all ears! :'D Edited August 17, 2017 by Kiibie Share this post Link to post Share on other sites
Kiibie 0 Report post Posted August 17, 2017 (edited) AH! After spending all day trying to change the darn duration for the glow, I succeeded!! All I want to do left is to make my character speak when eating the mushrooms. I guess we can end the thread now, as I succeeded the effects! Thanks @ZupaleX for offering your help~ ;v;/ Edited August 17, 2017 by Kiibie Share this post Link to post Share on other sites