How do you make wooden props unbreakable, either individually or globally?
https://developer.valvesoftware.com/wiki/Filter_activator_class
How to make prop_physics unbreakable?
I wasn't able to successfully translate these solutions into code. Here's what I tried (ent is a prop_physics entity created before these blocks of code):
dmgFilter = ents.Create("filter_damage_type")
dmgFilter:SetName("damage_filter_props")
dmgFilter:SetKeyValue("damagetype", "slowfreeze")
ent:SetKeyValue("damagefilter", "damage_filter_props")
and
dmgFilter = ents.Create("filter_activator_class")
dmgFilter:SetName("damage_filter_props_2")
ent:SetKeyValue("damagefilter", "damage_filter_props_2")
What am I doing incorrectly?
Afaik you can't undo that.
-
You could try to use GM/EntityTakeDamage, just check if the entity is a wooden prop and CTakeDamageInfo/SetDamage to 0.
According to the documentation for GM/EntityTakeDamage, returning true will block a damage event. To test this, I simply did
function GM:EntityTakeDamage(ent, dmginfo)
return true
end
This successfully made the wooden props invincible. I already have a custom GM/EntityTakeDamage function, so I'll need to modify it to get it to work properly. But my problem is essentially solved.
(As a side note, why does the forum insist on uglifying my code by squishing together "returntrueend"?)
Use it with hook.Add so you don't override anything.
Sorry, you need to Log In to post a reply to this thread.