MarisaRaccoon Posted August 9, 2020 Share Posted August 9, 2020 Hello guys :))Today I started researching if there was a way to tell the game that, if you are fighting let's say a "clockwork Bishop" then you can deal to him 1 damage extra damage in general. Regardless of what weapon you are using. I want to make my character As I said, Im very new in Moding and I've been reading a lot of the posts in the Forum. I would love to hear if you guys by any chance know how to do something like this or know how to make something that could work like this :)) Thank you lots, Marisa 1 Link to comment Share on other sites More sharing options...
-LukaS- Posted August 11, 2020 Share Posted August 11, 2020 In your characters prefab file put this after the 'combat' component: inst.components.combat.bonusdamagefn = BonusDamageFn -- BonusDamageFn is just a function name, you can rename it to anything you want And add a local function for the damage: local function BonusDamageFn(inst, target, damage, weapon) return (target.prefab == "bishop" and 1) or 0 -- Checking if target is a certain prefab and then assigning bonus damage, value after 'or' is set if targets prefab isn't 'bishop', so no additional damage for them end 2 2 Link to comment Share on other sites More sharing options...
Aquarell Posted December 31, 2021 Share Posted December 31, 2021 On 8/11/2020 at 1:04 PM, -t- said: In your characters prefab file put this after the 'combat' component: inst.components.combat.bonusdamagefn = BonusDamageFn -- BonusDamageFn is just a function name, you can rename it to anything you want And add a local function for the damage: local function BonusDamageFn(inst, target, damage, weapon) return (target.prefab == "bishop" and 1) or 0 -- Checking if target is a certain prefab and then assigning bonus damage, value after 'or' is set if targets prefab isn't 'bishop', so no additional damage for them end Hi, I'm trying to increase damage against toadstool and frogs, but it didn't work. I went over many iterations and the game breaks every time I try to introduce this change. Is there something obvious that I'm doing wrong? I'm really lost Thank you in advance <3 Link to comment Share on other sites More sharing options...
IronHunter Posted December 31, 2021 Share Posted December 31, 2021 2 hours ago, Aquarell said: Hi, I'm trying to increase damage against toadstool and frogs, but it didn't work. I went over many iterations and the game breaks every time I try to introduce this change. Is there something obvious that I'm doing wrong? I'm really lost Thank you in advance <3 You are trying to do arithmetic on a function but not calling the function. If you read the previous instructions you were suppose to add your function to the bonusfn reference and not the damagemultiplier. inst.components.combat.bonusdamagefn = BonusDamageFn 3 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