;Script trigger script for damaging tiles in the Death Crypt, map 1147

If GetUserFlag(#USERID,45) <> 555
	Health = GetUserHP(#USERID)
	MaxHealth = GetUserMaxHP(#USERID) 
	
	Amount = 0.33
	If #YPOS > 10
		Amount = 0.66
	EndIf
	If #YPOS > 12
		Amount = 1.0
	EndIf
	Damage = Floor(Health * Amount) + 5
	If Damage < Floor(MaxHealth * Amount)
		Damage = Floor(MaxHealth * Amount)
	EndIf
	
	If Damage > Floor(Health - 1)
		SendMessageToAll("* "+GetUserName(#USERID)+" has been killed by a trap!",#MSG_CRITICAL)
	EndIf
	DamageUser(#USERID,Damage)
EndIf

Continue = 1