Help with fake invincibility

Goldenhog

Wandering Protagonist
Code:
addHook("ShouldDamage", function(mo,inf,src)
	if (inf or src)
	or P_PlayerTouchingSectorSpecial(mo.player,1,1)
	or P_PlayerTouchingSectorSpecial(mo.player,1,2)
	or P_PlayerTouchingSectorSpecial(mo.player,1,3)
	or P_PlayerTouchingSectorSpecial(mo.player,1,4)
	or P_PlayerTouchingSectorSpecial(mo.player,1,5)
		return false
	end
end, MT_PLAYER)

This is the code I have. It's meant to make the player invulnerable to contact damage, projectiles and non-instakill damage sectors. It works, except when it comes to linedefs. For some reason, standing on lava functions fine but touching a lavafall or walking off of a lava FOF results in damage. Same with spike sectors (i know these are not to be used anymore i was just using an old map for testing) - standing on them works, walking off of them results in damage. Same with THZ's electric floors, etc.
 
Yup, that works perfectly. Thanks for the save!

The code as it looks now, for anyone curious:

Code:
addHook("ShouldDamage", function(mo,inf,src,dmg,dmgtype)
	if (inf or src)
	or not dmgtype // (protects from generic-type damage sectors)
	or dmgtype == DMG_WATER
	or dmgtype == DMG_FIRE
	or dmgtype == DMG_ELECTRIC
	or dmgtype == DMG_SPIKE
		return false
	end
end, MT_PLAYER)
 

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top