Hi I'm trying to write a simple hitmarker plugin for my server, and I'm having trouble getting it to display the correct damage dealt to the player / NPC.
Looking in the rust DLLs I've realized the hook I'm using runs before the hurt function has scaled / mitigated it based on the bone hit and armor etc.
I've been able to find the scaling based on the hit bone (Down the bottom), but I haven't worked out how to get the protection value from the hit part yet. Could somebody help me with this? (Sorry if this is in wrong section).
[DOUBLEPOST=1430044104,1430022587][/DOUBLEPOST]To be more clear, I know I need to use -Code:PLUGIN.Title = "Hitmarkers" PLUGIN.Version = V(1, 0, 1) PLUGIN.Description = "Simple hitmarkers." PLUGIN.Author = "render." PLUGIN.HasConfig = falsefunction PLUGIN:OnEntityTakeDamage(victim, hitInfo)local attacker = hitInfo.Initiator --print("lol") if (attacker:GetComponent("BasePlayer")) then if (victim:GetComponent("BasePlayer")) or (victim:GetComponent("BaseNPC")) then local dmg = hitInfo.damageTypes:Total()--Wrong damage... need it AFTER hurt has had it's way with it. local plypos = attacker.eyes.position + attacker.eyes:Forward() * 2.1 + attacker.eyes:Up() * 0.025 local dmsg = "DEAD" local dmsg2 = tostring(math.floor(dmg + 0.5)) if tonumber(dmg) >= 1 then if (victim:Health() - dmg) <= 0 then attacker:SendConsoleCommand("ddraw.text", 0.5, System.ConsoleColor.White, plypos, "<color=red>"..dmsg.."</color>") else if (victim:GetComponent("BasePlayer")) then self:GetDMG(victim, hitInfo) if hitInfo.isHeadshot == true then attacker:SendConsoleCommand("ddraw.text", 0.7, System.ConsoleColor.White, plypos, "<color=red>HIT</color>") else attacker:SendConsoleCommand("ddraw.text", 0.45, System.ConsoleColor.White, plypos, "HIT") end else attacker:SendConsoleCommand("ddraw.text", 0.45, System.ConsoleColor.White, plypos, dmsg2) end end end end end endfunction PLUGIN:GetDMG(victim, hitInfo)--Just testing what I can find here. if victim.skeletonProperties then local boneProperty = victim.skeletonProperties local boneInfo = boneProperty:FindBone(hitInfo.HitBone) local boneMulti = boneInfo.damageMultiplier local part = hitInfo.HitPart print(boneMulti.."|"..part) end end
But I'm doing it wrong : /Code:public static GameManifest.MeshColliderInfo FindColliderInfo(uint partID)
Help with a plugin (Lua)
Discussion in 'Rust Development' started by render. 2, Apr 26, 2015.
-
This should either return null if there isn't protection or a MeshColliderInfo with the protection value.Code:
global.SkinnedMeshCollider:FindColliderInfo(hitInfo.HitPart)
