icantevenname Posted March 29, 2022 Share Posted March 29, 2022 I want to make a weapon that always deals the same amount of damage no matter if the target has armor or not. Is it even possible? I don't think there is a single item in the game that does that. Link to comment https://forums.kleientertainment.com/forums/topic/138732-ignore-defensearmor/ Share on other sites More sharing options...
Monti18 Posted March 30, 2022 Share Posted March 30, 2022 You could set the damage to 0 and do this: local function OnAttack(inst,attacker,target) if target and target.components.health then target.components.health:DoDelta(-20)--replace it with the damage you would like it make end end --fn() inst.components.weapon:SetOnAttack(OnAttack) Link to comment https://forums.kleientertainment.com/forums/topic/138732-ignore-defensearmor/#findComment-1553807 Share on other sites More sharing options...
icantevenname Posted April 13, 2022 Author Share Posted April 13, 2022 (edited) On 3/30/2022 at 5:07 AM, Monti18 said: You could set the damage to 0 and do this: local function OnAttack(inst,attacker,target) if target and target.components.health then target.components.health:DoDelta(-20)--replace it with the damage you would like it make end end --fn() inst.components.weapon:SetOnAttack(OnAttack) Nope, the damage is still reduced. Not to mention the stun animation doesn't play at all. Though, if you take out the minus, you could make something that beats someone to life. Just thought of something, is there a way to force the stun animation every hit? Edited April 13, 2022 by icantevenname Link to comment https://forums.kleientertainment.com/forums/topic/138732-ignore-defensearmor/#findComment-1557339 Share on other sites More sharing options...
Monti18 Posted April 16, 2022 Share Posted April 16, 2022 (edited) Try it with this: local function OnAttack(inst,attacker,target) if target and target.components.health then local old_val = target.components.health.currenthealth target.components.health:SetVal(old_val - 20) --replace it with the damage you would like it make target:PushEvent("attacked", { attacker = attacker, damage = 0, weapon = inst }) end end --fn() inst.components.weapon:SetOnAttack(OnAttack) This should set the value of the health directly to one minus the damage of the weapon. Not tested, but I think you can just push the event attacked like the fire and icestaff do to have the target play the stun animation. Not sure about the forcing stunlock each hit, I think if you add stimuli = "stun" to the PushEvent, it will stun every hit. target:PushEvent("attacked", { attacker = attacker, damage = 0, weapon = inst, stimuli = "stun" }) Edited April 16, 2022 by Monti18 1 Link to comment https://forums.kleientertainment.com/forums/topic/138732-ignore-defensearmor/#findComment-1558928 Share on other sites More sharing options...
icantevenname Posted April 18, 2022 Author Share Posted April 18, 2022 Works just right! Even the forced stun! Link to comment https://forums.kleientertainment.com/forums/topic/138732-ignore-defensearmor/#findComment-1559747 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