Danielance Posted June 21, 2018 Share Posted June 21, 2018 (edited) Hey it's me, back at it again with being bad at programming Sorry for making another forum asking for help so soon, I couldn't find anything to help me with my issue in particular. I'm trying to make the Shahanshah from TF2, where if you're below half health, it does more damage than if you're above half health. I tried making it so that if you're below 50 health, it deals 50 damage instead of it's normal 30, as seen in line 27 of shana.lua. Quote local function onattack(inst, owner, target, attacker) local health = owner.components.health if inst ~= nil and inst:IsValid() and attacker ~= nil and attacker:IsValid() and (attacker.components.health.current) <= 50 then health:DoDelta(-20) else target.components.health:DoDelta(0) end end I tried and couldn't get it to work how I wanted it to, and i'm hoping that someone would be nice enough to help (again). shana.lua I just called it 'shana' so I didn't have to type Shahanshah every time Edited June 21, 2018 by Danielance making the title easier to understand Link to comment Share on other sites More sharing options...
DarkMatterZero Posted June 21, 2018 Share Posted June 21, 2018 Hey there! So this almost certainly isn't the simplest solution, but it should work. Let me know if you have any questions or problems with my code. shana.lua Link to comment Share on other sites More sharing options...
Danielance Posted June 21, 2018 Author Share Posted June 21, 2018 It works great! thanks for the help. 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