VenusVapor Posted August 10, 2022 Share Posted August 10, 2022 Im new to modding so im sorry if this is an obvious fix. I wanted my character to get 2x damage when they kill an enemy and lose 0.25x damage when they hit an enemy. So I used and edited a code that I found somewhere on the forums but I keep getting "Unexpected symbol near ')' no matter what I do. The ')' the game is talking about is below "if inst.components.combat.damagemultiplier > 0.75 then" and above "inst.OnSave" inst:ListenForEvent("onkillother", function(inst, data) inst.components.combat.damagemultiplier = 2 end) inst:ListenForEvent("onattackother", function(inst, data) if inst.components.combat.damagemultiplier > 0.75 then inst.components.combat.damagemultiplier = inst.components.combat.damagemultiplier - 0.25 else end) inst.OnSave = function(inst, data) data.mult = inst.components.combat.damagemultiplier end inst.OnLoad = function(inst, data) inst.components.combat.damagemultiplier = data.mult or 0.75 end Link to comment https://forums.kleientertainment.com/forums/topic/142505-unexpected-symbol-near/ Share on other sites More sharing options...
mathem99 Posted August 10, 2022 Share Posted August 10, 2022 Replace your code with this: inst:ListenForEvent("onkillother", function(inst, data) inst.components.combat.damagemultiplier = 2 end) inst:ListenForEvent("onattackother", function(inst, data) if inst.components.combat.damagemultiplier > 0.75 then inst.components.combat.damagemultiplier = inst.components.combat.damagemultiplier - 0.25 end end) inst.OnSave = function(inst, data) data.mult = inst.components.combat.damagemultiplier end inst.OnLoad = function(inst, data) inst.components.combat.damagemultiplier = data.mult or 0.75 end It should work. Link to comment https://forums.kleientertainment.com/forums/topic/142505-unexpected-symbol-near/#findComment-1593438 Share on other sites More sharing options...
VenusVapor Posted August 10, 2022 Author Share Posted August 10, 2022 It did work! Thanks. Too bad the code I used is outdated tho. Link to comment https://forums.kleientertainment.com/forums/topic/142505-unexpected-symbol-near/#findComment-1593445 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