Skip to content

Instantly share code, notes, and snippets.

@Underewarrr
Created March 31, 2024 17:33
Show Gist options
  • Save Underewarrr/cafc3db54c1fce5bd6333fad20d3053a to your computer and use it in GitHub Desktop.
Save Underewarrr/cafc3db54c1fce5bd6333fad20d3053a to your computer and use it in GitHub Desktop.
-- Create genkiDama instance
local genkiDama = Spell(SPELL_INSTANT)
-- Define a variable to track if the spell is currently being cast
local isCastingSpell = {}
-- Define onCastSpell callback for genkiDama
function genkiDama.onCastSpell(creature, variant)
local player = Player(creature)
local target = player:getTarget()
if not target then
print("No target creature found.")
return false
end
-- Check if the spell is already being cast by this player
if isCastingSpell[player:getId()] then
print("Spell is already being cast by this player.")
return false
end
-- Set the flag indicating the spell is being cast
isCastingSpell[player:getId()] = true
local auraEffect = effect.sayian.genki_dama
local targetPos = target:getPosition()
-- Send the aura effect animation
Spell:startEffectAnimation(player, auraEffect)
-- Schedule the stop of the aura effect
addEvent(function()
Spell:stopEffectAnimation(player, targetPos)
-- Reset the flag indicating the spell is no longer being cast
isCastingSpell[player:getId()] = false
end, 4000) -- Stop the effect animation after 4 seconds
end
-- Configure genkiDama properties
genkiDama:name("genki dama")
genkiDama:words("genki dama")
genkiDama:level(0)
genkiDama:mana(0)
genkiDama:group("attack")
genkiDama:soul(0)
genkiDama:isAggressive(true)
genkiDama:cooldown(0)
genkiDama:groupCooldown(0)
genkiDama:range(7)
genkiDama:needLearn(false)
genkiDama:vocation("saiyan")
genkiDama:register()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment