• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua [help] This creaturescript error

gmstrikker

Well-Known Member
Joined
Jul 30, 2014
Messages
458
Solutions
1
Reaction score
50
It's don't work and now give me this msg error, any can fix this script for me?

AKUMDAo.png


Code:
local spells = {
  [1] = { --sorcerer
  level = {
  [1] = "utevo lux", "exura", "adori",
  [40] = "exevo gran mas vis"
  }
  },
  [2] = { --druid
  level = {
  [1] = "utevo lux", "exura", "adori",
  [28] = "exevo gran mas pox"
  }
  },
  [3] = { --paladin
  level = {
  [1] = "utevo lux", "exura", "exevo con",
  [14] = "exevo con vis"
  }
  },
  [4] = { --knight
  level = {
  [1] = "utevo lux", "exura",
  [5] = "exori"
  }
  }
}
local array_sorc = {1,4,8}
local array_druid = {2,5,9}
local array_paladin = {3,6,10}
local array_knight = {4,7,11}
local text = ""
function onAdvance(player, skill, oldLevel, newLevel)
if skill ~= SKILL_LEVEL then
player = Player(cid)
if player:getVocation():getBase():getId() == array_sorc then
CONFIG = spells[1]
elseif player:getVocation():getBase():getId() == array_druid then
CONFIG = spells[2]
elseif player:getVocation():getBase():getId() == array_paladin then
CONFIG = spells[3]
elseif player:getVocation():getBase():getId() == array_knight then
CONFIG = spells[4]
end
if not CONFIG then
return false
end
EVENT = CONFIG.level[player:getLevel()]
if not EVENT then
return false
end
for i, v in ipairs(EVENT) do
text = text..""..i..", "
end
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "New spells: "..text.."")
end
return true
end
 
Actual script:
Code:
local spells = {
  [1] = { --sorcerer
  level = {
  [1] = {"utevo lux", "exura", "adori"},
  [40] = {"exevo gran mas vis"}
  }
  },
  [2] = { --druid
  level = {
  [1] = {"utevo lux", "exura", "adori"},
  [28] = {"exevo gran mas pox"}
  }
  },
  [3] = { --paladin
  level = {
  [1] = {"utevo lux", "exura", "exevo con"},
  [14] = {"exevo con vis"}
  }
  },
  [4] = { --knight
  level = {
  [4] = {"utevo lux", "exura"},
  [5] = {"exori"}
  }
  }
}
local vocs = {
  {1,5,9},
  {2,6,10},
  {3,7,11},
  {4,8,12}
}

local vocationSpells = {}

function onAdvance(cid, skill, oldLevel, newLevel)
  if skill == 7 then
     for i, class in ipairs(vocs) do
       if isInArray(class, getPlayerVocation(cid)) then
         vocationSpells = spells[i]
       end
     end
   
     if vocationSpells == nil then
       return false
     end

     local lvl = getPlayerMagLevel(cid, false)
     local playerSpells = vocationSpells.level[lvl]
   
     if #playerSpells == nil or #playerSpells == 0 then
       return false
     end
   
     for x = 1, #playerSpells do
       doPlayerSendTextMessage(cid, 20, "[NEW-SPELLS] Magic Level["..lvl.."]: "..playerSpells[x]..".")
       print(getPlayerMagLevel(cid, false))
       print(getPlayerVocation(cid))
     end
   end
   return true
end
 
Code:
19:22 [NEW-SPELLS] Magic Level[4]: utevo lux.
19:22 [NEW-SPELLS] Magic Level[4]: exura.
Actual script:
Code:
[4] = {"utevo lux", "exura"},
This is where you want to edit it.
All the script does is print what it shows in these fields.
Just type whatever you want in there.
Code:
[4] = {"utevo lux", "Berserk. Words: Exori. Price: 2300."},
This would show in-game as..
Code:
19:22 [NEW-SPELLS] Magic Level[4]: utevo lux.
19:22 [NEW-SPELLS] Magic Level[4]: Berserk. Words: Exori. Price: 2300.
 
Back
Top