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

[The_Hide] Taming Mounts (Like rl tibia)

The_Hide

Banned User
Joined
Dec 11, 2012
Messages
389
Reaction score
10
it's action script.

Lua:
local config = {
	-- onw  or  regular, if 'own' then script will check chance from taming_tbl, if 'regular' then script will check chance from regular_mount_tbl
	OwnChanceOrRegular = "own", -- "own" lub "regular"   <- own to czyta z tablicy taming_tbl szanse, a regular to czyta z regular_mount_tbl badz tbl_szans_gdy_nil gdy w tablicy tamingu nie ma regular mount chance
	ALLOW_SUMMON_TO_ALL_MOUNTS = false,
	BLOCK_ALLOW_SUMMON_TO_ALL_MONSTER = false,
	EFFECT_WHEN_MOUNT_RUN = 1, -- poprawic efekt
	EFFECT_WHEN_ITEM_BROKE = CONST_ME_BLOCKHIT, 
	EFFECT_WHEN_MOUNT_ATTACK = 2, -- poprawic efekt
	EFFECT_WHEN_MOUNT_CATCH = CONST_ME_POFF, 
	IF_MOUNT_IS_ITEM_REMOVE_ITEM_IF_RUN = false,
	IF_MOUNT_IS_ITEM_REMOVE_ITEM_IF_CATCH = false,
	IF_MOUNT_IS_CREATURE_REMOVE_CREATURE_IF_RUN = true,
	IF_MOUNT_IS_CREATURE_REMOVE_CREATURE_IF_CATCH = true,
	IF_MOUNT_IS_NPC_REMOVE_CREATURE_IF_RUN = false,
	IF_MOUNT_IS_NPC_REMOVE_CREATURE_IF_CATCH = false,
	IF_MOUNT_IS_OUTFIT_REMOVE_CREATURE_IF_RUN = true,
	IF_MOUNT_IS_OUTFIT_REMOVE_CREATURE_IF_CATCH = true,
	
	IF_MOUNT_IS_OUTFIT_ALLOW_TO_CREATURE_CAN_BE_PLAYER = false,
	
	}
local regular_mount_tbl = {
	["regular"] = {succes = 10, broke = 5, run = 50, attack = 35}, --regularne z polskiej wikii // regular chance for mount (from polish wiki)
	["other"] = {succes = 10, broke = 5, run = 30, attack = 55}, -- nieregularne z polskiej wikii //nonregular chance for mount (from polish wiki)
	}
local tbl_szans_gdy_nil = {
	succes = 10,
	broke = 5, 
	run = 50, 
	attack = 35,
	}
local taming_tbl = {
	[5907] = {MOUNT_NAME = "War Bear", MOUNT_ID = 3, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "MONSTER", TYPE_ID = "bear", ALLOW_SUMMON = false,
	CHANCE = {succes = 15, broke = 10, run = 40, attack = 35},
	TEXT = {succes = "You tamed the wild bear.", broke = "Oh no! The slingshot broke.", run = "The bear ran away.", attack = "The bear is trying to hit you with its claws."}
		},
	[13295] = {MOUNT_NAME = "Black Sheep", MOUNT_ID = 4, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "MONSTER", TYPE_ID = "black sheep", ALLOW_SUMMON = false,
	CHANCE = {succes = 25, broke = 5, run = 30, attack = 40},
	TEXT = {succes = "You tamed the black sheep.", broke = "Oh no! The reins were torn.", run = "The black sheep ran away.", attack = "The black sheep is trying to run away."},
		},
	[13293] = {MOUNT_NAME = "Midnight Panther", MOUNT_ID = 5, REGULAR_MOUNT_CHANCE = "other",
	TYPE = "MONSTER", TYPE_ID = "midnight panthe", ALLOW_SUMMON = false,
	CHANCE = {succes = 15, broke = 5, run = 30, attack = 50},
	TEXT = {succes = "You tamed the wild panther.", broke = "The whip broke. ?", run = "The midnight panther ran away.", attack = "The midnight panther is growling at you."},
		},
	[13298] = {MOUNT_NAME = "Racing Bird", MOUNT_ID = 2, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "MONSTER", TYPE_ID = "terror bird", ALLOW_SUMMON = false,
	CHANCE = {succes = 15, broke = 5, run = 35, attack = 45},
	TEXT = {succes = "You tamed the bird.", broke = "Oh no, the bird ate the carrot.", run = "The bird ran away.", attack = "The terror bird is pecking you."},
		},
	[13247] = {MOUNT_NAME = "Rapid Boar", MOUNT_ID = 10, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "MONSTER", TYPE_ID = "boar", ALLOW_SUMMON = false,
	CHANCE = {succes = 15, broke = 5, run = 35, attack = 45},
	TEXT = {succes = "You tamed the wild boar", broke = "The horn broke. ?", run = "The boar ran away.", attack = "The boar is refusing to obey the hunting horn."},
		},
	[13305] = {MOUNT_NAME = "Titanica", MOUNT_ID = 7, REGULAR_MOUNT_CHANCE = "other",
	TYPE = "MONSTER", TYPE_ID = "crustacea gigantica", ALLOW_SUMMON = false,
	CHANCE = {succes = 20, broke = 5, run = 30, attack = 45},
	TEXT = {succes = "You tamed the gigantic creature.", broke = "Gigantica ate shrimp. ?", run = "The gigantic creature ran away.", attack = "The gigantic creature is trying to pinch you."},
		},
	[13291] = {MOUNT_NAME = "Undead Cavebear", MOUNT_ID = 12, REGULAR_MOUNT_CHANCE = "other",
	TYPE = "MONSTER", TYPE_ID = "undead cavebear", ALLOW_SUMMON = false,
	CHANCE = {succes = 20, broke = 5, run = 25, attack = 50},
	TEXT = {succes = "You tamed the undead cavebear.", broke = "Maxilla broke. ?", run = "The undead cavebear ran away.", attack = "The undead cavebear is growling at you."},
		},
	[13307] = {MOUNT_NAME = "Widow Queen", MOUNT_ID = 1, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "MONSTER", TYPE_ID = "wailing widow", ALLOW_SUMMON = false,
	CHANCE = {succes = 15, broke = 5, run = 55, attack = 25},
	TEXT = {succes = "You have tamed the widow.", broke = "The widow has eaten the sweet bait.", run = "The widow ran away.?", attack = "The widow tryed to hit you.?"},
		},
	[13292] = {MOUNT_NAME = "Tin Lizzard", MOUNT_ID = 8, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "NPC", TYPE_ID = "tin lizzard", ALLOW_SUMMON = false,
	CHANCE = {succes = 50, broke = 10, run = 15, attack = 25},
	TEXT = {succes = "You wind up the tin lizzard", msg_creature_speak = "Krkrkrkrk", broke = "The key broke inside.?", run = "Try again.?", attack = "Try again.?"},
		},
	[13294] = {MOUNT_NAME = "Draptor", MOUNT_ID = 6, REGULAR_MOUNT_CHANCE = "other",
	TYPE = "MONSTER", TYPE_ID = "draptor", ALLOW_SUMMON = false,
	CHANCE = {succes = 20, broke = 5, run = 20, attack = 55},
	TEXT = {succes = "You tamed the wild draptor.", msg_creature_speak = "Screeeeeeeeech", broke = "Harness broke.?", run = "The draptor has fled.?", attack = "The wild draptor is struggling."},
		},
	[13536] = {MOUNT_NAME = "Crystal Wolf", MOUNT_ID = 16, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "MONSTER", TYPE_ID = "crystal wolf", ALLOW_SUMMON = false,
	CHANCE = {succes = 30, broke = 5, run = 30, attack = 35},
	TEXT = {succes = "The smooth sound of the diapason tamed the crystal wolf.", 
	broke = "Clashing on the hard crystalline surface of the wolf, the fragile diapason breaks.", 
	run = "The crystal wolf vanished into thin air.", attack = "The Crystal wolf is startled by the wrong sound of the diapason.",
	msg_creature_speak_succes = "*kliiiiiiiiiiing* Aooooouuuuu!!",
	msg_creature_speak_run = "*zwiiiish*",
	msg_creature_speak_attack = "*klaaaaaang* Rrrrooooaaaarrrgh!"},
		},
	[13539] = {MOUNT_NAME = "Kingly Deer", MOUNT_ID = 18, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "MONSTER", TYPE_ID = "white deer", ALLOW_SUMMON = false,
	CHANCE = {succes = 10, broke = 5, run = 50, attack = 35},
	TEXT = {succes = "You tamed the white deer.", broke = "Oh no... the enraged deer angrily ripped the fir cone from your hands!", run = "The white deer flees.", attack = "The white deer sniffs and wheezes, trying to withstand the taming.",
	msg_creature_speak_succes = "*bell*",
	msg_creature_speak_run = "*sniff*",
	msg_creature_speak_attack = "*wheeze*"},
		},
	[13538] = {MOUNT_NAME = "Tamed Panda", MOUNT_ID = 19, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "MONSTER", TYPE_ID = "panda", ALLOW_SUMMON = false,
	CHANCE = {succes = 15, broke = 10, run = 40, attack = 35},
	TEXT = {succes = "You tamed the panda.", broke = "While you were trying to soothe the panda, it ate all the remaining bamboo behind your back. ", 
	run = "The panda flees.", attack = "The panda refuses to follow any of your orders. "},
		},	
	[13535] = {MOUNT_NAME = "Dromedary", MOUNT_ID = 20, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "MONSTER", TYPE_ID = "dromedary", ALLOW_SUMMON = false,
	CHANCE = {succes = 15, broke = 10, run = 40, attack = 35},
	TEXT = {succes = "", broke = "", run = "", attack = ""},
		},
	[13498] = {MOUNT_NAME = "King Scorpion", MOUNT_ID = 21, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "MONSTER", TYPE_ID = "sandstone scorpion", ALLOW_SUMMON = false,
	CHANCE = {succes = 25, broke = 5, run = 40, attack = 30},
	TEXT = {succes = "You tamed the sandstone scorpion.", broke = "The sandstone scorpion eludes the influence of the scepter.", 
	run = "The sandstone scorpion flees.", attack = "attack xD"},
		},
	[13537] = {MOUNT_NAME = "Donkey", MOUNT_ID = 13, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "OUTFIT", TYPE_ID = 399, ALLOW_SUMMON = true,
	CHANCE = {succes = 10, broke = 30, run = 60, attack = 0},
	TEXT = {succes = "Munching a large pile of apple slices tamed the donkey.", broke = "You did not manage to feed the donkey enough apple slices.", run = "The donkey transformation suddenly wears off.", attack = "Donkey attack! xD?"},
		},
	[13938] = {MOUNT_NAME = "Uniwheel", MOUNT_ID = 15, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "NPC", TYPE_ID = "uniwheel", ALLOW_SUMMON = false,
	CHANCE = {succes = 40, broke = 60, run = 0, attack = 0},
	TEXT = {succes = "The strange wheel seems to vibrate and slowly starts turning continuously.",
	broke = "It looks like most of the special oil this can was holding was spilt without any effect.", run = "UCIEK KURWA", attack = "ZAJEBAL CI KIEROWNICA",
	msg_creature_speak_succes = "Vroooomratatatatatatat.",
	msg_creature_speak_broke = "Splosh!"},
		},
	[13508] = {MOUNT_NAME = "Tiger Slug", MOUNT_ID = 14, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "MONSTER", TYPE_ID = "slug", ALLOW_SUMMON = false,
	CHANCE = {succes = 10, broke = 25, run = 40, attack = 25},
	TEXT = {succes = "You drugged the slug.", broke = "This slug drug didn't seem to have any effect.", run = "The slug flees.", attack = "The slug slips trough your grasp.",
	msg_creature_speak_succes = "Sluuuuurp!",
	msg_creature_speak_run = "Slurp!",
	msg_creature_speak_attack = "*shlorp*"},
		},
	[13939] = {MOUNT_NAME = "War Horse", MOUNT_ID = 23, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "MONSTER", TYPE_ID = "wild horse", ALLOW_SUMMON = false,
	CHANCE = {succes = 10, broke = 10, run = 50, attack = 30},
	TEXT = {succes = "The horse eats the sugar oat and accepts you as its new master.", broke = "The wild horse happily munches the sugar oat and runs on.",
	run = "With its last strength the horse the horse runs to safety.", attack = "Weeeheeeehee."},
		},
	[15545] = {MOUNT_NAME = "Manta", MOUNT_ID = 28, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "MONSTER", TYPE_ID = "manta ray", ALLOW_SUMMON = false,
	CHANCE = {succes = 10, broke = 5, run = 50, attack = 35},
	TEXT = {succes = "zlapales mante", broke = "zjadla", run = "uciekla", attack = "zaatakowala"},
		},
	[15546] = {MOUNT_NAME = "Ladybug", MOUNT_ID = 27, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "MONSTER", TYPE_ID = "ladybug", ALLOW_SUMMON = false,
	CHANCE = {succes = 20, broke = 1, run = 40, attack = 39},
	TEXT = {succes = "You tamed a ladybug", broke = "You broke it.?", run = "The ladybug got scared and ran away.", attack = "The ladybug is trying to nibble."},
		},
	--[[
	[itemid rzeczy] = {MOUNT_NAME = "", MOUNT_ID = , REGULAR_MOUNT_CHANCE = ,
	TYPE = , TYPE_ID = , ALLOW_SUMMON = ,
	CHANCE = {succes = , broke = , run = , attack = },
	TEXT = {succes = , broke = , run = , attack = },
		},
		]]--
	}

function onUse(cid, item, fromPosition, itemEx, toPosition)
local v = taming_tbl[item.itemid]	

local szansa_sukces = 0
local szansa_broke = 0
local szansa_run = 0
local szansa_attack = 0

if v then
	--- tutaj dac sprawdzanie exhausteda
	
	
	-- koniec sprawdzania exhaausteda 
	-- sprawdzanie czy gracz ma mounta, jesli ma juz go to wysle mu wiadomosc, ze go ma i zakonczy dzialanie skryptu
	if getPlayerMount(cid, v.MOUNT_ID) then
		return doPlayerSendCancel(cid, "You allready have this mount!")
	end
	-- sprawdzanie czy w tablicy mountsow, danego mounta mozna summonowac, lub czy w configu jest, ze mounty moga byc summonami oraz sprawdzenie czy nie ma blokady na summony do wszystkich mountow
	if ((not(v.ALLOW_SUMMON)) and (not(config.ALLOW_SUMMON_TO_ALL_MOUNTS))) or (config.BLOCK_ALLOW_SUMMON_TO_ALL_MONSTER) then
		if isSummon(itemEx.uid) then
			return doPlayerSendCancel(cid, "This mount can't be summon to catch him!")
		end
	end
	-- sprawdzanie czy itemu uzywamy na dobrym stworku/outfitcie itd.
	if v.TYPE == "MONSTER" then
		if not(isMonster(itemEx.uid)) then
			return doPlayerSendCancel(cid, "This item you can only use on monsters.")
		end
		if v.TYPE_ID ~= (getCreatureName(itemEx.uid):lower()) then
			return doPlayerSendCancel(cid, "By this item you cannot tame this monster.")
		end
	elseif v.TYPE == "NPC" then
		if not(isNpc(itemEx.uid)) then
			return doPlayerSendCancel(cid, "This item you can only use on NPCs.")
		end
		if v.TYPE_ID ~= (getCreatureName(itemEx.uid):lower()) then
			return doPlayerSendCancel(cid, "By this item you cannot tame this NPC.")
		end
	elseif v.TYPE == "ITEM" then
		if not(itemEx.itemid ~= nil) then
			return doPlayerSendCancel(cid, "This item you can only use on items.")
		end
		if v.TYPE_ID ~= itemEx.itemid then
			return doPlayerSendCancel(cid, "By this item you cannot tame this item.")
		end
	elseif v.TYPE == "OUTFIT" then
		if not(isCreature(itemEx.uid)) then
			return doPlayerSendCancel(cid, "You can only use it on creatures.")
		end
		if (isPlayer(itemEx.uid) and (not(config.IF_MOUNT_IS_OUTFIT_ALLOW_TO_CREATURE_CAN_BE_PLAYER))) then
			return doPlayerSendCancel(cid, "You cannot use this item on players.")
		end
		if v.TYPE_ID ~= (getCreatureOutfit(itemEx.uid).lookType) then
			return doPlayerSendCancel(cid, "By this item you cannot tame creature with this outfit.")
		end
	end
	
	--
	
	
	if (v.CHANCE.succes ~= nil) and (config.OwnChanceOrRegular ~= "own") then
		szansa_sukces = v.CHANCE.succes
	else
		if v.REGULAR_MOUNT_CHANCE ~= nil then
			szansa_sukces = regular_mount_tbl[v.REGULAR_MOUNT_CHANCE].succes
		else
			szansa_sukces = tbl_szans_gdy_nil.succes
		end
	end
	if v.CHANCE.broke ~= nil and (config.OwnChanceOrRegular ~= "own") then
		szansa_broke = v.CHANCE.broke
	else
		if v.REGULAR_MOUNT_CHANCE ~= nil then
			szansa_broke = regular_mount_tbl[v.REGULAR_MOUNT_CHANCE].broke
		else
			szansa_broke = tbl_szans_gdy_nil.broke
		end
	end
	if v.CHANCE.run ~= nil and (config.OwnChanceOrRegular ~= "own") then
		szansa_run = v.CHANCE.run
	else
		if v.REGULAR_MOUNT_CHANCE ~= nil then
			szansa_run = regular_mount_tbl[v.REGULAR_MOUNT_CHANCE].run
		else
			szansa_run = tbl_szans_gdy_nil.run
		end
	end
	if v.CHANCE.attack ~= nil and (config.OwnChanceOrRegular ~= "own") then
		szansa_attack = v.CHANCE.attack
	else
		if v.REGULAR_MOUNT_CHANCE ~= nil then
			szansa_attack = regular_mount_tbl[v.REGULAR_MOUNT_CHANCE].attack
		else
			szansa_attack = tbl_szans_gdy_nil.attack
		end
	end
	
	
	
	losowanie = math.random(1,100)
	if losowanie <= szansa_sukces then
		if (v.TYPE == "MONSTER") and (config.IF_MOUNT_IS_CREATURE_REMOVE_CREATURE_IF_RUN) then
			doRemoveCreature(itemEx.uid)
		elseif (v.TYPE == "NPC") and (config.IF_MOUNT_IS_NPC_REMOVE_CREATURE_IF_RUN) then
			doRemoveCreature(itemEx.uid)
		elseif (v.TYPE == "ITEM") and (config.IF_MOUNT_IS_ITEM_REMOVE_ITEM_IF_RUN) then
			doRemoveItem(itemEx.uid, 1)
		elseif (v.TYPE == "OUTFIT") and (config.IF_MOUNT_IS_OUTFIT_REMOVE_CREATURE_IF_RUN) then
			doRemoveCreature(itemEx.uid)
		end
		doPlayerAddMount(cid, v.MOUNT_ID)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, v.TEXT.succes)
		doCreatureSay(cid, v.TEXT.succes, TALKTYPE_MONSTER_SAY)
		doSendMagicEffect(toPosition, config.EFFECT_WHEN_MOUNT_CATCH)
		doRemoveItem(item.uid, 1)	
		if v.TEXT.msg_creature_speak_succes ~= nil then
			doCreatureSay(itemEx.uid,v.TEXT.msg_creature_speak_succes, TALKTYPE_MONSTER_SAY)
		elseif v.TEXT.msg_creature_speak ~= nil then
			doCreatureSay(itemEx.uid, v.TEXT.msg_creature_speak, TALKTYPE_MONSTER_SAY)
		end
	elseif losowanie <= (szansa_sukces + szansa_broke) then
		-- item break
		doSendMagicEffect(toPosition, config.EFFECT_WHEN_ITEM_BROKE)
		doCreatureSay(cid, v.TEXT.broke, TALKTYPE_MONSTER_SAY)
		doRemoveItem(item.uid, 1)
		if v.TEXT.msg_creature_speak ~= nil then
			doCreatureSay(itemEx.uid, v.TEXT.msg_creature_speak, TALKTYPE_MONSTER_SAY)
		end
		if v.TEXT.msg_creature_speak_broke ~= nil then
			doCreatureSay(itemEx.uid,v.TEXT.msg_creature_speak_broke, TALKTYPE_MONSTER_SAY)
		end
	elseif losowanie <= (szansa_sukces + szansa_broke + szansa_run) then
		-- mount run
		if (v.TYPE == "MONSTER") and (config.IF_MOUNT_IS_CREATURE_REMOVE_CREATURE_IF_RUN) then
			doRemoveCreature(itemEx.uid)
		elseif (v.TYPE == "NPC") and (config.IF_MOUNT_IS_NPC_REMOVE_CREATURE_IF_RUN) then
			doRemoveCreature(itemEx.uid)
		elseif (v.TYPE == "ITEM") and (config.IF_MOUNT_IS_ITEM_REMOVE_ITEM_IF_RUN) then
			doRemoveItem(itemEx.uid, 1)
		elseif (v.TYPE == "OUTFIT") and (config.IF_MOUNT_IS_OUTFIT_REMOVE_CREATURE_IF_RUN) then
			doRemoveCreature(itemEx.uid)
		end
		if v.TEXT.msg_creature_speak_run ~= nil then
			doCreatureSay(itemEx.uid,v.TEXT.msg_creature_speak_run, TALKTYPE_MONSTER_SAY)
		end
		doSendMagicEffect(toPosition, config.EFFECT_WHEN_MOUNT_RUN)
		doCreatureSay(cid, v.TEXT.run, TALKTYPE_MONSTER_SAY)
	else
		-- mount attack
		doSendMagicEffect(toPosition, config.EFFECT_WHEN_MOUNT_ATTACK)
		doCreatureSay(cid, v.TEXT.attack, TALKTYPE_MONSTER_SAY)
		if v.TEXT.msg_creature_speak_attack ~= nil then
			doCreatureSay(itemEx.uid,v.TEXT.msg_creature_speak_attack, TALKTYPE_MONSTER_SAY)
		elseif v.TEXT.msg_creature_speak ~= nil then
			doCreatureSay(itemEx.uid, v.TEXT.msg_creature_speak, TALKTYPE_MONSTER_SAY)
		end
	end
	
	
	
	
	
end

return true
end




REPORT ALL BUGS, IF ANYTHING IS WRONG THEN REPORT IT, I WILL FIX PROBLEMS IF ANY BECOME.
 
You should optimize it. Why do not use original TFS script?

TFS original script just miss a fix to Music Box
Lua:
local ACTION_RUN, ACTION_BREAK, ACTION_NONE, ACTION_ALL = 1, 2, 3, 4
local TYPE_MONSTER, TYPE_NPC, TYPE_ACTION, TYPE_UNIQUE = 1, 2, 3, 4
 
local config = {
        [13307] = {NAME = 'Wailing Widow',             	   	ID = 1,         TYPE = TYPE_MONSTER,    CHANCE = {succes = 15, broke = 5, run = 55, attack = 25},    FAIL_MSG = { {1, "The widow has run away."}, {2, "The widow has eaten the sweet bait."} }, SUCCESS_MSG = "You have tamed the widow."},
        [13298] = {NAME = 'Terror Bird',               	   	ID = 2,         TYPE = TYPE_MONSTER,    CHANCE = {succes = 15, broke = 5, run = 35, attack = 45},    FAIL_MSG = { {1, "The bird ran away."}, {2, "Oh no, the bird ate the carrot."}, {3, "The terror bird is pecking you."} }, SUCCESS_MSG = "You tamed the bird."},
        [5907] =  {NAME = 'Bear',                         	ID = 3,         TYPE = TYPE_MONSTER,    CHANCE = {succes = 15, broke = 10, run = 40, attack = 35},    FAIL_MSG = { {1, "The bear ran away."}, {2, "Oh no! The slingshot broke."}, {3, "The bear is trying to hit you with its claws."} }, SUCCESS_MSG = "You tamed the wild bear."},
        [13295] = {NAME = 'Black Sheep',                  	ID = 4,         TYPE = TYPE_MONSTER,    CHANCE = {succes = 25, broke = 5, run = 30, attack = 40},    FAIL_MSG = { {1, "The black sheep ran away."}, {2, "Oh no! The reins were torn."}, {3, "The black sheep is trying to run away."} }, SUCCESS_MSG = "You tamed the black sheep."},
        [13293] = {NAME = 'Midnight Panther',     		ID = 5,         TYPE = TYPE_MONSTER,    CHANCE = {succes = 15, broke = 5, run = 30, attack = 50},    FAIL_MSG = { {1, "The midnight panther ran away."}, {2, "The whip broke."}, {3, "The midnight panther is growling at you."} }, SUCCESS_MSG = "You tamed the wild panther."},
        [13294] = {NAME = 'Draptor',                      	ID = 6,         TYPE = TYPE_MONSTER,    CHANCE = {succes = 20, broke = 5, run = 20, attack = 55},    FAIL_MSG = { {1, "The draptor has run away."}, {3, "The draptor has fled."} }, SUCCESS_MSG = "You have tamed the draptor."},
        [13305] = {NAME = 'Crustacea Gigantica', 	  	ID = 7,         TYPE = TYPE_MONSTER,    CHANCE = {succes = 20, broke = 5, run = 30, attack = 45},    FAIL_MSG = { {1, "The crustacea has run away."}, {2, "The crustacea ate the shrimp."} }, SUCCESS_MSG = "You have tamed the crustacea."},
        [13292] = {NAME = 'Tin Lizzard',                  	ID = 8,         TYPE = TYPE_NPC,        CHANCE = {succes = 50, broke = 10, run = 15, attack = 25},    FAIL_MSG = { {2, "The key broke inside."} }, SUCCESS_MSG = "You have started the Tin Lizzard!"},
        [13247] = {NAME = 'Boar',                         	ID = 10,        TYPE = TYPE_MONSTER,    CHANCE = {succes = 15, broke = 5, run = 35, attack = 45},    FAIL_MSG = { {1, "The boar has run away"}, {3, "The boar attacks you."} }, SUCCESS_MSG = "You have tamed the boar."},
        [13291] = {NAME = 'Undead Cavebear',             	ID = 12,        TYPE = TYPE_MONSTER,    CHANCE = {succes = 20, broke = 5, run = 25, attack = 50},    FAIL_MSG = { {1, "The undead bear has run away."} }, SUCCESS_MSG = "You have tamed the skeleton."},
        [13537] = {NAME = 'Donkey',                       	ID = 13,        TYPE = TYPE_MONSTER,    CHANCE = {succes = 10, broke = 30, run = 60, attack = 0},    FAIL_MSG = { {1, "The witch has escaped!"} }, SUCCESS_MSG = "You have tamed the mule."},
        [13508] = {NAME = 'Slug',                         	ID = 14,        TYPE = TYPE_MONSTER,    CHANCE = {succes = 10, broke = 25, run = 40, attack = 25},    FAIL_MSG = { {1, "The slug has run away."}, {3, "The drug had no effect."} }, SUCCESS_MSG = "You have tamed the slug."},
        [13938] = {NAME = 'Uniwheel',                     	ID = 15,        TYPE = TYPE_NPC,        CHANCE = {succes = 40, broke = 60, run = 0, attack = 0},    FAIL_MSG = { {2, "The oil is having no effect."} }, SUCCESS_MSG = "You have found an Uniwheel."},
        [13536] = {NAME = 'Crystal Wolf',                 	ID = 16,        TYPE = TYPE_MONSTER,    CHANCE = {succes = 30, broke = 5, run = 30, attack = 35},    FAIL_MSG = { {1, "The wolf has run away."} }, SUCCESS_MSG = "You have tamed the wolf."},
        [13539] = {NAME = 'White Deer',                   	ID = 18,        TYPE = TYPE_MONSTER,    CHANCE = {succes = 10, broke = 5, run = 50, attack = 35},    FAIL_MSG = { {2, "The cone broke."}, {3, "The deer has fled in fear."} }, SUCCESS_MSG = "You have tamed the deer."},
        [13538] = {NAME = 'Panda',                       	ID = 19,        TYPE = TYPE_MONSTER,    CHANCE = {succes = 15, broke = 10, run = 40, attack = 35},    FAIL_MSG = { {4, "Panda ate the leaves and ran away."} }, SUCCESS_MSG = "You have tamed the panda."},
        [13535] = {NAME = 'Dromedary',                  	ID = 20,        TYPE = TYPE_MONSTER,    CHANCE = {succes = 15, broke = 10, run = 40, attack = 35},    FAIL_MSG = { {1, "Dromedary has run away."} }, SUCCESS_MSG = "You have tamed the dromedary."},
        [13498] = {NAME = 'King Scorpion',              	ID = 21,        TYPE = TYPE_MONSTER,    CHANCE = {succes = 25, broke = 5, run = 40, attack = 30},    FAIL_MSG = { {1, "The scorpion has vanished."}, {2, "Scorpion broken the sceptre."} }, SUCCESS_MSG = "You have tamed the scorpion"},
        [13939] = {NAME = 'War Horse',                    	ID = 23,        TYPE = TYPE_MONSTER,    CHANCE = {succes = 10, broke = 10, run = 50, attack = 30},    FAIL_MSG = { {1, "The horse runs away."}, {2, "The horse ate the oats."} }, SUCCESS_MSG = "You have tamed the horse."},
        [15546] = {NAME = 'Lady Bug',                           ID = 27,        TYPE = TYPE_MONSTER,    CHANCE = {succes = 20, broke = 1, run = 40, attack = 39},    FAIL_MSG = { {1, "The lady bug got scared and ran away."}, {3, "The lady bug is trying to nibble."} }, SUCCESS_MSG = "You have tamed the lady bug."},
        [15545] = {NAME = 'Manta Ray',                 		ID = 28,        TYPE = TYPE_MONSTER,    CHANCE = {succes = 10, broke = 5, run = 50, attack = 35},    FAIL_MSG = { {1, "The manta ray fled."}, {3, "The manta ray is trying to escape."} }, SUCCESS_MSG = "You have tamed the manta ray."},
        [18447] = {NAME = 'Ironblight',                  	ID = 29,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The ironblight fled."}, {3, "The ironblight is trying to escape."} }, SUCCESS_MSG = "You have tamed the ironblight."},
        [18448] = {NAME = 'Magma Crawler',                  	ID = 30,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The magma crawler fled."}, {3, "The magma crawler is trying to escape."} }, SUCCESS_MSG = "You have tamed the magma crawler."},
        [18449] = {NAME = 'Dragonling',                 	ID = 31,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The dragonling fled."}, {3, "The dragonling is trying to escape."} }, SUCCESS_MSG = "You have tamed the dragonling."},
        [18516] = {NAME = 'Modified Gnarlhound',                ID = 32,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The modified gnarlhound fled."}, {3, "The modified gnarlhound is trying to escape."} }, SUCCESS_MSG = "You have tamed the modified gnarlhound."}
}
 
local function doFailAction(cid, mount, pos, item, itemEx)
        local action, effect = mount.FAIL_MSG[math.random(1, table.maxn(mount.FAIL_MSG))], CONST_ME_POFF
        if(action[1] == ACTION_RUN) then
                doRemoveCreature(itemEx.uid)
        elseif(action[1] == ACTION_BREAK) then
                effect = CONST_ME_BLOCKHIT
                doRemoveItem(item.uid, 1)
        elseif(action[1] == ACTION_ALL) then
                doRemoveCreature(itemEx.uid)
                doRemoveItem(item.uid, 1)
        end
 
        doSendMagicEffect(pos, effect)
        doCreatureSay(cid, action[2], TALKTYPE_MONSTER_SAY)
        return action
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
        local mount = config[item.itemid]
        if(mount == nil or getPlayerMount(cid, mount.ID)) then
                return false
        end
 
        local rand = math.random(1, 100)
        --Monster Mount
        if(isMonster(itemEx.uid) and not isSummon(itemEx.uid) and mount.TYPE == TYPE_MONSTER) then
                if(mount.NAME == getCreatureName(itemEx.uid)) then
                        if(rand > mount.CHANCE) then
                                doFailAction(cid, mount, toPosition, item, itemEx)
                                return true
                        end
 
                        doPlayerAddMount(cid, mount.ID)
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, mount.SUCCESS_MSG)
 
                        doCreatureSay(cid, mount.SUCCESS_MSG, TALKTYPE_MONSTER_SAY)
                        doRemoveCreature(itemEx.uid)
 
                        doSendMagicEffect(toPosition, CONST_ME_POFF)
                        doRemoveItem(item.uid, 1)
                        return true
                end
        --NPC Mount
        elseif(isNpc(itemEx.uid) and mount.TYPE == TYPE_NPC) then
                if(mount.NAME == getCreatureName(itemEx.uid)) then
                        if(rand > mount.CHANCE) then
                                doFailAction(cid, mount, toPosition, item, itemEx)
                                return true
                        end
 
                        doPlayerAddMount(cid, mount.ID)
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, mount.SUCCESS_MSG)
 
                        doCreatureSay(cid, mount.SUCCESS_MSG, TALKTYPE_MONSTER_SAY)
 
                        doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN)
                        doRemoveItem(item.uid, 1)
                        return true
                end
        --Action Mount
        elseif(itemEx.actionid > 0 and mount.TYPE == TYPE_ACTION) then
                if(mount.NAME == itemEx.actionid) then
                        if(rand > mount.CHANCE) then
                                doFailAction(cid, mount, toPosition, item, itemEx)
                                return true
                        end
 
                        doPlayerAddMount(cid, mount.ID)
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, mount.SUCCESS_MSG)
 
                        doCreatureSay(cid, mount.SUCCESS_MSG, TALKTYPE_MONSTER_SAY)
                        doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN)
 
                        doRemoveItem(item.uid, 1)
                        return true
                end
        --Unique Mount
        elseif(itemEx.uid <= 65535 and mount.TYPE == TYPE_UNIQUE) then
                if(mount.NAME == itemEx.uid) then
                        if(rand > mount.CHANCE) then
                                doFailAction(cid, mount, toPosition, item, itemEx)
                                return true
                        end
 
                        doPlayerAddMount(cid, mount.ID)
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, mount.SUCCESS_MSG)
 
                        doCreatureSay(cid, mount.SUCCESS_MSG, TALKTYPE_MONSTER_SAY)
                        doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN)
 
                        doRemoveItem(item.uid, 1)
                        return true
                end
        end
 
        return false
end

- - - Updated - - -

Music Box added (untested)
Lua:
local ACTION_RUN, ACTION_BREAK, ACTION_NONE, ACTION_ALL = 1, 2, 3, 4
local TYPE_MONSTER, TYPE_NPC, TYPE_ACTION, TYPE_UNIQUE = 1, 2, 3, 4

local config = {
        [13307] = {NAME = 'Wailing Widow',             	   	ID = 1,         TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The widow has run away."}, {2, "The widow has eaten the sweet bait."} }, SUCCESS_MSG = "You have tamed the widow."},
        [13298] = {NAME = 'Terror Bird',               	   	ID = 2,         TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The bird ran away."}, {3, "The terror bird is pecking you."} }, SUCCESS_MSG = "You have tamed the bird."},
        [5907]  = {NAME = 'Bear',                         	ID = 3,         TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The bear ran away."}, {2, "Oh no! The slingshot broke."}, {3, "The bear is trying to hit you with its claws."} }, SUCCESS_MSG = "You have tamed the bear."},
        [13295] = {NAME = 'Black Sheep',                  	ID = 4,         TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The black sheep ran away."}, {2, "Oh no! The reins were torn."}, {3, "The black sheep is trying to run away."} }, SUCCESS_MSG = "You have tamed the sheep."},
        [13293] = {NAME = 'Midnight Panther',     		ID = 5,         TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The panther has escaped."}, {2, "The whip broke."} }, SUCCESS_MSG = "You have tamed the panther."},
        [13294] = {NAME = 'Draptor',                      	ID = 6,         TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The draptor has run away."}, {3, "The draptor has fled."} }, SUCCESS_MSG = "You have tamed the draptor."},
        [13305] = {NAME = 'Crustacea Gigantica', 	  	ID = 7,         TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The crustacea has run away."}, {2, "The crustacea ate the shrimp."} }, SUCCESS_MSG = "You have tamed the crustacea."},
        [13292] = {NAME = 'Tin Lizzard',                  	ID = 8,         TYPE = TYPE_NPC,        CHANCE = 15,    FAIL_MSG = { {2, "The key broke inside."} }, SUCCESS_MSG = "You have started the Tin Lizzard!"},
        [13247] = {NAME = 'Boar',                         	ID = 10,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The boar has run away"}, {3, "The boar attacks you."} }, SUCCESS_MSG = "You have tamed the boar."},
        [13291] = {NAME = 'Undead Cavebear',             	ID = 12,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The undead bear has run away."} }, SUCCESS_MSG = "You have tamed the skeleton."},
        [13537] = {NAME = 'Donkey',                       	ID = 13,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The witch has escaped!"} }, SUCCESS_MSG = "You have tamed the mule."},
        [13508] = {NAME = 'Slug',                         	ID = 14,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The slug has run away."}, {3, "The drug had no effect."} }, SUCCESS_MSG = "You have tamed the slug."},
        [13938] = {NAME = 'Uniwheel',                     	ID = 15,        TYPE = TYPE_NPC,        CHANCE = 15,    FAIL_MSG = { {2, "The oil is having no effect."} }, SUCCESS_MSG = "You have found an Uniwheel."},
        [13536] = {NAME = 'Crystal Wolf',                 	ID = 16,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The wolf has run away."} }, SUCCESS_MSG = "You have tamed the wolf."},
        [13539] = {NAME = 'White Deer',                   	ID = 18,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {2, "The cone broke."}, {3, "The deer has fled in fear."} }, SUCCESS_MSG = "You have tamed the deer."},
        [13538] = {NAME = 'Panda',                       	ID = 19,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {4, "Panda ate the leaves and ran away."} }, SUCCESS_MSG = "You have tamed the panda."},
        [13535] = {NAME = 'Dromedary',                  	ID = 20,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "Dromedary has run away."} }, SUCCESS_MSG = "You have tamed the dromedary."},
        [13498] = {NAME = 'King Scorpion',              	ID = 21,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The scorpion has vanished."}, {2, "Scorpion broken the sceptre."} }, SUCCESS_MSG = "You have tamed the scorpion"},
        [13939] = {NAME = 'War Horse',                    	ID = 23,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The horse runs away."}, {2, "The horse ate the oats."} }, SUCCESS_MSG = "You have tamed the horse."},
        [15546] = {NAME = 'Lady Bug',                           ID = 27,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The lady bug got scared and ran away."}, {3, "The lady bug is trying to nibble."} }, SUCCESS_MSG = "You have tamed the lady bug."},
        [15545] = {NAME = 'Manta Ray',                 		ID = 28,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The manta ray fled."}, {3, "The manta ray is trying to escape."} }, SUCCESS_MSG = "You have tamed the manta ray."},
        [18447] = {NAME = 'Ironblight',                  	ID = 29,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The ironblight fled."}, {3, "The ironblight is trying to escape."} }, SUCCESS_MSG = "You have tamed the ironblight."},
        [18448] = {NAME = 'Magma Crawler',                  	ID = 30,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The magma crawler fled."}, {3, "The magma crawler is trying to escape."} }, SUCCESS_MSG = "You have tamed the magma crawler."},
        [18449] = {NAME = 'Dragonling',                 	ID = 31,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The dragonling fled."}, {3, "The dragonling is trying to escape."} }, SUCCESS_MSG = "You have tamed the dragonling."},
        [18516] = {NAME = 'Modified Gnarlhound',                ID = 32,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The modified gnarlhound fled."}, {3, "The modified gnarlhound is trying to escape."} }, SUCCESS_MSG = "You have tamed the modified gnarlhound."}
}

local function doFailAction(cid, mount, pos, item, itemEx)
        local action, effect = mount.FAIL_MSG[math.random(1, table.maxn(mount.FAIL_MSG))], CONST_ME_POFF
        if(action[1] == ACTION_RUN) then
                doRemoveCreature(itemEx.uid)
        elseif(action[1] == ACTION_BREAK) then
                effect = CONST_ME_BLOCKHIT
                doRemoveItem(item.uid, 1)
        elseif(action[1] == ACTION_ALL) then
                doRemoveCreature(itemEx.uid)
                doRemoveItem(item.uid, 1)
        end

        doSendMagicEffect(pos, effect)
        doCreatureSay(cid, action[2], TALKTYPE_MONSTER_SAY)
        return action
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
        local mount = config[item.itemid]
        if(mount == nil or getPlayerMount(cid, mount.ID)) then
                return false
        end

        local rand = math.random(1, 100)
        --Monster Mount
        if(isMonster(itemEx.uid) and not isSummon(itemEx.uid) and mount.TYPE == TYPE_MONSTER) then
                if(mount.NAME == getCreatureName(itemEx.uid)) then
                        if (item.itemid == 18511) then
                        	doPlayerAddMount(cid, mount.ID)
                        	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, mount.SUCCESS_MSG)

                        	doCreatureSay(cid, mount.SUCCESS_MSG, TALKTYPE_MONSTER_SAY)
                        	doRemoveCreature(itemEx.uid)

                        	doSendMagicEffect(toPosition, CONST_ME_POFF)
                        	doRemoveItem(item.uid, 1)
                        	return true
			elseif (rand > mount.CHANCE) then
                                doFailAction(cid, mount, toPosition, item, itemEx)
                                return true
                        end

                        doPlayerAddMount(cid, mount.ID)
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, mount.SUCCESS_MSG)

                        doCreatureSay(cid, mount.SUCCESS_MSG, TALKTYPE_MONSTER_SAY)
                        doRemoveCreature(itemEx.uid)

                        doSendMagicEffect(toPosition, CONST_ME_POFF)
                        doRemoveItem(item.uid, 1)
                        return true
                end
        --NPC Mount
        elseif(isNpc(itemEx.uid) and mount.TYPE == TYPE_NPC) then
                if(mount.NAME == getCreatureName(itemEx.uid)) then
                        if(rand > mount.CHANCE) then
                                doFailAction(cid, mount, toPosition, item, itemEx)
                                return true
                        end

                        doPlayerAddMount(cid, mount.ID)
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, mount.SUCCESS_MSG)

                        doCreatureSay(cid, mount.SUCCESS_MSG, TALKTYPE_MONSTER_SAY)

                        doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN)
                        doRemoveItem(item.uid, 1)
                        return true
                end
        --Action Mount
        elseif(itemEx.actionid > 0 and mount.TYPE == TYPE_ACTION) then
                if(mount.NAME == itemEx.actionid) then
                        if(rand > mount.CHANCE) then
                                doFailAction(cid, mount, toPosition, item, itemEx)
                                return true
                        end

                        doPlayerAddMount(cid, mount.ID)
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, mount.SUCCESS_MSG)

                        doCreatureSay(cid, mount.SUCCESS_MSG, TALKTYPE_MONSTER_SAY)
                        doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN)

                        doRemoveItem(item.uid, 1)
                        return true
                end
        --Unique Mount
        elseif(itemEx.uid <= 65535 and mount.TYPE == TYPE_UNIQUE) then
                if(mount.NAME == itemEx.uid) then
                        if(rand > mount.CHANCE) then
                                doFailAction(cid, mount, toPosition, item, itemEx)
                                return true
                        end

                        doPlayerAddMount(cid, mount.ID)
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, mount.SUCCESS_MSG)

                        doCreatureSay(cid, mount.SUCCESS_MSG, TALKTYPE_MONSTER_SAY)
                        doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN)

                        doRemoveItem(item.uid, 1)
                        return true
                end
        end

        return false
end

Changed
Lua:
if (rand > mount.CHANCE) then
	doFailAction(cid, mount, toPosition, item, itemEx)
	return true
end

to
Lua:
if (item.itemid == 18511) then
	doPlayerAddMount(cid, mount.ID)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, mount.SUCCESS_MSG)
	
	doCreatureSay(cid, mount.SUCCESS_MSG, TALKTYPE_MONSTER_SAY)
	doRemoveCreature(itemEx.uid)
 
	doSendMagicEffect(toPosition, CONST_ME_POFF)
	doRemoveItem(item.uid, 1)
	return true
elseif (rand > mount.CHANCE) then
	doFailAction(cid, mount, toPosition, item, itemEx)
	return true
end

- - - Updated - - -

New one, added function doTame(cid, mount, pos, item, itemEx)
Lua:
local ACTION_RUN, ACTION_BREAK, ACTION_NONE, ACTION_ALL = 1, 2, 3, 4
local TYPE_MONSTER, TYPE_NPC, TYPE_ACTION, TYPE_UNIQUE = 1, 2, 3, 4

local config = {
        [13307] = {NAME = 'Wailing Widow',             	   	ID = 1,         TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The widow has run away."}, {2, "The widow has eaten the sweet bait."} }, SUCCESS_MSG = "You have tamed the widow."},
        [13298] = {NAME = 'Terror Bird',               	   	ID = 2,         TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The bird ran away."}, {3, "The terror bird is pecking you."} }, SUCCESS_MSG = "You have tamed the bird."},
        [5907]  = {NAME = 'Bear',                         	ID = 3,         TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The bear ran away."}, {2, "Oh no! The slingshot broke."}, {3, "The bear is trying to hit you with its claws."} }, SUCCESS_MSG = "You have tamed the bear."},
        [13295] = {NAME = 'Black Sheep',                  	ID = 4,         TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The black sheep ran away."}, {2, "Oh no! The reins were torn."}, {3, "The black sheep is trying to run away."} }, SUCCESS_MSG = "You have tamed the sheep."},
        [13293] = {NAME = 'Midnight Panther',     		ID = 5,         TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The panther has escaped."}, {2, "The whip broke."} }, SUCCESS_MSG = "You have tamed the panther."},
        [13294] = {NAME = 'Draptor',                      	ID = 6,         TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The draptor has run away."}, {3, "The draptor has fled."} }, SUCCESS_MSG = "You have tamed the draptor."},
        [13305] = {NAME = 'Crustacea Gigantica', 	  	ID = 7,         TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The crustacea has run away."}, {2, "The crustacea ate the shrimp."} }, SUCCESS_MSG = "You have tamed the crustacea."},
        [13292] = {NAME = 'Tin Lizzard',                  	ID = 8,         TYPE = TYPE_NPC,        CHANCE = 15,    FAIL_MSG = { {2, "The key broke inside."} }, SUCCESS_MSG = "You have started the Tin Lizzard!"},
        [13247] = {NAME = 'Boar',                         	ID = 10,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The boar has run away"}, {3, "The boar attacks you."} }, SUCCESS_MSG = "You have tamed the boar."},
        [13291] = {NAME = 'Undead Cavebear',             	ID = 12,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The undead bear has run away."} }, SUCCESS_MSG = "You have tamed the skeleton."},
        [13537] = {NAME = 'Donkey',                       	ID = 13,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The witch has escaped!"} }, SUCCESS_MSG = "You have tamed the mule."},
        [13508] = {NAME = 'Slug',                         	ID = 14,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The slug has run away."}, {3, "The drug had no effect."} }, SUCCESS_MSG = "You have tamed the slug."},
        [13938] = {NAME = 'Uniwheel',                     	ID = 15,        TYPE = TYPE_NPC,        CHANCE = 15,    FAIL_MSG = { {2, "The oil is having no effect."} }, SUCCESS_MSG = "You have found an Uniwheel."},
        [13536] = {NAME = 'Crystal Wolf',                 	ID = 16,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The wolf has run away."} }, SUCCESS_MSG = "You have tamed the wolf."},
        [13539] = {NAME = 'White Deer',                   	ID = 18,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {2, "The cone broke."}, {3, "The deer has fled in fear."} }, SUCCESS_MSG = "You have tamed the deer."},
        [13538] = {NAME = 'Panda',                       	ID = 19,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {4, "Panda ate the leaves and ran away."} }, SUCCESS_MSG = "You have tamed the panda."},
        [13535] = {NAME = 'Dromedary',                  	ID = 20,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "Dromedary has run away."} }, SUCCESS_MSG = "You have tamed the dromedary."},
        [13498] = {NAME = 'King Scorpion',              	ID = 21,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The scorpion has vanished."}, {2, "Scorpion broken the sceptre."} }, SUCCESS_MSG = "You have tamed the scorpion"},
        [13939] = {NAME = 'War Horse',                    	ID = 23,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The horse runs away."}, {2, "The horse ate the oats."} }, SUCCESS_MSG = "You have tamed the horse."},
        [15546] = {NAME = 'Lady Bug',                           ID = 27,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The lady bug got scared and ran away."}, {3, "The lady bug is trying to nibble."} }, SUCCESS_MSG = "You have tamed the lady bug."},
        [15545] = {NAME = 'Manta Ray',                 		ID = 28,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The manta ray fled."}, {3, "The manta ray is trying to escape."} }, SUCCESS_MSG = "You have tamed the manta ray."},
        [18447] = {NAME = 'Ironblight',                  	ID = 29,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The ironblight fled."}, {3, "The ironblight is trying to escape."} }, SUCCESS_MSG = "You have tamed the ironblight."},
        [18448] = {NAME = 'Magma Crawler',                  	ID = 30,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The magma crawler fled."}, {3, "The magma crawler is trying to escape."} }, SUCCESS_MSG = "You have tamed the magma crawler."},
        [18449] = {NAME = 'Dragonling',                 	ID = 31,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The dragonling fled."}, {3, "The dragonling is trying to escape."} }, SUCCESS_MSG = "You have tamed the dragonling."},
        [18516] = {NAME = 'Modified Gnarlhound',                ID = 32,        TYPE = TYPE_MONSTER,    CHANCE = 15,    FAIL_MSG = { {1, "The modified gnarlhound fled."}, {3, "The modified gnarlhound is trying to escape."} }, SUCCESS_MSG = "You have tamed the modified gnarlhound."}
}

local function doFailAction(cid, mount, pos, item, itemEx)
        local action, effect = mount.FAIL_MSG[math.random(1, table.maxn(mount.FAIL_MSG))], CONST_ME_POFF
        if(action[1] == ACTION_RUN) then
                doRemoveCreature(itemEx.uid)
        elseif(action[1] == ACTION_BREAK) then
                effect = CONST_ME_BLOCKHIT
                doRemoveItem(item.uid, 1)
        elseif(action[1] == ACTION_ALL) then
                doRemoveCreature(itemEx.uid)
                doRemoveItem(item.uid, 1)
        end

        doSendMagicEffect(pos, effect)
        doCreatureSay(cid, action[2], TALKTYPE_MONSTER_SAY)
        return action
end

local function doTame(cid, mount, pos, item, itemEx)
	doPlayerAddMount(cid, mount.ID)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, mount.SUCCESS_MSG)

	doCreatureSay(cid, mount.SUCCESS_MSG, TALKTYPE_MONSTER_SAY)
	doSendMagicEffect(toPosition, CONST_ME_POFF)
	doRemoveItem(item.uid, 1)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
        local mount = config[item.itemid]
        if(mount == nil or getPlayerMount(cid, mount.ID)) then
                return false
        end

        local rand = math.random(1, 100)
        --Monster Mount
        if(isMonster(itemEx.uid) and not isSummon(itemEx.uid) and mount.TYPE == TYPE_MONSTER) then
                if(mount.NAME == getCreatureName(itemEx.uid)) then
                        if (item.itemid == 18511) then
                        	doTame(cid, mount, pos, item, itemEx)
				doRemoveCreature(itemEx.uid)
                        	return true
			elseif (rand > mount.CHANCE) then
                                doFailAction(cid, mount, toPosition, item, itemEx)
                                return true
                        end

                        doTame(cid, mount, pos, item, itemEx)
			doRemoveCreature(itemEx.uid)
                        return true
                end
        --NPC Mount
        elseif(isNpc(itemEx.uid) and mount.TYPE == TYPE_NPC) then
                if(mount.NAME == getCreatureName(itemEx.uid)) then
                        if(rand > mount.CHANCE) then
                                doFailAction(cid, mount, toPosition, item, itemEx)
                                return true
                        end

                        doTame(cid, mount, pos, item, itemEx)
                        return true
                end
        --Action Mount
        elseif(itemEx.actionid > 0 and mount.TYPE == TYPE_ACTION) then
                if(mount.NAME == itemEx.actionid) then
                        if(rand > mount.CHANCE) then
                                doFailAction(cid, mount, toPosition, item, itemEx)
                                return true
                        end

                        doTame(cid, mount, pos, item, itemEx)
                        doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN)
                        return true
                end
        --Unique Mount
        elseif(itemEx.uid <= 65535 and mount.TYPE == TYPE_UNIQUE) then
                if(mount.NAME == itemEx.uid) then
                        if(rand > mount.CHANCE) then
                                doFailAction(cid, mount, toPosition, item, itemEx)
                                return true
                        end

                        doTame(cid, mount, pos, item, itemEx)
                        doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN)

                        doRemoveItem(item.uid, 1)
                        return true
                end
        end

        return false
end

XML:
	<!-- Taming Items -->
	<action itemid="5907;13247;13291-13295;13298;13305;13307;13508;13535-13539;13938-13939;13498;15545;15546;18447;18448;18449;18511;18516" event="script" value="other/taming.lua"/>
 
Last edited:
1. donkey mount is outfit of donkey, not monster
2. i have real tibia chances for tame
3. my script is more advanced

- - - Updated - - -

and my script is easy to config xD If you want to allow tame summons or other option, you only need to change true/false in config ;p
 
Your script in polish is not readable to me, about chance, you just have to change in tfs script.
 
Lucas o teu script la to usando e ta show, mas explica ai o que tu atualizo por ultimo ali..
translate: Lucas your mount script i'm using it, and it's so nice, but explain what you have updated.
 
i have problem with icredibly old witch.. i tame her or the donkey. i tried tame the two, but nothing happened
 
TIPS
You should translate your script to english
Missing Ironblight, Magma Crawler, Dragonling and Modified Gnarlhound

it's action script.

Lua:
local config = {
	-- onw  or  regular, if 'own' then script will check chance from taming_tbl, if 'regular' then script will check chance from regular_mount_tbl
	OwnChanceOrRegular = "own", -- "own" lub "regular"   <- own to czyta z tablicy taming_tbl szanse, a regular to czyta z regular_mount_tbl badz tbl_szans_gdy_nil gdy w tablicy tamingu nie ma regular mount chance
	ALLOW_SUMMON_TO_ALL_MOUNTS = false,
	BLOCK_ALLOW_SUMMON_TO_ALL_MONSTER = false,
	EFFECT_WHEN_MOUNT_RUN = 1, -- poprawic efekt
	EFFECT_WHEN_ITEM_BROKE = CONST_ME_BLOCKHIT, 
	EFFECT_WHEN_MOUNT_ATTACK = 2, -- poprawic efekt
	EFFECT_WHEN_MOUNT_CATCH = CONST_ME_POFF, 
	IF_MOUNT_IS_ITEM_REMOVE_ITEM_IF_RUN = false,
	IF_MOUNT_IS_ITEM_REMOVE_ITEM_IF_CATCH = false,
	IF_MOUNT_IS_CREATURE_REMOVE_CREATURE_IF_RUN = true,
	IF_MOUNT_IS_CREATURE_REMOVE_CREATURE_IF_CATCH = true,
	IF_MOUNT_IS_NPC_REMOVE_CREATURE_IF_RUN = false,
	IF_MOUNT_IS_NPC_REMOVE_CREATURE_IF_CATCH = false,
	IF_MOUNT_IS_OUTFIT_REMOVE_CREATURE_IF_RUN = true,
	IF_MOUNT_IS_OUTFIT_REMOVE_CREATURE_IF_CATCH = true,
	
	IF_MOUNT_IS_OUTFIT_ALLOW_TO_CREATURE_CAN_BE_PLAYER = false,
	
	}
local regular_mount_tbl = {
	["regular"] = {succes = 10, broke = 5, run = 50, attack = 35}, --regularne z polskiej wikii // regular chance for mount (from polish wiki)
	["other"] = {succes = 10, broke = 5, run = 30, attack = 55}, -- nieregularne z polskiej wikii //nonregular chance for mount (from polish wiki)
	}
local tbl_szans_gdy_nil = {
	succes = 10,
	broke = 5, 
	run = 50, 
	attack = 35,
	}
local taming_tbl = {
	[5907] = {MOUNT_NAME = "War Bear", MOUNT_ID = 3, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "MONSTER", TYPE_ID = "bear", ALLOW_SUMMON = false,
	CHANCE = {succes = 15, broke = 10, run = 40, attack = 35},
	TEXT = {succes = "You tamed the wild bear.", broke = "Oh no! The slingshot broke.", run = "The bear ran away.", attack = "The bear is trying to hit you with its claws."}
		},
	[13295] = {MOUNT_NAME = "Black Sheep", MOUNT_ID = 4, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "MONSTER", TYPE_ID = "black sheep", ALLOW_SUMMON = false,
	CHANCE = {succes = 25, broke = 5, run = 30, attack = 40},
	TEXT = {succes = "You tamed the black sheep.", broke = "Oh no! The reins were torn.", run = "The black sheep ran away.", attack = "The black sheep is trying to run away."},
		},
	[13293] = {MOUNT_NAME = "Midnight Panther", MOUNT_ID = 5, REGULAR_MOUNT_CHANCE = "other",
	TYPE = "MONSTER", TYPE_ID = "midnight panthe", ALLOW_SUMMON = false,
	CHANCE = {succes = 15, broke = 5, run = 30, attack = 50},
	TEXT = {succes = "You tamed the wild panther.", broke = "The whip broke. ?", run = "The midnight panther ran away.", attack = "The midnight panther is growling at you."},
		},
	[13298] = {MOUNT_NAME = "Racing Bird", MOUNT_ID = 2, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "MONSTER", TYPE_ID = "terror bird", ALLOW_SUMMON = false,
	CHANCE = {succes = 15, broke = 5, run = 35, attack = 45},
	TEXT = {succes = "You tamed the bird.", broke = "Oh no, the bird ate the carrot.", run = "The bird ran away.", attack = "The terror bird is pecking you."},
		},
	[13247] = {MOUNT_NAME = "Rapid Boar", MOUNT_ID = 10, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "MONSTER", TYPE_ID = "boar", ALLOW_SUMMON = false,
	CHANCE = {succes = 15, broke = 5, run = 35, attack = 45},
	TEXT = {succes = "You tamed the wild boar", broke = "The horn broke. ?", run = "The boar ran away.", attack = "The boar is refusing to obey the hunting horn."},
		},
	[13305] = {MOUNT_NAME = "Titanica", MOUNT_ID = 7, REGULAR_MOUNT_CHANCE = "other",
	TYPE = "MONSTER", TYPE_ID = "crustacea gigantica", ALLOW_SUMMON = false,
	CHANCE = {succes = 20, broke = 5, run = 30, attack = 45},
	TEXT = {succes = "You tamed the gigantic creature.", broke = "Gigantica ate shrimp. ?", run = "The gigantic creature ran away.", attack = "The gigantic creature is trying to pinch you."},
		},
	[13291] = {MOUNT_NAME = "Undead Cavebear", MOUNT_ID = 12, REGULAR_MOUNT_CHANCE = "other",
	TYPE = "MONSTER", TYPE_ID = "undead cavebear", ALLOW_SUMMON = false,
	CHANCE = {succes = 20, broke = 5, run = 25, attack = 50},
	TEXT = {succes = "You tamed the undead cavebear.", broke = "Maxilla broke. ?", run = "The undead cavebear ran away.", attack = "The undead cavebear is growling at you."},
		},
	[13307] = {MOUNT_NAME = "Widow Queen", MOUNT_ID = 1, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "MONSTER", TYPE_ID = "wailing widow", ALLOW_SUMMON = false,
	CHANCE = {succes = 15, broke = 5, run = 55, attack = 25},
	TEXT = {succes = "You have tamed the widow.", broke = "The widow has eaten the sweet bait.", run = "The widow ran away.?", attack = "The widow tryed to hit you.?"},
		},
	[13292] = {MOUNT_NAME = "Tin Lizzard", MOUNT_ID = 8, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "NPC", TYPE_ID = "tin lizzard", ALLOW_SUMMON = false,
	CHANCE = {succes = 50, broke = 10, run = 15, attack = 25},
	TEXT = {succes = "You wind up the tin lizzard", msg_creature_speak = "Krkrkrkrk", broke = "The key broke inside.?", run = "Try again.?", attack = "Try again.?"},
		},
	[13294] = {MOUNT_NAME = "Draptor", MOUNT_ID = 6, REGULAR_MOUNT_CHANCE = "other",
	TYPE = "MONSTER", TYPE_ID = "draptor", ALLOW_SUMMON = false,
	CHANCE = {succes = 20, broke = 5, run = 20, attack = 55},
	TEXT = {succes = "You tamed the wild draptor.", msg_creature_speak = "Screeeeeeeeech", broke = "Harness broke.?", run = "The draptor has fled.?", attack = "The wild draptor is struggling."},
		},
	[13536] = {MOUNT_NAME = "Crystal Wolf", MOUNT_ID = 16, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "MONSTER", TYPE_ID = "crystal wolf", ALLOW_SUMMON = false,
	CHANCE = {succes = 30, broke = 5, run = 30, attack = 35},
	TEXT = {succes = "The smooth sound of the diapason tamed the crystal wolf.", 
	broke = "Clashing on the hard crystalline surface of the wolf, the fragile diapason breaks.", 
	run = "The crystal wolf vanished into thin air.", attack = "The Crystal wolf is startled by the wrong sound of the diapason.",
	msg_creature_speak_succes = "*kliiiiiiiiiiing* Aooooouuuuu!!",
	msg_creature_speak_run = "*zwiiiish*",
	msg_creature_speak_attack = "*klaaaaaang* Rrrrooooaaaarrrgh!"},
		},
	[13539] = {MOUNT_NAME = "Kingly Deer", MOUNT_ID = 18, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "MONSTER", TYPE_ID = "white deer", ALLOW_SUMMON = false,
	CHANCE = {succes = 10, broke = 5, run = 50, attack = 35},
	TEXT = {succes = "You tamed the white deer.", broke = "Oh no... the enraged deer angrily ripped the fir cone from your hands!", run = "The white deer flees.", attack = "The white deer sniffs and wheezes, trying to withstand the taming.",
	msg_creature_speak_succes = "*bell*",
	msg_creature_speak_run = "*sniff*",
	msg_creature_speak_attack = "*wheeze*"},
		},
	[13538] = {MOUNT_NAME = "Tamed Panda", MOUNT_ID = 19, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "MONSTER", TYPE_ID = "panda", ALLOW_SUMMON = false,
	CHANCE = {succes = 15, broke = 10, run = 40, attack = 35},
	TEXT = {succes = "You tamed the panda.", broke = "While you were trying to soothe the panda, it ate all the remaining bamboo behind your back. ", 
	run = "The panda flees.", attack = "The panda refuses to follow any of your orders. "},
		},	
	[13535] = {MOUNT_NAME = "Dromedary", MOUNT_ID = 20, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "MONSTER", TYPE_ID = "dromedary", ALLOW_SUMMON = false,
	CHANCE = {succes = 15, broke = 10, run = 40, attack = 35},
	TEXT = {succes = "", broke = "", run = "", attack = ""},
		},
	[13498] = {MOUNT_NAME = "King Scorpion", MOUNT_ID = 21, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "MONSTER", TYPE_ID = "sandstone scorpion", ALLOW_SUMMON = false,
	CHANCE = {succes = 25, broke = 5, run = 40, attack = 30},
	TEXT = {succes = "You tamed the sandstone scorpion.", broke = "The sandstone scorpion eludes the influence of the scepter.", 
	run = "The sandstone scorpion flees.", attack = "attack xD"},
		},
	[13537] = {MOUNT_NAME = "Donkey", MOUNT_ID = 13, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "OUTFIT", TYPE_ID = 399, ALLOW_SUMMON = true,
	CHANCE = {succes = 10, broke = 30, run = 60, attack = 0},
	TEXT = {succes = "Munching a large pile of apple slices tamed the donkey.", broke = "You did not manage to feed the donkey enough apple slices.", run = "The donkey transformation suddenly wears off.", attack = "Donkey attack! xD?"},
		},
	[13938] = {MOUNT_NAME = "Uniwheel", MOUNT_ID = 15, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "NPC", TYPE_ID = "uniwheel", ALLOW_SUMMON = false,
	CHANCE = {succes = 40, broke = 60, run = 0, attack = 0},
	TEXT = {succes = "The strange wheel seems to vibrate and slowly starts turning continuously.",
	broke = "It looks like most of the special oil this can was holding was spilt without any effect.", run = "UCIEK KURWA", attack = "ZAJEBAL CI KIEROWNICA",
	msg_creature_speak_succes = "Vroooomratatatatatatat.",
	msg_creature_speak_broke = "Splosh!"},
		},
	[13508] = {MOUNT_NAME = "Tiger Slug", MOUNT_ID = 14, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "MONSTER", TYPE_ID = "slug", ALLOW_SUMMON = false,
	CHANCE = {succes = 10, broke = 25, run = 40, attack = 25},
	TEXT = {succes = "You drugged the slug.", broke = "This slug drug didn't seem to have any effect.", run = "The slug flees.", attack = "The slug slips trough your grasp.",
	msg_creature_speak_succes = "Sluuuuurp!",
	msg_creature_speak_run = "Slurp!",
	msg_creature_speak_attack = "*shlorp*"},
		},
	[13939] = {MOUNT_NAME = "War Horse", MOUNT_ID = 23, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "MONSTER", TYPE_ID = "wild horse", ALLOW_SUMMON = false,
	CHANCE = {succes = 10, broke = 10, run = 50, attack = 30},
	TEXT = {succes = "The horse eats the sugar oat and accepts you as its new master.", broke = "The wild horse happily munches the sugar oat and runs on.",
	run = "With its last strength the horse the horse runs to safety.", attack = "Weeeheeeehee."},
		},
	[15545] = {MOUNT_NAME = "Manta", MOUNT_ID = 28, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "MONSTER", TYPE_ID = "manta ray", ALLOW_SUMMON = false,
	CHANCE = {succes = 10, broke = 5, run = 50, attack = 35},
	TEXT = {succes = "zlapales mante", broke = "zjadla", run = "uciekla", attack = "zaatakowala"},
		},
	[15546] = {MOUNT_NAME = "Ladybug", MOUNT_ID = 27, REGULAR_MOUNT_CHANCE = "regular",
	TYPE = "MONSTER", TYPE_ID = "ladybug", ALLOW_SUMMON = false,
	CHANCE = {succes = 20, broke = 1, run = 40, attack = 39},
	TEXT = {succes = "You tamed a ladybug", broke = "You broke it.?", run = "The ladybug got scared and ran away.", attack = "The ladybug is trying to nibble."},
		},
	--[[
	[itemid rzeczy] = {MOUNT_NAME = "", MOUNT_ID = , REGULAR_MOUNT_CHANCE = ,
	TYPE = , TYPE_ID = , ALLOW_SUMMON = ,
	CHANCE = {succes = , broke = , run = , attack = },
	TEXT = {succes = , broke = , run = , attack = },
		},
		]]--
	}

function onUse(cid, item, fromPosition, itemEx, toPosition)
local v = taming_tbl[item.itemid]	

local szansa_sukces = 0
local szansa_broke = 0
local szansa_run = 0
local szansa_attack = 0

if v then
	--- tutaj dac sprawdzanie exhausteda
	
	
	-- koniec sprawdzania exhaausteda 
	-- sprawdzanie czy gracz ma mounta, jesli ma juz go to wysle mu wiadomosc, ze go ma i zakonczy dzialanie skryptu
	if getPlayerMount(cid, v.MOUNT_ID) then
		return doPlayerSendCancel(cid, "You allready have this mount!")
	end
	-- sprawdzanie czy w tablicy mountsow, danego mounta mozna summonowac, lub czy w configu jest, ze mounty moga byc summonami oraz sprawdzenie czy nie ma blokady na summony do wszystkich mountow
	if ((not(v.ALLOW_SUMMON)) and (not(config.ALLOW_SUMMON_TO_ALL_MOUNTS))) or (config.BLOCK_ALLOW_SUMMON_TO_ALL_MONSTER) then
		if isSummon(itemEx.uid) then
			return doPlayerSendCancel(cid, "This mount can't be summon to catch him!")
		end
	end
	-- sprawdzanie czy itemu uzywamy na dobrym stworku/outfitcie itd.
	if v.TYPE == "MONSTER" then
		if not(isMonster(itemEx.uid)) then
			return doPlayerSendCancel(cid, "This item you can only use on monsters.")
		end
		if v.TYPE_ID ~= (getCreatureName(itemEx.uid):lower()) then
			return doPlayerSendCancel(cid, "By this item you cannot tame this monster.")
		end
	elseif v.TYPE == "NPC" then
		if not(isNpc(itemEx.uid)) then
			return doPlayerSendCancel(cid, "This item you can only use on NPCs.")
		end
		if v.TYPE_ID ~= (getCreatureName(itemEx.uid):lower()) then
			return doPlayerSendCancel(cid, "By this item you cannot tame this NPC.")
		end
	elseif v.TYPE == "ITEM" then
		if not(itemEx.itemid ~= nil) then
			return doPlayerSendCancel(cid, "This item you can only use on items.")
		end
		if v.TYPE_ID ~= itemEx.itemid then
			return doPlayerSendCancel(cid, "By this item you cannot tame this item.")
		end
	elseif v.TYPE == "OUTFIT" then
		if not(isCreature(itemEx.uid)) then
			return doPlayerSendCancel(cid, "You can only use it on creatures.")
		end
		if (isPlayer(itemEx.uid) and (not(config.IF_MOUNT_IS_OUTFIT_ALLOW_TO_CREATURE_CAN_BE_PLAYER))) then
			return doPlayerSendCancel(cid, "You cannot use this item on players.")
		end
		if v.TYPE_ID ~= (getCreatureOutfit(itemEx.uid).lookType) then
			return doPlayerSendCancel(cid, "By this item you cannot tame creature with this outfit.")
		end
	end
	
	--
	
	
	if (v.CHANCE.succes ~= nil) and (config.OwnChanceOrRegular ~= "own") then
		szansa_sukces = v.CHANCE.succes
	else
		if v.REGULAR_MOUNT_CHANCE ~= nil then
			szansa_sukces = regular_mount_tbl[v.REGULAR_MOUNT_CHANCE].succes
		else
			szansa_sukces = tbl_szans_gdy_nil.succes
		end
	end
	if v.CHANCE.broke ~= nil and (config.OwnChanceOrRegular ~= "own") then
		szansa_broke = v.CHANCE.broke
	else
		if v.REGULAR_MOUNT_CHANCE ~= nil then
			szansa_broke = regular_mount_tbl[v.REGULAR_MOUNT_CHANCE].broke
		else
			szansa_broke = tbl_szans_gdy_nil.broke
		end
	end
	if v.CHANCE.run ~= nil and (config.OwnChanceOrRegular ~= "own") then
		szansa_run = v.CHANCE.run
	else
		if v.REGULAR_MOUNT_CHANCE ~= nil then
			szansa_run = regular_mount_tbl[v.REGULAR_MOUNT_CHANCE].run
		else
			szansa_run = tbl_szans_gdy_nil.run
		end
	end
	if v.CHANCE.attack ~= nil and (config.OwnChanceOrRegular ~= "own") then
		szansa_attack = v.CHANCE.attack
	else
		if v.REGULAR_MOUNT_CHANCE ~= nil then
			szansa_attack = regular_mount_tbl[v.REGULAR_MOUNT_CHANCE].attack
		else
			szansa_attack = tbl_szans_gdy_nil.attack
		end
	end
	
	
	
	losowanie = math.random(1,100)
	if losowanie <= szansa_sukces then
		if (v.TYPE == "MONSTER") and (config.IF_MOUNT_IS_CREATURE_REMOVE_CREATURE_IF_RUN) then
			doRemoveCreature(itemEx.uid)
		elseif (v.TYPE == "NPC") and (config.IF_MOUNT_IS_NPC_REMOVE_CREATURE_IF_RUN) then
			doRemoveCreature(itemEx.uid)
		elseif (v.TYPE == "ITEM") and (config.IF_MOUNT_IS_ITEM_REMOVE_ITEM_IF_RUN) then
			doRemoveItem(itemEx.uid, 1)
		elseif (v.TYPE == "OUTFIT") and (config.IF_MOUNT_IS_OUTFIT_REMOVE_CREATURE_IF_RUN) then
			doRemoveCreature(itemEx.uid)
		end
		doPlayerAddMount(cid, v.MOUNT_ID)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, v.TEXT.succes)
		doCreatureSay(cid, v.TEXT.succes, TALKTYPE_MONSTER_SAY)
		doSendMagicEffect(toPosition, config.EFFECT_WHEN_MOUNT_CATCH)
		doRemoveItem(item.uid, 1)	
		if v.TEXT.msg_creature_speak_succes ~= nil then
			doCreatureSay(itemEx.uid,v.TEXT.msg_creature_speak_succes, TALKTYPE_MONSTER_SAY)
		elseif v.TEXT.msg_creature_speak ~= nil then
			doCreatureSay(itemEx.uid, v.TEXT.msg_creature_speak, TALKTYPE_MONSTER_SAY)
		end
	elseif losowanie <= (szansa_sukces + szansa_broke) then
		-- item break
		doSendMagicEffect(toPosition, config.EFFECT_WHEN_ITEM_BROKE)
		doCreatureSay(cid, v.TEXT.broke, TALKTYPE_MONSTER_SAY)
		doRemoveItem(item.uid, 1)
		if v.TEXT.msg_creature_speak ~= nil then
			doCreatureSay(itemEx.uid, v.TEXT.msg_creature_speak, TALKTYPE_MONSTER_SAY)
		end
		if v.TEXT.msg_creature_speak_broke ~= nil then
			doCreatureSay(itemEx.uid,v.TEXT.msg_creature_speak_broke, TALKTYPE_MONSTER_SAY)
		end
	elseif losowanie <= (szansa_sukces + szansa_broke + szansa_run) then
		-- mount run
		if (v.TYPE == "MONSTER") and (config.IF_MOUNT_IS_CREATURE_REMOVE_CREATURE_IF_RUN) then
			doRemoveCreature(itemEx.uid)
		elseif (v.TYPE == "NPC") and (config.IF_MOUNT_IS_NPC_REMOVE_CREATURE_IF_RUN) then
			doRemoveCreature(itemEx.uid)
		elseif (v.TYPE == "ITEM") and (config.IF_MOUNT_IS_ITEM_REMOVE_ITEM_IF_RUN) then
			doRemoveItem(itemEx.uid, 1)
		elseif (v.TYPE == "OUTFIT") and (config.IF_MOUNT_IS_OUTFIT_REMOVE_CREATURE_IF_RUN) then
			doRemoveCreature(itemEx.uid)
		end
		if v.TEXT.msg_creature_speak_run ~= nil then
			doCreatureSay(itemEx.uid,v.TEXT.msg_creature_speak_run, TALKTYPE_MONSTER_SAY)
		end
		doSendMagicEffect(toPosition, config.EFFECT_WHEN_MOUNT_RUN)
		doCreatureSay(cid, v.TEXT.run, TALKTYPE_MONSTER_SAY)
	else
		-- mount attack
		doSendMagicEffect(toPosition, config.EFFECT_WHEN_MOUNT_ATTACK)
		doCreatureSay(cid, v.TEXT.attack, TALKTYPE_MONSTER_SAY)
		if v.TEXT.msg_creature_speak_attack ~= nil then
			doCreatureSay(itemEx.uid,v.TEXT.msg_creature_speak_attack, TALKTYPE_MONSTER_SAY)
		elseif v.TEXT.msg_creature_speak ~= nil then
			doCreatureSay(itemEx.uid, v.TEXT.msg_creature_speak, TALKTYPE_MONSTER_SAY)
		end
	end
	
	
	
	
	
end

return true
end




REPORT ALL BUGS, IF ANYTHING IS WRONG THEN REPORT IT, I WILL FIX PROBLEMS IF ANY BECOME.
 
Do I need to add any XML's for this script?, ill just test this on my Mystic spirit.

- - - Updated - - -

No errors on console but nothing happens when I use the item on the monster, so I need action XML's im pretty sure of it, anyone care to help?
 
XML:
	<!-- Taming Items -->
	<action itemid="5907;13247;13291-13295;13298;13305;13307;13508;13535-13539;13938-13939;13498;15545;15546;18447;18448;18449;18511;18516" event="script" value="other/taming.lua"/>
 
You may post scripts in inglish please, or post them and tell to some one PL to translate it, Thanks for your relase!
 
Back
Top