• 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] How to get mounts in theforgottenserver-v0.2.15

Blackbuster

Member
Joined
Aug 26, 2007
Messages
76
Reaction score
16
For the Noobs like me , who can't get mounts done in theforgottenserver-v0.2.15 mystic spirit for tibia 9.86. [distro doesn't come up with these codes]

first of all open your actions.xml
add this:
Code:
<action itemid="[itemid]" script="other/mountname.lua"/>

Then create a new lua , using notepad like me.
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == [itemid] then
		doPlayerAddMount(cid, [mountid])
	else
		doSendMagicEffect(fromPosition, CONST_ME_SOUND_YELLOW)  <<---- could be any effect doesn't realy matther-->>
	end
	return TRUE
end

To find the mount id open you XML map and open mounts.xml
Code:
	<mount id="1" clientid="368" name="Widow Queen" speed="20" premium="no" />
Your mount id is 1.

This is the basic , a player that uses the item wil recieve the mount.
If you want to add a magic effect by using or disapearing of the item you have to add that to the lua script.

hope i can help someone out. couldn't find a working script on OTland.

Blackbuster
 
Thank you! This only mount script i've found that even works on my server!
only thing i dont like about it is it dosen't tell you if you've tamed it, theres no chance for the item to break. Also it dosent take the item from the player after using it to tame the mount. Nice besides that!
 
I made that for you.

Code:
local mounts = {
mount1 = {name = "Lion", id = 1},
mount2 = {name = "Horse", id = 1}
}

local chancebreak = true --if false item will break each time its used
local breakcheck = math.random(1, 1000)
local chance1 = 500 --50% chance to break

local ccheck = math.random(1, 1000)
local chance2 = 250 --25% chance to tame

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.itemid == [itemid] then
        if isMonster(itemEx) then
            if getCreatureInfo(itemEx).name == mounts.mount1.name then --first mount
                local mountadd = mounts.mount1.id
                if ccheck < chance2 then
                    doPlayerAddMount(cid, mountadd)
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_GREEN, "You have tamed the mount.")
                    doRemoveCreature(itemEx)
                    if chancebreak == false then
                        doPlayerRemoveItem(cid, itemid, 1)
                        doPlayerSendMagicEffect(toPosition, CONST_ME_POFF)
                    end
                else
                    if chancebreak == true then
                        if breakcheck > chance1 then
                            doPlayerRemoveItem(cid, itemid, 1)
                            doPlayerSendMagicEffect(toPosition, CONST_ME_POFF)
                        end
                    else
                        doPlayerRemoveItem(cid, itemid, 1)
                        doPlayerSendMagicEffect(toPosition, CONST_ME_POFF)
                    end
                end
            elseif getCreatureInfo(itemEx).name == mounts.mount2.name then -- second mount
                local mountadd = mounts.mount2.id
                if ccheck < chance2 then
                    doPlayerAddMount(cid, mountadd)
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_GREEN, "You have tamed the mount.")
                    doRemoveCreature(itemEx)
                    if chancebreak == false then
                        doPlayerRemoveItem(cid, itemid, 1)
                        doPlayerSendMagicEffect(toPosition, CONST_ME_POFF)
                    end
                else
                    if chancebreak == true then
                        if breakcheck > chance1 then
                            doPlayerRemoveItem(cid, itemid, 1)
                            doPlayerSendMagicEffect(toPosition, CONST_ME_POFF)
                        end
                    else
                        doPlayerRemoveItem(cid, itemid, 1)
                        doPlayerSendMagicEffect(toPosition, CONST_ME_POFF)
                    end
                end
                -- elseif   add new mounts here
            else
                doPlayerSendCancel(cid, "This creature cannot be tamed.")
            return false
            end
        else
            doPlayerSendCancel(cid, "You must use this on a creature.")
        return false
        end
    end
    return true
end
 
Last edited:
Back
Top