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

one error and one problem

Snow

New Member
Joined
Jan 16, 2008
Messages
381
Reaction score
0
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 = 40, 	FAIL_MSG = { {1, "x."}, {2, "x."}, {3, "The wailing widow is hissing at you."} }, SUCCESS_MSG = "You tamed the wailing widow.",
	[13298] = 	{NAME = 'Terror Bird', 			ID = 2, 	TYPE = TYPE_MONSTER, 	CHANCE = 15, 	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 have tamed the bird.",
	[5907] =        {NAME = 'Bear', 			ID = 3, 	TYPE = TYPE_MONSTER, 	CHANCE = 20, 	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 wild bear.",
	[13295] = 	{NAME = 'Black Sheep', 			ID = 4, 	TYPE = TYPE_MONSTER, 	CHANCE = 25, 	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 black sheep.",
        [13293] = 	{NAME = 'Midnight Panther', 	        ID = 5, 	TYPE = TYPE_MONSTER, 	CHANCE = 40, 	FAIL_MSG = { {1, "The panther ran away."}, {2, "x."}, {3, "The midnight panther is growling at you."} }, SUCCESS_MSG = "You have tamed the wild panther."},
	[13294] = 	{NAME = 'Draptor', 			ID = 6, 	TYPE = TYPE_MONSTER, 	CHANCE = 40, 	FAIL_MSG = { {1, "x."}, {2, "x."}, {3, "x."} }, SUCCESS_MSG = "x.",
	[13305] = 	{NAME = 'Crustacea Gigantica', 	        ID = 7, 	TYPE = TYPE_MONSTER, 	CHANCE = 40, 	FAIL_MSG = { {1, "The gigantic creature ran away."}, {2, "x."}, {3, "The gigantic creature is trying to pinch you."} }, SUCCESS_MSG = "You have tamed the gigantic creature.",
	[13292] = 	{NAME = 'Tin Lizard', 			ID = 8, 	TYPE = TYPE_NPC, 	CHANCE = 40, 	FAIL_MSG = { {1, "x."}, SUCCESS_MSG = "Krkrkrkrk     You wind up the tin lizzard.",}
	[13247] = 	{NAME = 'Boar', 			ID = 10, 	TYPE = TYPE_MONSTER, 	CHANCE = 40, 	FAIL_MSG = { {1, "x."}, {2, "x."}, {3, "The boar is refusing to obey the hunting horn."} }, SUCCESS_MSG = "You tamed the wild boar."},
	[13291] = 	{NAME = 'Undead Cavebear', 		ID = 12, 	TYPE = TYPE_MONSTER, 	CHANCE = 40, 	FAIL_MSG = { {1, "The undead bear ran away."} }, {2, "x."}, {3, "The undead cavebear is growling at you."} }, SUCCESS_MSG = "You have tamed the undead cavebear."},
	[13537] = 	{NAME = 'Donkey', 			ID = 13, 	TYPE = TYPE_MONSTER, 	CHANCE = 40, 	FAIL_MSG = { {1, "The donkey transformation suddenly wears off."}, {2, "x."}, {3, "You did not manage to feed the donkey enough apple slices."} }, SUCCESS_MSG = "Munching a large pile of apple slices tamed the donkey.",
	[13508] = 	{NAME = 'Slug', 			ID = 14, 	TYPE = TYPE_MONSTER, 	CHANCE = 40, 	FAIL_MSG = { {1, "The slug flees."}, {2, "The drug doesn't take any effect."}, {3, "The slug slips through your grasp."} }, SUCCESS_MSG = "You drugged the slug."},
	[13938] = 	{NAME = 'Uniwheel', 			ID = 15, 	TYPE = TYPE_NPC, 	CHANCE = 40, 	FAIL_MSG = { {1, "Splosh! It looks like most of the special oil this can was holding was spilt without any effect."}, SUCCESS_MSG = "Vroooomratatatatatatat.     The strange wheel seems to vibrate and slowly starts turning continuously.",}
	[13536] = 	{NAME = 'Crystal Wolf', 		ID = 16, 	TYPE = TYPE_MONSTER, 	CHANCE = 40, 	FAIL_MSG = { {1, "The crystal wolf vanished into thin air."}, {2, "Clashing on the hard crystalline surface of the wolf, the diapason breaks."}, {3, "The crystal wolf is startled by the wrong sound of the diapason."} }, SUCCESS_MSG = "The smooth sound of the diapason tamed the crystal wolf.",
	[13539] = 	{NAME = 'White Deer', 			ID = 18, 	TYPE = TYPE_MONSTER, 	CHANCE = 40, 	FAIL_MSG = { {1, "x."}, {2, "x."}, {3, "x."} }, SUCCESS_MSG = "x.",
	[13538] = 	{NAME = 'Panda', 			ID = 19, 	TYPE = TYPE_MONSTER, 	CHANCE = 40, 	FAIL_MSG = { {1, "The panda flees."}, {2, "While you were trying to soothe the panda, it ate all the remaining bamboo behind your back."}, {3, "The panda refuses to follow any of your orders."} }, SUCCESS_MSG = "You have tamed the panda.",
	[13535] = 	{NAME = 'Dromedary', 			ID = 20, 	TYPE = TYPE_MONSTER, 	CHANCE = 40, 	FAIL_MSG = { {1, "x."}, {2, "x."}, {3, "x."} }, SUCCESS_MSG = "x.",
	[13498] = 	{NAME = 'Sandstone Scorpion', 	        ID = 21, 	TYPE = TYPE_MONSTER, 	CHANCE = 40, 	FAIL_MSG = { {1, "The sandstone scorpion flees."}, {2, "x."}, {3, "The sandstone scorpion eludes the influence of the scepter."} }, SUCCESS_MSG = "You tamed the sandstone scorpion.",
	[13939] = 	{NAME = 'War Horse', 			ID = 23, 	TYPE = TYPE_MONSTER, 	CHANCE = 15, 	FAIL_MSG = { {1, "With its last strength the horse the horse runs to safety."}, {2, "The wild horse happily munches the sugar oat and runs on."}, {3, "Weeeheeeehee."} }, SUCCESS_MSG = "The horse eats the sugar oat and accepts you as its new master.",
	[15546] = 	{NAME = 'Ladybug', 			ID = 27, 	TYPE = TYPE_MONSTER, 	CHANCE = 40, 	FAIL_MSG = { {1, "x."}, {2, "x."}, {3, "x."}, SUCCESS_MSG = "x.",
        [15545] = 	{NAME = 'Manta Ray', 	                ID = 28, 	TYPE = TYPE_MONSTER, 	CHANCE = 40, 	FAIL_MSG = { {1, "x."}, {2, "x."}, {3, "x."}, SUCCESS_MSG = "x."
}

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

[1][30/6/2012 14:24:15] > Loading actions... [Error - LuaInterface::loadFile] data/actions/scripts/other/taming.lua:13: '}' expected (to close '{' at line 12) near '['
[30/6/2012 14:24:15] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/other/taming.lua)
[30/6/2012 14:24:15] data/actions/scripts/other/taming.lua:13: '}' expected (to close '{' at line 12) near '['

That's the message I get of error.

Lua:
local config = {
        timeToRemove = 180, -- seconds
		message = "You now have 3 minutes to exit this room through the teleporter. It will bring you to the next room only during his time or the teleporter will disappear",
        teleportId = 9773,
        bosses = { -- Monster Name,  Teleport Position
                ["Ushuriel"] = {  pos={ x=33157, y=31725, z=11, stackpos=1 }, aid=1001 },
				["Zugurosh"] = {  pos={ x=33123, y=31689, z=11, stackpos=1 }, aid=1002},
				["Madareth"] = {  pos={ x=33194, y=31768, z=11, stackpos=1 }, aid=1003},
                ["Annihilon"] = {  pos={ x=33200, y=31704, z=11, stackpos=1 }, aid=1005},
                ["Hellgorak"] = {  pos={ x=33107, y=31735, z=11, stackpos=1 }, aid=1006}
				},
		brothers ={
        ["Golgordan"] = {pos={ x=33235, y=31734, z=11, stackpos=1 },aid=1004, brother = "Latrivan"},
        ["Latrivan"] = {pos={ x=33235, y=31734, z=11, stackpos=1 },aid=1004, brother = "Golgordan"},
        brothersArea ={
                fromPos = {x = 33224, y = 31722, z = 11},
                toPos = {x = 33240, y = 31734, z = 11}	}	}
}
local function removal(position)
	doRemoveThing(getTileItemById(position, config.teleportId).uid, 1)
    return TRUE
end

function onKill(cid, target, lastHit)
    if(config.bosses[getCreatureName(target)]) then
		local t = config.bosses[getCreatureName(target)]
	    local teleport = doCreateItem(config.teleportId, t.pos)
		local position = t.pos
		doItemSetAttribute(teleport, "aid", t.aid)
        doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1)
		addEvent(removal, config.timeToRemove * 1000, position)
	elseif(config.brothers[getCreatureName(target)]) then
		local t = config.brothers[getCreatureName(target)]
        local brother = getCreatureByName(t.brother)
		if(isMonster(brother) == true) then
            if(isInRange(getCreaturePosition(brother), config.brothers.brothersArea.fromPos, config.brothers.brothersArea.toPos) == true) then
                return TRUE
			end
        else
			local teleport = doCreateItem(config.teleportId, t.pos)
			local position = t.pos
			doItemSetAttribute(teleport, "aid", t.aid)
			doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1)
			addEvent(removal, config.timeToRemove * 1000, position)
		end
	end
	return TRUE
end

[2]This script doesn't present error messages but it doesn't create the teleport and doesn't give this message: You now have 3 minutes to exit this room through the teleporter. It will bring you to the next room only during his time or the teleporter will disappear.

Please help someone ;/
 
i have the same inquisition script you have, and same problem, i think its cause you need to have some code in the XML's in creature scripts for all the bosses, but im not sure I hope somebody posts a fix
 
Back
Top