Timed effects - NLferdiNL/Teardown-Chaos-Mod GitHub Wiki
If you want to create an event that lasts for a little while, or does something while it's active. You can create an active effect.
Below is an example of an active effect that does something while it is active.
jetpack = {
name = "Jetpack",
effectDuration = 15,
effectLifetime = 0,
hideTimer = false,
effectSFX = {},
effectSprites = {},
effectVariables = {},
onEffectStart = function(vars) end,
onEffectTick = function(vars)
if InputDown("space") then
local tempVec = GetPlayerVelocity()
tempVec[2] = 5
SetPlayerVelocity(tempVec)
end
end,
onEffectEnd = function(vars) end,
},
Alternatively here is an example of an effect that does something when started and stopped.
instantDeath = {
name = "Instant Death",
effectDuration = 5,
effectLifetime = 0,
hideTimer = true,
effectSFX = {},
effectSprites = {},
effectVariables = {},
onEffectStart = function(vars)
SetPlayerHealth(0)
end,
onEffectTick = function(vars) end,
onEffectEnd = function(vars)
if GetPlayerHealth() <= 0 then
RespawnPlayer() -- This is used on maps that don't auto respawn you.
end
end,
},