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

dolls.lua

Rexanilator

New Member
Joined
Oct 3, 2009
Messages
297
Reaction score
2
My request is that on certain dolls when used - it will say something that uses the players name - such as the dread doll or the draken doll ("Hail PLAYERNAME!). Would someone please customize this code? Thanks in advance.

Code:
local DOLLS = {
	[5080] = {"Hug me."},
	[5669] = {
		"It's not winning that matters, but winning in style.",
		"Today's your lucky day. Probably.",
		"Do not meddle in the affairs of dragons, for you are crunchy and taste good with ketchup.",
		"That is one stupid question.",
		"You'll need more rum for that.",
		"Do or do not. There is no try.",
		"You should do something you always wanted to.",
		"If you walk under a ladder and it falls down on you it probably means bad luck.",
		"Never say 'oops'. Always say 'Ah, interesting!'",
		"Five steps east, fourteen steps south, two steps north and seventeen steps west!"
	},
	[6566] = {
		"Fchhhhhh!",
		"Zchhhhhh!",
		"Grooaaaaar*cough*",
		"Aaa... CHOO!",
		"You... will.... burn!!"
	},
	[6388] = {"Merry Christmas "},
	[6512] = {
		"Ho ho ho",
		"Jingle bells, jingle bells...",
		"Have you been naughty?",
		"Have you been nice?",
		"Merry Christmas!",
		"Can you stop squeezing me now... I'm starting to feel a little sick."
	},
	[8974] = {"ARE YOU PREPARED TO FACE YOUR DESTINY?"},
	[8977] = {
		"Weirdo, you're a weirdo! Actually all of you are!",
		"Pie for breakfast, pie for lunch and pie for dinner!",
		"All hail the control panel!",
		"I own, Tibiacity owns, perfect match!",
		"Hug me! Feed me! Hail me!"
	},
	[8981] = {
		"It's news to me.",
		"News, updated as infrequently as possible!",
		"Extra! Extra! Read all about it!",
		"Fresh off the press!"
	},
	[8982] = {
		"Hail TibiaNordic!",
		"So cold..",
		"Run, mammoth!"
	},
	[13031] = {
		"For zze emperor!",
		"Hail to TibiaNation!!",
		"Hail |PLAYERNAME|!!"
	},
	[13560] = {
		"Mhausheausheu! What a FAIL! Mwahaha!",
		"Hail |PLAYERNAME|! You are wearing old socks!",
		"You are so unpopular even your own shadow refuses to follow you.",
		"Have fun with FunTibia.com!"
	}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local doll = DOLLS[item.itemid]
	if(doll == nil) then
		return false
	end

	if(fromPosition.x == CONTAINER_POSITION) then
		fromPosition = getThingPosition(cid)
	end

	local random = math.random(1, table.maxn(doll))
	local sound = doll[random]
	if(item.itemid == 6566) then
		if(random == 3) then
			doSendMagicEffect(fromPosition, CONST_ME_POFF)
		elseif(random == 4) then
			doSendMagicEffect(fromPosition, CONST_ME_FIREAREA)
		elseif(random == 5) then
			doTargetCombatHealth(0, cid, COMBAT_PHYSICALDAMAGE, -1, -1, CONST_ME_EXPLOSIONHIT)
		end
	elseif(item.itemid == 5669) then
		doSendMagicEffect(fromPosition, CONST_ME_MAGIC_RED)
		doTransformItem(item.uid, item.itemid + 1)
		doDecayItem(item.uid)
	elseif(item.itemid == 6388) then
		doSendMagicEffect(fromPosition, CONST_ME_SOUND_YELLOW)
		sound = sound .. getCreatureName(cid) .. "."
	end

	doCreatureSay(cid, sound, TALKTYPE_MONSTER, false, 0, fromPosition)
	return true
end
 
@ Nevermore - it doesn't work...I tested it

@ Optus - the example is for the Dread Doll

Code:
	[13560] = {
		"Mhausheausheu! What a FAIL! Mwahaha!",
	[B][COLOR="#FF0000"]	"Hail |PLAYERNAME|! You are wearing old socks!",[/COLOR][/B]
		"You are so unpopular even your own shadow refuses to follow you.",
		"Have fun with FunTibia.com!"
	}
 
@ Nevermore - it doesn't work...I tested it

@ Optus - the example is for the Dread Doll

Code:
	[13560] = {
		"Mhausheausheu! What a FAIL! Mwahaha!",
	[B][COLOR="#FF0000"]	"Hail |PLAYERNAME|! You are wearing old socks!",[/COLOR][/B]
		"You are so unpopular even your own shadow refuses to follow you.",
		"Have fun with FunTibia.com!"
	}
instead of |PLAYERNAME| use hail "..getPlayerName(cid).."! bla bla!"
 
Lua:
local DOLLS = {
	[5080] = {"Hug me."},
	[5669] = {
		"It's not winning that matters, but winning in style.",
		"Today's your lucky day. Probably.",
		"Do not meddle in the affairs of dragons, for you are crunchy and taste good with ketchup.",
		"That is one stupid question.",
		"You'll need more rum for that.",
		"Do or do not. There is no try.",
		"You should do something you always wanted to.",
		"If you walk under a ladder and it falls down on you it probably means bad luck.",
		"Never say 'oops'. Always say 'Ah, interesting!'",
		"Five steps east, fourteen steps south, two steps north and seventeen steps west!"
	},
	[6566] = {
		"Fchhhhhh!",
		"Zchhhhhh!",
		"Grooaaaaar*cough*",
		"Aaa... CHOO!",
		"You... will.... burn!!"
	},
	[6388] = {"Merry Christmas "},
	[6512] = {
		"Ho ho ho",
		"Jingle bells, jingle bells...",
		"Have you been naughty?",
		"Have you been nice?",
		"Merry Christmas!",
		"Can you stop squeezing me now... I'm starting to feel a little sick."
	},
	[8974] = {"ARE YOU PREPARED TO FACE YOUR DESTINY?"},
	[8977] = {
		"Weirdo, you're a weirdo! Actually all of you are!",
		"Pie for breakfast, pie for lunch and pie for dinner!",
		"All hail the control panel!",
		"I own, Tibiacity owns, perfect match!",
		"Hug me! Feed me! Hail me!"
	},
	[8981] = {
		"It's news to me.",
		"News, updated as infrequently as possible!",
		"Extra! Extra! Read all about it!",
		"Fresh off the press!"
	},
	[8982] = {
		"Hail TibiaNordic!",
		"So cold..",
		"Run, mammoth!"
	},
	[13031] = {
		"For zze emperor!",
		"Hail to TibiaNation!!",
		"Hail "..getCreatureName(cid).."!!"
	},
	[13560] = {
		"Mhausheausheu! What a FAIL! Mwahaha!",
		"Hail "..getCreatureName(cid).."! You are wearing old socks!",
		"You are so unpopular even your own shadow refuses to follow you.",
		"Have fun with FunTibia.com!"
	}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local doll = DOLLS[item.itemid]
	if(doll == nil) then
		return false
	end

	if(fromPosition.x == CONTAINER_POSITION) then
		fromPosition = getThingPosition(cid)
	end

	local random = math.random(1, table.maxn(doll))
	local sound = doll[random]
	if(item.itemid == 6566) then
		if(random == 3) then
			doSendMagicEffect(fromPosition, CONST_ME_POFF)
		elseif(random == 4) then
			doSendMagicEffect(fromPosition, CONST_ME_FIREAREA)
		elseif(random == 5) then
			doTargetCombatHealth(0, cid, COMBAT_PHYSICALDAMAGE, -1, -1, CONST_ME_EXPLOSIONHIT)
		end
	elseif(item.itemid == 5669) then
		doSendMagicEffect(fromPosition, CONST_ME_MAGIC_RED)
		doTransformItem(item.uid, item.itemid + 1)
		doDecayItem(item.uid)
	elseif(item.itemid == 6388) then
		doSendMagicEffect(fromPosition, CONST_ME_SOUND_YELLOW)
		sound = sound .. getCreatureName(cid) .. "."
	end

	doCreatureSay(cid, sound, TALKTYPE_MONSTER, false, 0, fromPosition)
	return true
end
 
Supossedly I made it so it would be very easy to edit...bah nvm. Oh wait---since when "cid" can be called in a table?
 
Usually it returned "Player could not be found" for me and the only way to make it work was to put it AFTER declaring the function. Kinda odd...
 
Usually it returned "Player could not be found" for me and the only way to make it work was to put it AFTER declaring the function. Kinda odd...

Uhm yeah, but can be fixed just pasting the table 1 line down lol(inside the function).
 
kills?..
@Ratser
Yeh, my bad. it'd work anyways(should) it'd only give an error when the server starts or when actions are reloaded.
"Only" lol :D. Learning something new every day. :ninja:

I'm running 0.4 and it didn't work for me...it kills all the dolls. Sucks for me!
Try placing the table AFTER the function or go here: http://otland.net/project.php?issueid=1508 and use and edit the script from Rev 20101225. That's the original and un-'Elf'ied version of the script.
 
Last edited:
I moved "function onUse(cid, item, fromPosition, itemEx, toPosition)" to the top of the code and now the code works perfect! Thanks for all your help!!!! Rep given...
 
PHP:
local DOLLS = {
	[5080] = {"Hug me."},
	[5669] = {
		"It's not winning that matters, but winning in style.",
		"Today's your lucky day. Probably.",
		"Do not meddle in the affairs of dragons, for you are crunchy and taste good with ketchup.",
		"That is one stupid question.",
		"You'll need more rum for that.",
		"Do or do not. There is no try.",
		"You should do something you always wanted to.",
		"If you walk under a ladder and it falls down on you it probably means bad luck.",
		"Never say 'oops'. Always say 'Ah, interesting!'",
		"Five steps east, fourteen steps south, two steps north and seventeen steps west!"
	},
	[6566] = {
		"Fchhhhhh!",
		"Zchhhhhh!",
		"Grooaaaaar*cough*",
		"Aaa... CHOO!",
		"You... will.... burn!!"
	},
	[6388] = {"Merry Christmas "},
	[6512] = {
		"Ho ho ho",
		"Jingle bells, jingle bells...",
		"Have you been naughty?",
		"Have you been nice?",
		"Merry Christmas!",
		"Can you stop squeezing me now... I'm starting to feel a little sick."
	},
	[8974] = {"ARE YOU PREPARED TO FACE YOUR DESTINY?"},
	[8977] = {
		"Weirdo, you're a weirdo! Actually all of you are!",
		"Pie for breakfast, pie for lunch and pie for dinner!",
		"All hail the control panel!",
		"I own, Tibiacity owns, perfect match!",
		"Hug me! Feed me! Hail me!"
	},
	[8981] = {
		"It's news to me.",
		"News, updated as infrequently as possible!",
		"Extra! Extra! Read all about it!",
		"Fresh off the press!"
	},
	[8982] = {
		"Hail TibiaNordic!",
		"So cold..",
		"Run, mammoth!"
	}
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local doll = DOLLS[item.itemid]
	if(doll == nil) then
		return false
	end

	if(fromPosition.x == CONTAINER_POSITION) then
		fromPosition = getThingPosition(cid)
	end

	local random = math.random(1, table.maxn(doll))
	local sound = doll[random]
	if(item.itemid == 6566) then
		if(random == 3) then
			doSendMagicEffect(fromPosition, CONST_ME_POFF)
		elseif(random == 4) then
			doSendMagicEffect(fromPosition, CONST_ME_FIREAREA)
		elseif(random == 5) then
			doTargetCombatHealth(0, cid, COMBAT_PHYSICALDAMAGE, -1, -1, CONST_ME_EXPLOSIONHIT)
		end
	elseif(item.itemid == 5669) then
		doSendMagicEffect(fromPosition, CONST_ME_MAGIC_RED)
		doTransformItem(item.uid, item.itemid + 1)
		doDecayItem(item.uid)
	elseif(item.itemid == 6388) then
		doSendMagicEffect(fromPosition, CONST_ME_SOUND_YELLOW)
		sound = sound .. getCreatureName(cid) .. "."
	end

	doCreatureSay(cid, sound, TALKTYPE_MONSTER, false, 0, fromPosition)
	return true
end

here it work for me i use 0.4 sound = sound .. getCreatureName(cid) .. "."
 
Back
Top