Noggle Posted January 21, 2015 Share Posted January 21, 2015 (edited) Hello there, friendly folks of the mod forums. I'm making a custom character and despite my best efforts I can't seem to understand what's going wrong with this custom character I'm working on! A character for the original Don't Starve has this functionality, specifically Writhe, a wonderful character by Mr. Tiddles, and in particular the code in here I was looking at islocal function drop(inst)local hand = inst.components.inventory:GetEquippedItem(EQUIPSLOTS.HANDS) if hand thenif not hand:HasTag("nikmikwrithe") theninst:DoTaskInTime(0.1, function()local item = inst.components.inventory:Unequip(EQUIPSLOTS.HANDS)inst.components.inventory:GiveItem(item) inst.AnimState:OverrideSymbol("swap_object", "nil", "nil") end) end endendwhen I plug everything into my character, it runs, but the effect of not being able to equip anything without the specified tag does not work! What seems to be the issue here? I've toyed with it for a bit over a day now, with no results. Edited January 21, 2015 by Noggle Link to comment https://forums.kleientertainment.com/forums/topic/49506-help-needed-how-to-make-items-unequippable/ Share on other sites More sharing options...
rezecib Posted January 21, 2015 Share Posted January 21, 2015 @Noggle, The game seems to be using this right now for the unequip action:ACTIONS.UNEQUIP.fn = function(act) if act.doer.components.inventory and act.invobject and act.invobject.components.inventoryitem.cangoincontainer then act.doer.components.inventory:GiveItem(act.invobject) --return act.doer.components.inventory:Unequip(act.invobject) return true elseif act.doer.components.inventory and act.invobject and not act.invobject.components.inventoryitem.cangoincontainer then act.doer.components.inventory:DropItem(act.invobject, true, true) return true endendSo maybe try removing the Unequip(EQUIPSLOTS.HANDS) line and changing "item" on the next line to "hand"? Link to comment https://forums.kleientertainment.com/forums/topic/49506-help-needed-how-to-make-items-unequippable/#findComment-604511 Share on other sites More sharing options...
Noggle Posted January 22, 2015 Author Share Posted January 22, 2015 (edited) @rezecibSo maybe try removing the Unequip(EQUIPSLOTS.HANDS) line and changing "item" on the next line to "hand"? I have tried this, and haven't seen any difference. I'm also the guy who asked in the other thread, but I haven't been able to get either of these to work for me. I must be missing something here. Would posting my full .lua shine some light on my problem? This is the only thing that is currently not working, but I'm not too knowledgeable on these things. edit: Dear god I'm so bad at this I even broke the quote function. Edited January 22, 2015 by Noggle Link to comment https://forums.kleientertainment.com/forums/topic/49506-help-needed-how-to-make-items-unequippable/#findComment-604691 Share on other sites More sharing options...
rezecib Posted January 22, 2015 Share Posted January 22, 2015 @Noggle, Yeah, posting the lua would probably help. Link to comment https://forums.kleientertainment.com/forums/topic/49506-help-needed-how-to-make-items-unequippable/#findComment-604741 Share on other sites More sharing options...
Noggle Posted January 22, 2015 Author Share Posted January 22, 2015 Not exactly proud of this as there isn't much going on with it yet, but here we go wendigo.lua Link to comment https://forums.kleientertainment.com/forums/topic/49506-help-needed-how-to-make-items-unequippable/#findComment-604789 Share on other sites More sharing options...
Ubiquitous Posted January 22, 2015 Share Posted January 22, 2015 I might not be completely understanding something but I do not see you calling the function anywhere in your code. You could add an event listener that triggers when something is equipped and the function fires.inst:ListenForEvent("equip", drop)Place that in the same area where you initialize your characters stats. This will create a listener that will fire your drop function whenever your character tries to equip something. I am sure there are probably better ways of doing it and someone with more knowledge will shine light on it. Link to comment https://forums.kleientertainment.com/forums/topic/49506-help-needed-how-to-make-items-unequippable/#findComment-604864 Share on other sites More sharing options...
Noggle Posted January 22, 2015 Author Share Posted January 22, 2015 Ahahah. Ubiquitous was right here, I forgot to actually setup a listener and to call the function. I feel silly now. Many thanks, friend. Link to comment https://forums.kleientertainment.com/forums/topic/49506-help-needed-how-to-make-items-unequippable/#findComment-604892 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