Can someone help me work this correctly so that "Fall" damage is zero ( 0 ) ?
I get the error: instance method 'ScaleAll' requires a non null target objectCode:PLUGIN:OnEntityTakeDamage( entity, hitinfo ) if entity:ToPlayer() then local playerID = rust.UserIDFromPlayer( entity ) local damageType = hitinfo.damageTypes:GetMajorityDamageType() local damageTypeStr = tostring(damageType) print("damageType = " .. tostring(damageType)) if damageTypeStr:find("Fall") then hitinfo.damageTypes.ScaleAll(0.01) ... ...
How to nullify fall damage
Discussion in 'Rust Development' started by isuelt, Feb 24, 2016.
-
Wulf Community Admin
You should be able to just check the damage type and then return true/false, no need to try to scale it.
-
you mean like:
Code:if damageTypeStr:find("Fall") then return false end -
Wulf Community Admin
Yup, that would do it. Returning anything other than null would cancel it. -
okay. Now how do I scale it (properly) ?
-
Wulf Community Admin
Why do you need to scale it? You are wanting to cancel it, you'd just return true/false like I mentioned. If you want to change the value, you'd need to modify the hitinfo, which doesn't include ScaleAll. Example: RealisticFall for Rust | Oxide. -
I want to know how to do both.

I tried this
and I got a different error: invalid arguments to method: DamageTypeList.SetCode:hitinfo.damageTypes.Set(damageType, 0.01)
-
Wulf Community Admin
Look at the plugin I linked. -
I did.
-
Wulf Community Admin
You're using Lua, so you'd need to handle it the Lua way:
Code:hitinfo.damageTypes:Set(damageType, 0.01)
-
Duh !! I should have noticed that. Thanks! I'm such a noob.
