SenL Posted January 24, 2016 Share Posted January 24, 2016 (edited) Hi, Is there a way to disable combat (player can't attack at all)? If yes, how? Also how to re-enable it? Thanks! Edit: Maybe I can set inst.combat.canattack to false? Edit: Kind of, but force attack still works even with canattack set to false. Edited January 24, 2016 by SenL Link to comment https://forums.kleientertainment.com/forums/topic/63168-disable-combat/ Share on other sites More sharing options...
NyctoDarkMatter Posted January 24, 2016 Share Posted January 24, 2016 I don't know if disabling combat is possible, but if you want them to deal no damage you can set their damage multiplier to 0. That way they can't hurt anything. And then keep canattack set to false so that they generally don't attack. Out of curiosity, is there a reason you don't want the character to be able to attack at all? It sounds like the character would be a burden online. Even if the game they are from shows them to never attack anything (and I know how that feels; making Frisk from Undertale, who should always be passive), sometimes a character needs to fight in Don't Starve, unless you make all creatures passive towards the character which is a hard task. Link to comment https://forums.kleientertainment.com/forums/topic/63168-disable-combat/#findComment-713237 Share on other sites More sharing options...
SenL Posted January 24, 2016 Author Share Posted January 24, 2016 It seems that these two would work inst.components.combat.canattack = false inst.components.combat:SetTarget(nil) Well, this character would be able to go to a mode where he could not attack but he heals nearby players. Link to comment https://forums.kleientertainment.com/forums/topic/63168-disable-combat/#findComment-713240 Share on other sites More sharing options...
NyctoDarkMatter Posted January 24, 2016 Share Posted January 24, 2016 Oh, that's quite interesting, actually. Feel free to post a link when it's done, I would love to see it. Who is the character? Link to comment https://forums.kleientertainment.com/forums/topic/63168-disable-combat/#findComment-713241 Share on other sites More sharing options...
SenL Posted January 24, 2016 Author Share Posted January 24, 2016 Now how would I make the character unable to move at all? I can set the locomotor walkspeed and runspeed to 0 but it would still be "moving" in place. Looks funny. Ideally I would also like to disable all HUD and controls... Link to comment https://forums.kleientertainment.com/forums/topic/63168-disable-combat/#findComment-713365 Share on other sites More sharing options...
Muche Posted January 24, 2016 Share Posted January 24, 2016 3 hours ago, SenL said: Ideally I would also like to disable all HUD and controls... Look up SetModHUDFocus (defined in modutil.lua). Link to comment https://forums.kleientertainment.com/forums/topic/63168-disable-combat/#findComment-713439 Share on other sites More sharing options...
SenL Posted January 24, 2016 Author Share Posted January 24, 2016 I looked at it and still have no clue. Looking at Gesture Wheel's code, it has "SetModHUDFocus("GestureWheel", true)" and "SetModHUDFocus("GestureWheel", false)". Tried that (replaced "GestureWheel" with my own) and it disables the control (not HUD) but does not re-enable the control (even when "true" is passed). Not sure how to use this properly... Now about the "character to not able to move (instead of walking/running in place)" ... how would one do that, is it possible? Thanks. Link to comment https://forums.kleientertainment.com/forums/topic/63168-disable-combat/#findComment-713478 Share on other sites More sharing options...
Muche Posted January 25, 2016 Share Posted January 25, 2016 You having it found it used in Gesture Wheel mod is great. I discovered it the other way - I found out that having the gesture wheel shown disables the controls and hiding the wheel enables them again and looked up how it has achieved that. And you actually wrote it as well - SetModHUDFocus("id", true) for disabling the controls, SetModHUDFocus("id", false) for enabling them again. Having access to SetModHUDFocus's definition (yay!), I could also see how are its parameters used - hasfocus as a boolean and focusid as an identifier. Trying SetModHUDFocus("id", true), the character did not move when I pressed WASD, and it did not run in place. Link to comment https://forums.kleientertainment.com/forums/topic/63168-disable-combat/#findComment-713555 Share on other sites More sharing options...
SenL Posted January 25, 2016 Author Share Posted January 25, 2016 (edited) Wait, setting it true = disable the controls? Wha... Edit: Oh wow it works lol. Very nice. Thanks. However I could still use the inventory (like eating food). Not ideal (exploitable) but acceptable. Edited January 25, 2016 by SenL Link to comment https://forums.kleientertainment.com/forums/topic/63168-disable-combat/#findComment-713563 Share on other sites More sharing options...
Muche Posted January 25, 2016 Share Posted January 25, 2016 You could try injecting into eat action (and similar), that would check your switching variable and execute default action only when you enable it. Link to comment https://forums.kleientertainment.com/forums/topic/63168-disable-combat/#findComment-713575 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