local max_count_amy = 2
local max_count_metal = 3
local function PlayerAbilityCheckAmy(p)
if p.mo and p.mo.valid and (p.mo.skin == "amy") then
--set counter if the variable doesn't exist
if p.abilityused == nil then
p.abilityused = max_count_amy
end
--reset counter when touching the floor
if P_IsObjectOnGround(p.mo) then
p.abilityused = max_count_amy
end
end
end
local function PlayerAbilityCheckMetal(p)
if p.mo and p.mo.valid and (p.mo.skin == "metalsonic") then
if p.abilityused == nil then
p.abilityused = max_count_metal
end
if P_IsObjectOnGround(p.mo) then
p.abilityused = max_count_metal
end
end
end
addHook("PlayerThink", PlayerAbilityCheckAmy)
addHook("PlayerThink", PlayerAbilityCheckMetal)
local function AbilityControl(p)
if (p.abilityused == 0) then
return true --do nothing
end
--decrease counter by 1
p.abilityused = $ - 1
--not needed, but it shows that we're not overriding the normal ability
return false
end
addHook("AbilitySpecial", AbilityControl)