1. Can someone help me work this correctly so that "Fall" damage is zero ( 0 ) ?

    Code:
    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)
            ...
            ...
    
    I get the error: instance method 'ScaleAll' requires a non null target object
     
  2. Wulf

    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.
     
  3. you mean like:
    Code:
    if damageTypeStr:find("Fall") then return false end
     
  4. Wulf

    Wulf Community Admin

    Yup, that would do it. Returning anything other than null would cancel it.
     
  5. okay. Now how do I scale it (properly) ?
     
  6. Wulf

    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.
     
  7. I want to know how to do both. :)

    I tried this
    Code:
    hitinfo.damageTypes.Set(damageType, 0.01)
    and I got a different error: invalid arguments to method: DamageTypeList.Set
     
  8. Wulf

    Wulf Community Admin

    Look at the plugin I linked.
     
  9. I did.
     
  10. Wulf

    Wulf Community Admin

    You're using Lua, so you'd need to handle it the Lua way:
    Code:
    hitinfo.damageTypes:Set(damageType, 0.01)
     
  11. Duh !! I should have noticed that. Thanks! I'm such a noob.