TagumonYatsuray Posted December 7, 2017 Share Posted December 7, 2017 I would like to have a character refuse to attack mobs with certain tags, I have an 'if' 'else' statement for damage multiplication depending on tags, but is there a way to make the character tell the player he won't do attack, and refuse to go attack it? Link to comment https://forums.kleientertainment.com/forums/topic/85203-refusal-to-attack/ Share on other sites More sharing options...
Leonardo Cox Posted December 7, 2017 Share Posted December 7, 2017 local function DoAttack(inst, data) if data.target and data.target:HasTag("whatever_you_want_here_idk_it_could_be_pigs_or_spiders_I_dont_judge") then inst.sg:GoToState("idle") end end --put this in your masterpostinit inst:ListenForEvent("doattack", DoAttack) I just took a guess, have no idea if this works or not. If it doesn't work I'll give you a better function when I get back from work, Link to comment https://forums.kleientertainment.com/forums/topic/85203-refusal-to-attack/#findComment-982181 Share on other sites More sharing options...
TagumonYatsuray Posted December 7, 2017 Author Share Posted December 7, 2017 (edited) It hasn't worked for me : / just got home and tried it It crashed and gave me an error about data not being defined Edit: It doesn't crash anymore, but the character still attacks and does damage. Edited December 7, 2017 by TagumonYatsuray Update Link to comment https://forums.kleientertainment.com/forums/topic/85203-refusal-to-attack/#findComment-982249 Share on other sites More sharing options...
TagumonYatsuray Posted January 15, 2018 Author Share Posted January 15, 2018 bump Link to comment https://forums.kleientertainment.com/forums/topic/85203-refusal-to-attack/#findComment-993091 Share on other sites More sharing options...
pickleplayer Posted January 16, 2018 Share Posted January 16, 2018 Lets do a little debugging to find out if its being called correctly. In that code snippet above, can you replace inst:GoToState("idle") with print("DONT SWING") now launch a game and press Ctrl-L and try and attack an animal with one of those tags listed. if "DONT SWING" shows up, then we know its getting called right. But if not, then we need to look elsewhere for the problem Link to comment https://forums.kleientertainment.com/forums/topic/85203-refusal-to-attack/#findComment-993163 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