• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action [8.7] Taming monsters (mount system)

ruda

Member
Joined
Jul 4, 2008
Messages
164
Reaction score
15
Location
Brazil
Tested only in TFS 0.2.9.
Scripted by me

This is like real Tibia, but not 100% (I guess in tibia global the chances increase according to the health of the monster. I'll provide it)

How it works?
Use an item in the monster and you have chances to: tame the monster, have your item broke or the monster runs away (disappear)

mounts.lua
Code:
--taming monsters by ruda from otland
local function tameMonster(cid, item, itemEx, tame, run, broken)
	n = math.random(100)
	if n <= broken then
		doCreatureSay(cid, "Lost item", TALKTYPE_ORANGE_1)
		doRemoveItem(item.uid)
	elseif n > broken and n <= (tame+broken) then
		doRemoveItem(item.uid)
		doCreatureSay(cid, "You tamed", TALKTYPE_ORANGE_1)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You tamed "..getCreatureName(itemEx.uid)..".")
		return true
	elseif n > (tame+broken) and n <= (tame+broken+run) then
		doCreatureSay(cid, "Fled", TALKTYPE_ORANGE_1)
		doRemoveCreature(itemEx.uid)
	else
		doCreatureSay(cid, "Try again", TALKTYPE_ORANGE_1)
	end
	return false
end

local function inArray(table, value)
	for i,v in pairs(table) do
		if (v.name == string.lower(value)) then
			return i
		end
	end
	return 0
end

local mounts = {
	{item = 13322, name = "wailing widow", id = 1, 			tame=10, run=39, broken=51},
	{item = 13313, name = "terror bird", id = 2, 			tame=10, run=39, broken=51},
	{item = 5907, name = "bear", id = 3, 				tame=7, run=39, broken=54},
	{item = 13310, name = "black sheep", id = 4,		 	tame=7, run=35, broken=58},
	{item = 13308, name = "midnight panther", id = 5, 		tame=10, run=39, broken=51},
	{item = 13309, name = "draptor", id = 6, 				tame=10, run=39, broken=51},
	{item = 13320, name = "crustacea gigantica", id = 7, 	tame=10, run=39, broken=51},
	{item = 13262, name = "boar", id = 10, 					tame=10, run=39, broken=51},
	{item = 13306, name = "undead cavebear", id = 12, 		tame=10, run=39, broken=51}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isCreature(itemEx.uid) then
		if inArray(mounts, getCreatureName(itemEx.uid)) > 0 then
			i = inArray(mounts, getCreatureName(itemEx.uid))
			if item.itemid == mounts[i].item and not getPlayerMount(cid, mounts[i].id) then
				if tameMonster(cid, item, itemEx, mounts[i].tame, mounts[i].run, mounts[i].broken) then
					doSendMagicEffect(fromPosition, CONST_ME_MAGIC_BLUE)
					doRemoveCreature(itemEx.uid)
					doPlayerAddMount(cid, mounts[i].id)
				else
					doSendMagicEffect(toPosition, CONST_ME_POFF)
				end
			end
		end
	end
	return true
end

actions.xml
Code:
<action itemid="13310" script="mounts.lua"/> --reins
	<action itemid="13309" script="mounts.lua"/> --harness
	<action itemid="13308" script="mounts.lua"/> --leather whip
	<action itemid="13313" script="mounts.lua"/> --carrot on a stick
	<action itemid="13262" script="mounts.lua"/> --hunting horn
	<action itemid="13320" script="mounts.lua"/> --Giant Shrimp
	<action itemid="13306" script="mounts.lua"/> --Maxilla Maximus
	<action itemid="5907" script="mounts.lua"/> --Slingshot
	<action itemid="13322" script="mounts.lua"/> --Sweet Smelling Bait

You can configure it (var mounts):
item = itemID needed to tame the monster (if you change it, change actions.xml too)
name = name of the monster (NOT THE MOUNT NAME)
id = mount id (in XML/mounts.xml)
tame = chance to tame the monster
run = chance of monster run
broken = chance of item loss

ps: tame + run + broken = must be 100

There are 3 mounts missing: Blazebringer, Stampor and Tin Lizzard (the way to obtain them is different in real Tibia), but you can add them to the script if you want.

if you like it, rep++ =)
 
If you dont have the items in items.xml, here is it:

Code:
	<item id="13306" name="maxilla maximus" article="a">
		<attribute key="description" value="A hermit near Carlin might be able to tell you more about it." />
		<attribute key="weight" value="200" />
	</item>
	<item id="13307" name="tin key" article="a">
		<attribute key="description" value="A hermit near Carlin might be able to tell you more about it." />
		<attribute key="weight" value="200" />
	</item>
	<item id="13308" name="leather whip" article="a">
		<attribute key="description" value="A hermit near Carlin might be able to tell you more about it." />
		<attribute key="weight" value="200" />
	</item>
	<item id="13309" name="harness" article="a">
		<attribute key="description" value="A hermit near Carlin might be able to tell you more about it." />
		<attribute key="weight" value="200" />
	</item>
	<item id="13310" name="reins" article="a">
		<attribute key="description" value="A hermit near Carlin might be able to tell you more about it." />
		<attribute key="weight" value="200" />
	</item>
	<item id="13313" name="carrot on a stick" article="a">
		<attribute key="description" value="A hermit near Carlin might be able to tell you more about it." />
		<attribute key="weight" value="200" />
	</item>
	<item id="13320" name="giant shrimp" article="a">
		<attribute key="description" value="A hermit near Carlin might be able to tell you more about it." />
		<attribute key="weight" value="200" />
	</item>
	<item id="13322" name="sweet smelling bait" article="a">
		<attribute key="description" value="A hermit near Carlin might be able to tell you more about it." />
		<attribute key="weight" value="200" />
	</item>
	<item id="13262" name="hunting horn" article="a">
		<attribute key="description" value="A hermit near Carlin might be able to tell you more about it." />
		<attribute key="weight" value="200" />
	</item>
 
Hey ruda is there a way I can find the items in my list, only one that I found was the slingshot that isn't a corpse but the script works perfect tamed a bear
 
i use ots 8.70 and have other id of items why u give other from me mounts added in 8.70..
 
well, I tested at TFS 0.2.9 and worked fine...

what distro are you using guys?
 
<item id="13291" name="maxilla maximus" article="a">
<attribute key="description" value="A hermit near Carlin might be able to tell you more about it." />
<attribute key="weight" value="200" />
</item>
<item id="13292" name="tin key" article="a">
<attribute key="description" value="A hermit near Carlin might be able to tell you more about it." />
<attribute key="weight" value="200" />
</item>
<item id="13293" name="leather whip" article="a">
<attribute key="description" value="A hermit near Carlin might be able to tell you more about it." />
<attribute key="weight" value="200" />
</item>
<item id="13294" name="harness" article="a">
<attribute key="description" value="A hermit near Carlin might be able to tell you more about it." />
<attribute key="weight" value="200" />
</item>
<item id="13295" name="reins" article="a">
<attribute key="description" value="A hermit near Carlin might be able to tell you more about it." />
<attribute key="weight" value="200" />
</item>
<item id="13298" name="carrot on a stick" article="a">
<attribute key="description" value="A hermit near Carlin might be able to tell you more about it." />
<attribute key="weight" value="200" />
</item>
<item id="13305" name="giant shrimp" article="a">
<attribute key="description" value="A hermit near Carlin might be able to tell you more about it." />
<attribute key="weight" value="200" />
</item>
<item id="13307" name="sweet smelling bait" article="a">
<attribute key="description" value="A hermit near Carlin might be able to tell you more about it." />
<attribute key="weight" value="200" />
</item>
<item id="13262" name="hunting horn" article="a">
<attribute key="description" value="A hermit near Carlin might be able to tell you more about it." />
<attribute key="weight" value="200" />
</item>
the hunting horn i dont know the id
 
Hunting Horn:

<item id="13247" name="hunting horn" article="a">
<attribute key="description" value="A hermit near Carlin might be able to tell you more about it." />
<attribute key="weight" value="200" />
</item>
 
<<<Paste&Copy
Code:
<item id="13291" name="maxilla maximus" article="a">
<attribute key="description" value="A hermit near Carlin might be able to tell you more about it." />
<attribute key="weight" value="200" />
</item>
<item id="13292" name="tin key" article="a">
<attribute key="description" value="A hermit near Carlin might be able to tell you more about it." />
<attribute key="weight" value="200" />
</item>
<item id="13293" name="leather whip" article="a">
<attribute key="description" value="A hermit near Carlin might be able to tell you more about it." />
<attribute key="weight" value="200" />
</item>
<item id="13294" name="harness" article="a">
<attribute key="description" value="A hermit near Carlin might be able to tell you more about it." />
<attribute key="weight" value="200" />
</item>
<item id="13295" name="reins" article="a">
<attribute key="description" value="A hermit near Carlin might be able to tell you more about it." />
<attribute key="weight" value="200" />
</item>
<item id="13298" name="carrot on a stick" article="a">
<attribute key="description" value="A hermit near Carlin might be able to tell you more about it." />
<attribute key="weight" value="200" />
</item>
<item id="13305" name="giant shrimp" article="a">
<attribute key="description" value="A hermit near Carlin might be able to tell you more about it." />
<attribute key="weight" value="200" />
</item>
<item id="13307" name="sweet smelling bait" article="a">
<attribute key="description" value="A hermit near Carlin might be able to tell you more about it." />
<attribute key="weight" value="200" />
</item>
<item id="13262" name="hunting horn" article="a">
<attribute key="description" value="A hermit near Carlin might be able to tell you more about it." />
<attribute key="weight" value="200" />
</item>
 
man this ids no worked in my tfs :s i dont know what's my TFS.
But u no have others ids for me teste ?
 
Back
Top