Proc Posted June 24, 2019 Share Posted June 24, 2019 So, I'm making a combat oriented character, and her charcter trait is being very clumsy, so I figured a fun way to represent it would be for her to have a 5% or so chance to hit herself whenever she's attacking something. Of course I intend to balance this with above average health and perhaps a custom healing item, but for now, I first want to figure out this perk. I searched the forums but I couldnt find anythign related to self-harm, could I get some help? I am unfortunately new to scripting. It would be best if the character can play the animation and sound for being hit whenever this happens, but if it complicates things too much, then just adding an "ouch" message to notify the player when the self damage triggers would be workable. Link to comment Share on other sites More sharing options...
. . . Posted June 24, 2019 Share Posted June 24, 2019 (edited) in yourchar.lua above master_postinit local function HitSelf(inst) local rng = math.random(1,10) -- 10% if rng == 1 then inst.components.combat:GetAttacked(inst, 999, nil) -- Hurt myself inst.components.talker:Say("Ow! I hit myself!") end end inside master_postinit inst:ListenForEvent("onattackother", HitSelf) Edited June 24, 2019 by Warbucks Link to comment Share on other sites More sharing options...
Proc Posted June 24, 2019 Author Share Posted June 24, 2019 (edited) thanks, i will test this out. Edit: Alright, i tested it out and it works!, guess i will have to test values in gameplay to find a happy medium between health risked and damage and healing compensations. Edited June 24, 2019 by Proc 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