kewizzle Posted January 13, 2020 Share Posted January 13, 2020 addEventHandler("onZombieSpawned",root, function ( ) setElementHealth ( source, math.random(10, 150 ) ) if getElementHealth(source) >= 10 and getElementHealth(source) <= 50 then setElementData(source, "easy", true) elseif getElementHealth(source) >= 51 and getElementHealth(source) <= 69 then setElementData(source, "medium", true) elseif getElementHealth(source) > 70 then setElementData(source, "hard", true) end if getElementData(source, "easy", true) then setElementHealth(source, 50) elseif getElementData(source, "medium", true) then setElementHealth(source, 100) elseif getElementData(source, "hard", true) then setElementHealth(source, 150) end end) sooo idk if im blind or stupid prolly a lil of both but i coded this from scratch twice and took 2 different approaches and neither worked right but they came close. yes i have a reason for elementdata they direct to what difficulty a zombie is by a colored dot but that aint my issue that all works but for some reason "easy" has the health of "hard" and they both have the same 150 health but medium is correct and only has 100 health. How do i make easy work and only have 50 health? Link to comment
Gordon_G Posted January 13, 2020 Share Posted January 13, 2020 (edited) Try to debug it by adding some iprint where you have an IF and print the life of the source etc so you can see where the issue comes from Edited January 13, 2020 by Gordon_G Link to comment
kewizzle Posted January 13, 2020 Author Share Posted January 13, 2020 addEventHandler("onZombieSpawned",root, function ( ) setElementHealth ( source, math.random(10, 150 ) ) if getElementHealth(source) <= 49 then setElementData(source, "medium", true) setElementHealth(source, 25) elseif getElementHealth(source) >= 50 and getElementHealth(source) <= 99 then setElementData(source, "easy", true) setElementHealth(source, 75) elseif getElementHealth(source) >= 100 then setElementData(source, "hard", true) setElementHealth(source, 125) end end) fixed it Link to comment
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