⚔️ fight_CastSpellById(spellId, targetCellId)
Lance un sort sur une cellule spécifique en utilisant l'ID du sort au lieu du nom. Plus rapide que fight_CastSpell() car il n'y a pas besoin de rechercher le nom du sort.
fight_CastSpellById(spellId, targetCellId)
FightLance un sort sur une cellule spécifique en utilisant l'ID du sort au lieu du nom. Plus rapide que fight_CastSpell() car il n'y a pas besoin de rechercher le nom du sort.
Paramètres
| Paramètre | Type | Description |
|---|---|---|
spellId |
int | L'ID numérique du sort |
targetCellId |
int | L'ID de la cellule cible |
Valeur de retour
Aucun
Exemple
function example_fightcastspellbyid()
-- Lancer un sort par ID
local enemyCell = fight_GetClosestEnemyCell()
fight_CastSpellById(123, enemyCell) -- Lancer le sort avec l'ID 123
-- Utiliser avec une liste de sorts prédéfinis
local spells = {
{id = 123, name = "Boule de Feu", cost = 3},
{id = 456, name = "Météore", cost = 6}
}
for _, spell in ipairs(spells) do
if fight_GetPA() >= spell.cost then
fight_CastSpellById(spell.id, enemyCell)
break
end
end
end
-- Appeler la fonction
example_fightcastspellbyid()