• 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!

Lua Fixing code of Metin stones event!

BorkaOTS

New Member
Joined
Jul 7, 2015
Messages
9
Reaction score
0
Hello, i have following problems (using tfs 1.0):

  • In console while loading ots
Code:
[Error - CreatureEvent: :configureEvent] Invalid type for creature event: Kamulec
[Warning - Base Events: :loadFromXml] Failed to configure event

I found wrong coded script in creaturescripts.xml :
Code:
 <event type="combat" name="Kamulec" event="script" value="metin_stones.lua"/>

I get it that I have to change name from Kamulec into something else but what should i write there?

  • In console while executing comand /metin that should start event
Code:
Lua Script Error:  [TalkAction Interface]
data/talkactions/scripts/METIN.lua:onSay
data/talkactions/scripts/Metin.lua:23: attempt to call global 'doCreateMonster'
(a nil value)
stack traceback:
               [C]: in funcktion 'doCreateMonster'
               data/talkactions/scripts/METIN.lua:23: in function <data/talkactions/scripts/METIN.lua:18>

METIN.lua scripts is following

Code:
local stones = {
            [1] = {name="Earth Stone"},
            [2] = {name="Icy Stone"},
            [3] = {name="Fire Stone"},
            [4] = {name="Wind Stone"},
    }

local pos = {
        [1] = {pos={x = 959, y = 638, z = 7}},
            [2] = {pos={x = 1012, y = 639, z = 7}},
            [3] = {pos={x = 961, y = 688, z = 7}},
            [4] = {pos={x = 1011, y = 686, z = 7}},
    }



function onSay()
    local monst = stones[math.random(1, #stones)]
    local poss = pos[math.random(1, #pos)]
    print(monst, poss)
    if not(monst) then return TRUE end
    doCreateMonster(monst.name,poss.pos)
    doBroadcastMessage('[Event Stones]\n '.. monst.name ..' have been spawn. Find it in Event Chamber and defeat it!', 22)
    return TRUE
end
 
I believe you have too register the event "kamuelc" inside your login.lua
data/creaturescripts/scripts/other/login.lua

-Martin

I tried:

Code:
function onLogin(cid)
    local player = Player(cid)
   

    local loginStr = "Welcome to " .. configManager.getString(configKeys.SERVER_NAME) .. "!"
    if player:getLastLoginSaved() <= 0 then
        loginStr = loginStr .. " Please choose your outfit."
        player:sendOutfitWindow()
    else
        if loginStr ~= "" then
            player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
        end

        loginStr = string.format("Your last visit was on %s.", os.date("%a %b %d %X %Y", player:getLastLoginSaved()))
    end
    player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
    player:registerEvent("aol")
    player:registerEvent("Monstersweaponupgrade")
    player:registerEvent("PlayerDeath")
    player:registerEvent("ZE_Death")
    player:registerEvent("Kamulec")
    if player:getStorageValue(1000) == 1 then --write ze_join_storage number here
        player:setStorageValue(1000, 0) --write ze_join_storage number here
    end
    return true
end

and that kamulec part is still not working. I got following error in console:
Invalid type for creature event: Kamulec
Failed to configure event
 
Where this tables?
Code:
doCreateMonster(monst.name,poss.pos)
What do you mean?

I figured out few things:
Had to change event type into kill or one of these (types from tfs 1.0) instead of combat:
Code:
login
logout
think
preparedeath
death
kill
advance
textedit

modalwindow
changehealth
changemana
extendedopcode

Code:
    <event type="kill" name="Kamulec" script="metin_stones.lua"/>

but i cant test which one is working instead of combat because i still have error with attempt to call a global 'doCreateMonster'. I think i have to change doCreateMonster into tfs 1.0 function that can create monster. Does someone know how?
 
Last edited by a moderator:
Back
Top