Script linéaire + circulaire
function move()
return {
{ map = "6,-18", path = "left", fight = true },
{ map = "5,-18", path = "left" }, -- Première ligne pour 5,-18
{ map = "4,-18", path = "right", fight = true },
{ map = "5,-18", path = "right" }, -- Sera ignoré car y'a 5,-18 en haut
}
end-- true = recommencer le script depuis le début, necessite que la dernière carte vous mène à la première carte.
RC_CIRCULAR = true
-- Tableau des actions
mapActionsTable =
{
{ map = "5,-18", path = "top" },
{ map = "5,-19", path = "bottom", fight = true },
{ map = "5,-18", path = "right" },
{ map = "6,-18", path = "left", fight = true },
{ map = "5,-18", path = "bottom" },
{ map = "5,-17", path = "top", fight = true },
{ map = "5,-18", path = "left" },
{ map = "4,-18", path = "right", fight = true },
}
for _, element in ipairs(mapActionsTable) do element.done = false end
-- Ne pas toucher à cette fonction
function getMapActions()
-- Retourner la première carte non visitée
for _, mapActions in ipairs(mapActionsTable) do
if map.onMap(mapActions.map) and not mapActions.done then
mapActions.done = true
return mapActions
end
mapActions.done = true
end
-- Toutes les cartes sont visitées ? on réinitialise
for _, mapActions in ipairs(mapActionsTable) do
mapActions.done = false
end
-- Script circulaire ?
if RC_CIRCULAR then
-- Retourner la première carte non visitée
for _, mapActions in ipairs(mapActionsTable) do
if map.onMap(mapActions.map) and not mapActions.done then
mapActions.done = true
return mapActions
end
mapActions.done = true
end
end
-- Aucune carte ?
return nil
end
-- Fonction d'entrée
function move()
-- Ajouter ce que vous voulez ici
-- Ne pas toucher à cette partie au-dessous
if character.wasInFight() and mapActions ~= nil and map.onMap(mapActions.map) then
return { mapActions }
end
mapActions = getMapActions()
if mapActions ~= nil then
return { mapActions }
end
endMis à jour