[Prop Hunt] [Closed] Limit max health for props



Prop Hunt

Issue or Suggestion:

Description of problem
Don’t increase max health for player on props team if they switch to a larger prop.
Example: A player that hides as a can with 1 health still has 1 health when they switch to a bigger prop, like a large crate

If anyone’s good at programming, feel free to suggest a solution below


(Preface: I’m assuming the following is the mod running on Zink PH, but could very well be entirely wrong.)

Not completely used to how mods are written in Gmod, but best guess to fix this has to do with lines 302, 304, 306, and 329 of this:

I didn’t look too thoroughly, but seems like you might want to replace lines 302-306 with something like:
local new_health = math.min(pl.ph_prop.health, math.Clamp((pl.ph_prop.health / pl.ph_prop.max_health) * ent_health, 1, 200))
pl.ph_prop.health = new_health
pl.ph_prop.max_health = math.min(pl.ph_prop.max_health, ent_health)

That seems to be one function that’s involved in a prop changing props (not sure if there are others), and the health of that prop being readjusted for the prop’s new volume. Kinda interesting to see how they do it!

Hope that helps!