I have a Pendulum Blade Trap and I think I got this script from smallg. It works really well as you might imagine.
local damage = {}
local min_damage_frame1 = {}
local max_damage_frame1 = {}
local min_damage_frame2 = {}
local max_damage_frame2 = {}
function pendulum_blade_trap_init(e)
damage[e] = 25 --how much damage to apply per 0.25s
damage_range[e] = 60 --how close the player can get before damage is applied
min_damage_frame1[e] = 10 --starting frame to apply damage at in first direction
max_damage_frame1[e] = 25 --maximum frame to apply damage to in first direction
min_damage_frame2[e] = 50
max_damage_frame2[e] = 70
end
function pendulum_blade_trap_main(e)
if g_Entity[e]['animating'] == 0 and GetPlayerDistance(e) <= 300 then
SetAnimation(0)
LoopAnimation(e)
g_Entity[e]['animating'] = 1
CollisionOff(e)
end
if GetPlayerDistance(e) <= damage_range[e] then
-- This will check if the player is within the swing of the Pendulum..
if (GetAnimationFrame(e) >= min_damage_frame1[e] and GetAnimationFrame(e) <= max_damage_frame1[e]) or (GetAnimationFrame(e) >= min_damage_frame2[e] and GetAnimationFrame(e) <= max_damage_frame2[e]) then
if GetTimer(e) > 250 then
StartTimer(e)
HurtPlayer(e,damage[e]) --Obviously this is where the trap causes damage to the player..
end
end
else
StartTimer(e)
end
end --main
Have fun, Andrew...
HP Pavilion Laptop - AMD A8-4555M APU with Radeon(tm) HD Graphics - 1.6GHz, 8GB Memory, Windows 10 Home, 64-bit Operating System.
I've got something to say - It's better to burn out than fade away.