hello
I am trying to create a few second family summons and I get this error:
I admit that I am very green, but on another server I did get it,
I changed all the related files called familiars by family, I have also changed the looktype ids for others and you can see the result, also because of this error I cannot enter with the GM, I am using TFS 1.4, server 12.70.
someone who understands can help me
Thank you
edit: here the familia.lua that gives the error
I am trying to create a few second family summons and I get this error:
C++:
The Demon Helmet Server - Version: (TFS 1.4)
Compiled with: Microsoft Visual C++ version 14.2
x64
Linked with LuaJIT 2.0.5 for Lua support
A server developed by Mark Samman and The Forgotten Server Developers
>> Client Version: 12.70
C++:
Lua Script Error: [Scripts Interface]
C:\otserv\data\scripts\creaturescripts\others\familia.lua:callback
C:\otserv\data\scripts\creaturescripts\others\familia.lua:47: attempt to call method 'getfamiliaLooktype' (a nil value)
stack traceback:
[C]: in function 'getfamiliaLooktype'
C:\otserv\data\scripts\creaturescripts\others\familia.lua:47: in function <C:\otserv\data\scripts\creaturescripts\others\familia.lua:35>
ADM has logged out. | Client: 12.61
I admit that I am very green, but on another server I did get it,
I changed all the related files called familiars by family, I have also changed the looktype ids for others and you can see the result, also because of this error I cannot enter with the GM, I am using TFS 1.4, server 12.70.
someone who understands can help me
Thank you
edit: here the familia.lua that gives the error
Lua:
local familia = {
[VOCATION.CLIENT_ID.SORCERER] = {id = 133, name = "Sorcerer familia"},
[VOCATION.CLIENT_ID.DRUID] = {id = 58, name = "Druid familia"},
[VOCATION.CLIENT_ID.PALADIN] = {id = 152, name = "Paladin familia"},
[VOCATION.CLIENT_ID.KNIGHT] = {id = 131, name = "Knight familia"}
}
local timer = {
[1] = {storage=Storage.PetSummonEvent10, countdown=10, message = "10 seconds"},
[2] = {storage=Storage.PetSummonEvent60, countdown=60, message = "one minute"}
}
local function sendMessageFunction(pid, message)
if Player(pid) then
Player(pid):sendTextMessage(MESSAGE_LOOT, "Your summon will disappear in less than " .. message)
end
end
local function removePet(creatureId, playerId)
local creature = Creature(creatureId)
local player = Player(playerId)
if not creature or not player then
return true
end
creature:remove()
for sendMessage = 1, #timer do
player:setStorageValue(timer[sendMessage].storage, -1)
end
end
local familiaStorage = Storage.PetSummon
local familiaLogin = CreatureEvent("familiaLogin")
function familiaLogin.onLogin(player)
local vocation = familia[player:getVocation():getClientId()]
local familiaName
local petTimeLeft = player:getStorageValue(familiaStorage) - player:getLastLogout()
if vocation then
if (not isPremium(player) and player:hasfamilia(vocation.id)) or player:getLevel() < 100 then
player:removefamilia(vocation.id)
elseif isPremium(player) and player:getLevel() >= 100 then
if petTimeLeft > 0 then
familiaName = vocation.name
end
if player:getfamiliaLooktype() == 0 then
player:setfamiliaLooktype(vocation.id)
end
if not player:hasfamilia(vocation.id) then
player:addfamilia(vocation.id)
end
end
end
if familiaName then
position = player:getPosition()
local familiaMonster = Game.createMonster(familiaName, position, true, false)
player:addSummon(familiaMonster)
familiaMonster:setOutfit({lookType = player:getfamiliaLooktype()})
--familiaMonster:reload()
local deltaSpeed = math.max(player:getSpeed() - familiaMonster:getSpeed(), 0)
familiaMonster:changeSpeed(deltaSpeed)
player:setStorageValue(familiaStorage, os.time() + petTimeLeft)
familiaMonster:registerEvent("familiaDeath")
position:sendMagicEffect(CONST_ME_MAGIC_BLUE)
addEvent(removePet, petTimeLeft*1000, familiaMonster:getId(), player:getId())
for sendMessage = 1, #timer do
if player:getStorageValue(timer[sendMessage].storage) == -1 and petTimeLeft >= timer[sendMessage].countdown then
player:setStorageValue(timer[sendMessage].storage, addEvent(sendMessageFunction, (petTimeLeft-timer[sendMessage].countdown)*1000, player:getId(), timer[sendMessage].message))
end
end
end
return true
end
familiaLogin:register()
local advancefamilia = CreatureEvent("Advancefamilia")
function advancefamilia.onAdvance(player, skill, oldLevel, newLevel)
local vocation = familia[player:getVocation():getClientId()]
if newLevel >= 100 and isPremium(player) then
if player:getfamiliaLooktype() == 0 then
player:setfamiliaLooktype(vocation.id)
end
if not player:hasfamilia(vocation.id) then
player:addfamilia(vocation.id)
end
end
return true
end
advancefamilia:register()
local familiaDeath = CreatureEvent("familiaDeath")
function familiaDeath.onDeath(creature, corpse, lasthitkiller, mostdamagekiller, lasthitunjustified,
mostdamageunjustified)
local player = creature:getMaster()
if not player then
return false
end
local vocation = familia[player:getVocation():getClientId()]
if table.contains(vocation, creature:getName()) then
player:setStorageValue(familiaStorage, os.time())
for sendMessage = 1, #timer do
stopEvent(player:getStorageValue(timer[sendMessage].storage))
player:setStorageValue(timer[sendMessage].storage, -1)
end
end
return true
end
familiaDeath:register()