osmRhodey Posted May 2, 2016 Author Share Posted May 2, 2016 11 hours ago, Aquaterion said: change data.eslots to data.eslot in both equip and unequip All right this had gotten it to work but in ticks which I do not want. I'm attempting to get a constant drain but currently I'm not sure how to integrate it in. I was able to get in a piece that started drain on pickup but continued after unequip. I'm simply unsure how to continue the drain instead of having it tick. Any ideas on that? For future reference where might I find code that says where periodic tasks and such are a thing, or is that simply lua coding? Link to comment Share on other sites More sharing options...
osmRhodey Posted May 2, 2016 Author Share Posted May 2, 2016 How the code currently looks, some is kept in comments to be swapped around for testing purposes as I try to get things to work: --inst.components.sanity.dapperness = (TUNING.DAPPERNESS_LARGE * -5) --inst.sanitydrain = inst:DoPeriodicTask(1, function() inst.components.sanity:DoDelta(-5) local function onequip(inst, data) if data.eslot == EQUIPSLOTS.HANDS and data.item:HasTag("CHOP_tool") and inst.sanitydrain == nil then inst.sanitydrain = inst:PushEvent(function() inst.components.sanity:DoDelta(TUNING.DAPPERNESS_LARGE * -5) end) end --im not sure if this would override the old equip function, but if it does then just add the only thing that it adds: --TheFocalPoint.SoundEmitter:PlaySound("dontstarve/wilson/equip_item") end local function onunequip(inst, data) if data.eslot == EQUIPSLOTS.HANDS and inst.sanitydrain ~= nil then inst.sanitydrain:Cancel() inst.sanitydrain = nil end end inst:ListenForEvent( "equip", onequip ) inst:ListenForEvent( "unequip", onunequip ) Link to comment Share on other sites More sharing options...
Aquaterion Posted May 2, 2016 Share Posted May 2, 2016 (edited) local function onequip(inst, data) if data.eslot == EQUIPSLOTS.HANDS and data.item:HasTag("CHOP_tool") then inst.components.equippable.dapperness = inst.components.equippable.dapperness - TUNING.DAPPERNESS_TINY end end local function onunequip(inst, data) if data.eslot == EQUIPSLOTS.HANDS and data.item:HasTag("CHOP_tool") then inst.components.equippable.dapperness = inst.components.equippable.dapperness + TUNING.DAPPERNESS_TINY end end You should be able to do it like so, using the line panazej suggested, this should work while also preserving the tool's current dapperness stat just in case. Edited May 2, 2016 by Aquaterion fixed the eslot thing again Link to comment Share on other sites More sharing options...
osmRhodey Posted May 3, 2016 Author Share Posted May 3, 2016 4 hours ago, Aquaterion said: local function onequip(inst, data) if data.eslot == EQUIPSLOTS.HANDS and data.item:HasTag("CHOP_tool") then inst.components.equippable.dapperness = inst.components.equippable.dapperness - TUNING.DAPPERNESS_TINY end end local function onunequip(inst, data) if data.eslot == EQUIPSLOTS.HANDS and data.item:HasTag("CHOP_tool") then inst.components.equippable.dapperness = inst.components.equippable.dapperness + TUNING.DAPPERNESS_TINY end end You should be able to do it like so, using the line panazej suggested, this should work while also preserving the tool's current dapperness stat just in case. Unless this is to be posted in the modmain this code does nothing at all. Currently have been trying to get the other code that panazej had left for the modmain but currently it's not working correctly either. I might come back to this later and leave it as a ticking counter for the time being. Link to comment Share on other sites More sharing options...
Aquaterion Posted May 3, 2016 Share Posted May 3, 2016 5 hours ago, osmRhodey said: Unless this is to be posted in the modmain this code does nothing at all. Currently have been trying to get the other code that panazej had left for the modmain but currently it's not working correctly either. I might come back to this later and leave it as a ticking counter for the time being. Every inst in inst.components.equippable.dapperness should be data.item.components.equippable.dapperness I believe, since inst is actually the player. Link to comment Share on other sites More sharing options...
osmRhodey Posted May 3, 2016 Author Share Posted May 3, 2016 by the by, i know off topic, but either of you, or anyone else, have any idea why some files might not compile? I've run the autocompiler, the game, everything, and some files just simply refuse making me resort to getting someone else to do it in hopes it compiles. I'm just very confused and frustrated cuz this is an issue i get a lot. Link to comment Share on other sites More sharing options...
Aquaterion Posted May 3, 2016 Share Posted May 3, 2016 3 minutes ago, osmRhodey said: by the by, i know off topic, but either of you, or anyone else, have any idea why some files might not compile? I've run the autocompiler, the game, everything, and some files just simply refuse making me resort to getting someone else to do it in hopes it compiles. I'm just very confused and frustrated cuz this is an issue i get a lot. things dont compile when they have errors, such as missing images or bad references Link to comment Share on other sites More sharing options...
osmRhodey Posted May 3, 2016 Author Share Posted May 3, 2016 1 minute ago, Aquaterion said: things dont compile when they have errors, such as missing images or bad references They have everything. They've all compiled before...so yeah. Link to comment Share on other sites More sharing options...
Aquaterion Posted May 3, 2016 Share Posted May 3, 2016 btw did the last code change work? Link to comment Share on other sites More sharing options...
osmRhodey Posted May 3, 2016 Author Share Posted May 3, 2016 (edited) 15 minutes ago, Aquaterion said: btw did the last code change work? See above problem for why I cannot test the code. The ghost build is refusing to recompile thus I cannot boot a server. EDIT: I literally cannot find a single issue in the code causing it to stop...and my friend couldn't get it to compile. Edited May 3, 2016 by osmRhodey Link to comment Share on other sites More sharing options...
osmRhodey Posted May 3, 2016 Author Share Posted May 3, 2016 (edited) I finally got to see something in the export process...a broken png file??? on the scml build? How do you even fix that? EDIT: Take note I even recompiled the base body I'm currently using to get this all to work to make sure everything it working and it just will not compile. I'm currently using Wickerbottom's build as a mannequin for the code. EDIT2: I'm going to bed... Edited May 3, 2016 by osmRhodey 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