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

Mount System TFS 1.2

dkangel83

Member
Joined
Mar 31, 2010
Messages
148
Reaction score
18
Location
Brazil
Hey guys :) well im full of problems most cuz im noob and im backing to tibia and ot but well this time the problem is with Mount system.. that one that you use an item to tame a monster..

First at all as in the topic name, im using TFS 1.2, second im testing with a NO VOCATION player.. cuz i need things to be tested like this (the main feature of my future ot is for pack of friends who like to play like this and are abused of how official is handling things so we'll make a long term ot for we and for any who like it)

Well i have 2 problems..

One is with the script that i got from internet


PHP:
    <action itemid="13941" script="other/cup of molten gold.lua"/>
    <action itemid="5907" script="other/taming.lua"/>
    <action itemid="13247" script="other/taming.lua"/>
    <action itemid="13291" script="other/taming.lua"/>
    <action itemid="13292" script="other/taming.lua"/>
    <action itemid="13293" script="other/taming.lua"/>
    <action itemid="13294" script="other/taming.lua"/>
    <action itemid="13295" script="other/taming.lua"/>
    <action itemid="13298" script="other/taming.lua"/>
    <action itemid="13305" script="other/taming.lua"/>
    <action itemid="13307" script="other/taming.lua"/>
    <action itemid="13508" script="other/taming.lua"/>
    <action itemid="13535" script="other/taming.lua"/>
    <action itemid="13536" script="other/taming.lua"/>
    <action itemid="13537" script="other/taming.lua"/>
    <action itemid="13538" script="other/taming.lua"/>
    <action itemid="13539" script="other/taming.lua"/>
    <action itemid="13938" script="other/taming.lua"/>
    <action itemid="13939" script="other/taming.lua"/>
    <action itemid="13498" script="other/taming.lua"/>
    <action itemid="15545" script="other/taming.lua"/>
    <action itemid="15546" script="other/taming.lua"/>
    <action itemid="20138" script="other/taming.lua"/>
    <action itemid="21452" script="other/taming.lua"/>
    <action itemid="22608" script="other/taming.lua"/>
    <action itemid="18449" script="other/taming.lua"/>
    <action itemid="18447" script="other/taming.lua"/>
    <action itemid="18448" script="other/taming.lua"/>
    <action itemid="18516" script="other/taming.lua"/>
    <action itemid="23550" script="other/taming.lua"/>
    <action itemid="23880" script="other/taming.lua"/>
    <action itemid="18511" script="other/taming.lua"/>

when i try to use .. slingshot to tame a bear it says "you cannot use this item" but only when i click on the bear.. i can use the slingshot .. the but when trying to tame the bear i receive the message..

After that i found the musicbox.lua and tried to use..

PHP:
local config = {
    ['Dragonling'] = {mountId = 31, tameMessage = 'The wild dragonling will accompany you as a friend from now on.', sound = 'FI?'},
    ['Draptor'] = {mountId = 6, tameMessage = 'You have tamed the wild draptor.', sound = 'Screeeeeeeeech'},
    ['Enraged White Deer'] = {mountId = 18, mountName = 'kingly deer', tameMessage = 'You have tamed the deer.', sound = '*bell*'},
    ['Ironblight'] = {mountId = 29, tameMessage = 'You tamed the ironblight.', sound = 'Plinngggg'},
    ['Magma Crawler'] = {mountId = 30, tameMessage = 'The magma crawler will accompany you as a friend from now on.', sound = 'ZzzZzzZzzzZz'},
    ['Midnight Panther'] = {mountId = 5, tameMessage = 'You have tamed the wild panther.', sound = 'Purrrrrrr'},
    ['Wailing Widow'] = {mountId = 1, mountName = 'widow queen', tameMessage = 'You have tamed the wailing widow.', sound = 'Sssssssss'},
    ['Wild Horse'] = {mountId = 17, mountName = 'war horse', tameMessage = 'The horse eats the sugar oat and accepts you as its new master.', sound = '*snort*'},
    ['Panda'] = {mountId = 19, tameMessage = 'You have tamed the panda.', sound = 'Rrrrr...'}
    ['Bear'] = {mountId = 3, mountName = 'war bear', tameMessage = 'You have tamed the War Bear.', sound = 'Rrrrr...'}

}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local targetMonster = Monster(itemEx.uid)
    if not targetMonster or targetMonster:getMaster() then
        return false
    end

    local targetName = targetMonster:getName():lower()
    local monsterConfig = config[targetName]
    if not monsterConfig then
        return true
    end

    local player = Player(cid)
    if player:hasMount(monsterConfig.mountId) then
        player:say('You already tamed a ' .. (monsterConfig.mountName or targetName) .. '.', TALKTYPE_MONSTER_SAY)
        return true
    end

    player:addAchievement('Natural Born Cowboy')
    player:addMount(monsterConfig.mountId)
    player:say(monsterConfig.tameMessage, TALKTYPE_MONSTER_SAY)
    toPosition:sendMagicEffect(CONST_ME_SOUND_RED)

    targetMonster:say(monsterConfig.sound, TALKTYPE_MONSTER_SAY)
    targetMonster:remove()

    Item(item.uid):remove()
    return true
end
i just added the bear to test and this time i receive no errors, but cant tame.. im able to use the music box, to click on the bear but nothing happens.. i tried to with enraged white deer and panda but nothing..

Any clue about?
 
Solution
In TFS 1.2 params are useradata.

I don't tested it.

Code:
local config = {
  ['dragonling'] = {mountId = 31, tameMessage = 'The wild dragonling will accompany you as a friend from now on.', sound = 'FI?'},
  ['draptor'] = {mountId = 6, tameMessage = 'You have tamed the wild draptor.', sound = 'Screeeeeeeeech'},
  ['enraged white deer'] = {mountId = 18, mountName = 'kingly deer', tameMessage = 'You have tamed the deer.', sound = '*bell*'},
  ['ironblight'] = {mountId = 29, tameMessage = 'You tamed the ironblight.', sound = 'Plinngggg'},
  ['magma crawler'] = {mountId = 30, tameMessage = 'The magma crawler will accompany you as a friend from now on.', sound = 'ZzzZzzZzzzZz'},
  ['midnight panther'] = {mountId = 5, tameMessage = 'You have...
Code:
local targetName = targetMonster:getName():lower()
local monsterConfig = config[targetName]

In LUA string "Dragonling" and "dragonling" are not same, same as index with this name.

So you can fix script in two ways:
1. Change each monster name too lowercase in local config [RECOMENDED]
2. Remove :lower() from line
Code:
local targetName = targetMonster:getName():lower()
 
In TFS 1.2 params are useradata.

I don't tested it.

Code:
local config = {
  ['dragonling'] = {mountId = 31, tameMessage = 'The wild dragonling will accompany you as a friend from now on.', sound = 'FI?'},
  ['draptor'] = {mountId = 6, tameMessage = 'You have tamed the wild draptor.', sound = 'Screeeeeeeeech'},
  ['enraged white deer'] = {mountId = 18, mountName = 'kingly deer', tameMessage = 'You have tamed the deer.', sound = '*bell*'},
  ['ironblight'] = {mountId = 29, tameMessage = 'You tamed the ironblight.', sound = 'Plinngggg'},
  ['magma crawler'] = {mountId = 30, tameMessage = 'The magma crawler will accompany you as a friend from now on.', sound = 'ZzzZzzZzzzZz'},
  ['midnight panther'] = {mountId = 5, tameMessage = 'You have tamed the wild panther.', sound = 'Purrrrrrr'},
  ['wailing widow'] = {mountId = 1, mountName = 'widow queen', tameMessage = 'You have tamed the wailing widow.', sound = 'Sssssssss'},
  ['wild horse'] = {mountId = 17, mountName = 'war horse', tameMessage = 'The horse eats the sugar oat and accepts you as its new master.', sound = '*snort*'},
  ['panda'] = {mountId = 19, tameMessage = 'You have tamed the panda.', sound = 'Rrrrr...'}
  ['bear'] = {mountId = 3, mountName = 'war bear', tameMessage = 'You have tamed the War Bear.', sound = 'Rrrrr...'}

}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
  if not target:isCreature() or not target:isMonster() or target:getMaster() then
    return false
  end

  local targetName = target:getName()
  targetName = targetName:lower()

  local monsterConfig = config[targetName]
  if not monsterConfig then
    return true
  end

  if player:hasMount(monsterConfig.mountId) then
    player:say('You already tamed a ' .. (monsterConfig.mountName or targetName) .. '.', TALKTYPE_MONSTER_SAY)
    return true
  end

  player:addAchievement('Natural Born Cowboy')
  player:addMount(monsterConfig.mountId)
  player:say(monsterConfig.tameMessage, TALKTYPE_MONSTER_SAY)
  toPosition:sendMagicEffect(CONST_ME_SOUND_RED)

  target:say(monsterConfig.sound, TALKTYPE_MONSTER_SAY)
  target:remove()

  item:remove()
  return true
end
 
Solution
Back
Top