• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action [0.3+] Obsidian knife sculpting ice and marble statues, clay lump sculpting

zbizu

Legendary OT User
Joined
Nov 22, 2010
Messages
3,329
Solutions
27
Reaction score
2,720
Location
Poland
I couldn't find such scripts anywhere, therefore I made them.
first remove obsidian id from others\skinning.lua entry from actions.xml

then add this:
Code:
	<action itemid="11339" event="script" value="claystatue.lua"/>
<action itemid="5908" event="script" value="skinning.lua"/>

claystatue.lua:
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	doRemoveItem(item.uid,1)
	local check = math.random(1,10)
	if(check < 6) then
		goblet = doPlayerAddItem(cid, 11340, 1)
		doItemSetAttribute(goblet, "description", "It was made by " .. getCreatureName(cid) .. ", whose potter skills could use some serious improvement.")
	else
		if(check < 8) then
		goblet = doPlayerAddItem(cid, 11341, 1)
		doItemSetAttribute(goblet, "description", "It was made by " .. getCreatureName(cid) .. " and is clearly a little figurine of.. hm, one does not recognise that yet.")
		else
			goblet = doPlayerAddItem(cid, 11342, 1)
			doItemSetAttribute(goblet, "description", "This little figurine of Brog, the raging Titan, was skillfully made by " .. getCreatureName(cid) .. ".")
		end
	end
	return true
end

skinning.lua
LUA:
function skinMonster(cid,item,skin)
local random = math.random(1,15)
if(random < 4) then
doPlayerAddItem(cid,skin,1)
doSendMagicEffect(getThingPos(item.uid), CONST_ME_MAGIC_GREEN)
else
doSendMagicEffect(getThingPos(item.uid), CONST_ME_BLOCKHIT)
end
doTransformItem(item.uid,item.itemid+1)
end
minotaurs = {2830, 3090, 2871, 2866, 2876}
lizards = {4259, 4262, 4256}
lizardsh = {11269, 11273, 11277, 11281, 11285}
greendragons = {3104, 2844}
reddragons = {2881}
behemoth = {2931}
bonebeast = {3031}
cube = {7441, 7444, 7445}
cube2 = {7442}
marble = {11343}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local random = math.random(1,10)
	if isInArray(minotaurs, itemEx.itemid) == TRUE then
	skinMonster(cid, itemEx, 5878)
	else
		if isInArray(lizards, itemEx.itemid) == TRUE then
		skinMonster(cid, itemEx, 5876)
		else
			if isInArray(lizardsh, itemEx.itemid) == TRUE then
			skinMonster(cid, itemEx, 5876)
			else
				if isInArray(greendragons, itemEx.itemid) == TRUE then
				skinMonster(cid, itemEx, 5877)
				else
					if isInArray(reddragons, itemEx.itemid) == TRUE then
					skinMonster(cid, itemEx, 5948)
					else
						if isInArray(behemoth, itemEx.itemid) == TRUE then
						skinMonster(cid, itemEx, 5893)
						else
							if isInArray(bonebeast, itemEx.itemid) == TRUE then
							skinMonster(cid, itemEx, 5925)
							else
								if isInArray(cube, itemEx.itemid) == TRUE and random < 4 then
								doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_HITAREA)
								doTransformItem(itemEx.uid, itemEx.itemid + 1)
								else
									if isInArray(cube2, itemEx.itemid) == TRUE and random < 4 then
									doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_HITAREA)
									doTransformItem(itemEx.uid, itemEx.itemid + 2)
									else
										if (isInArray(cube, itemEx.itemid) == TRUE or isInArray(cube2, itemEx.itemid) == TRUE) and random > 4 then
										doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_HITAREA)
										doRemoveItem(itemEx.uid)
										doCreatureSay(cid, "The attempt of sculpting failed miserably.", TALKTYPE_MONSTER)
										else
											if isInArray(marble, itemEx.itemid) == TRUE then
												doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_ICEAREA)
												doRemoveItem(itemEx.uid,1)
												local check = math.random(1,10)
												if(check < 6) then
													goblet = doPlayerAddItem(cid, 11344, 1)
													doItemSetAttribute(goblet, "description", "This shoddy work was made by " .. getCreatureName(cid) .. ".")
												else
													if(check < 8) then
													goblet = doPlayerAddItem(cid, 11345, 1)
													doItemSetAttribute(goblet, "description", "This little figurine made by " .. getCreatureName(cid) .. " has some room for improvement.")
													else
														goblet = doPlayerAddItem(cid, 11346, 1)
														doItemSetAttribute(goblet, "description", "This little figurine of Tibiasula was masterfully sculpted by " .. getCreatureName(cid) .. ".")
													end
												end
											else
											doPlayerSendDefaultCancel(cid, RETURNVALUE_CANNOTUSETHISOBJECT)
											end
										end
									end
								end
							end
						end
					end
				end
			end
		end
	end
		return true
end

@down
feel free to shorten/optimise/improve it
 
Last edited:
@down
feel free to shorten/optimise/improve it

Try
LUA:
local cfg = {
	--Minotaurs
	[2830] = { 5878, 1, 25 },
	[2866] = { 5878, 1, 25 },
	[2876] = { 5878, 1, 25 },
	[3090] = { 5878, 1, 25 },
	--Lizards
	[4256] = { 5876, 1, 25 },
	[4259] = { 5876, 1, 25 },
	[4262] = { 5876, 1, 25 },
	[11269] = { 5876, 1, 25 },
	[11273] = { 5876, 1, 25 },
	[11277] = { 5876, 1, 25 },
	[11281] = { 5876, 1, 25 },
	[11285] = { 5876, 1, 25 },
	--Green Dragons
	[2844] = { 5948, 1, 25 },
	[3104] = { 5948, 1, 25 },
	--Red Dragons
	[2881] = { 5948, 1, 25 },
	--Behemoth
	[2931] = { 5893, 1, 25 },
	--Bonebeast
	[3031] = { 5925, 1, 25 },
	--Cube
	[7441] = { 1, 25 },
	[7444] = { 1, 25 },
	[7445] = { 1, 25 },
	--Cube2
	[74442] = { 2, 25 },
	--Marble
	[11343] = {
		{ 20, 11346, "This little figurine of Tibiasula was masterfully sculpted by |NAME|." },
		{ 40, 11345, "This little figurine made by |NAME| has some room for improvement." },
		{ 60, 11344, "This shoddy work was made by |NAME|." }
	}
}

local function replaceTag(m, i)
	for search, replace in pairs(i) do
		if(replace ~= nil) then
			m = m:gsub(search, replace)
		end
	end

	return m
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local rand = math.random(1, 100)
	local ex = cfg[itemEx.itemid]

	if(not(ex))then
		return false
	end

	if(getContainerSize(itemEx.uid))then
		if(ex[3] >= rand)then
			doPlayerAddItem(cid, ex[1], ex[2])
			doSendMagicEffect(toPosition, CONST_ME_MAGIC_GREEN)
		else
			doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
		end

		doTransformItem(itemEx.uid, itemEx.itemid + 1)
	else
		if(not(ex[3]))then
			if(ex[2] >= rand)then
				doTransformItem(itemEx.uid, itemEx.itemid + ex[1])
			else
				doRemoveItem(itemEx.uid)
				doCreatureSay(cid, "The attempt of sculpting failed miserably.", TALKTYPE_MONSTER)
			end

			doSendMagicEffect(toPosition, CONST_ME_HITAREA)
		else
			doRemoveItem(itemEx.uid)
			doSendMagicEffect(toPosition, CONST_ME_ICEAREA)
			for i = 1, #ex do
				if(ex[i][1] >= rand)then
					local goblet = doPlayerAddItem(cid, ex[i][2], 1)
					local description = replaceTag(ex[i][3], { "|NAME|" = getCreatureName(cid) })
					doItemSetAttribute(goblet, "description", description)
					break
				end
			end
		end
	end

	return true
end
 
Last edited:
kk, I see, I suck at scripting ^^

what is ReplaceTag for?
isn't "This little figurine made by " .. getCreatureName(cid) .. " has some room for improvement." working in tables?

Edit: Your code doesn't work, console error says that there is something not closed in this line:
LUA:
local description = replaceTag(ex[3], { "|NAME|" = getCreatureName(cid) })
 
Last edited:
Back
Top