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

Requesting enchanting system, read more!

Hermes

dziwki kola gramy w lola
Joined
Nov 17, 2007
Messages
1,867
Reaction score
14
Location
Poland
Hello.

Perhaps you are wondering why I'm requesting enchanting system which was made many times everywhere.

I need enchanting system which will use already made in TFS values in constant.lua:

Code:
enchantableGems = {2147, 2146, 2149, 2150}
enchantableItems = {2383, 7383, 7384, 7406, 7402, 2429, 2430, 7389, 7380, 2454, 2423, 2445, 7415, 7392, 2391, 2544, 8905}
enchantingAltars = {
	{7504, 7505, 7506, 7507},
	{7508, 7509, 7510, 7511},
	{7516, 7517, 7518, 7519},
	{7512, 7513, 7514, 7515}
}
enchantedGems = {7760, 7759, 7761, 7762}
enchantedItems = {
	[2383] = {7744, 7763, 7854, 7869},
	[7383] = {7745, 7764, 7855, 7870},
	[7384] = {7746, 7765, 7856, 7871},
	[7406] = {7747, 7766, 7857, 7872},
	[7402] = {7748, 7767, 7858, 7873},
	[2429] = {7749, 7768, 7859, 7874},
	[2430] = {7750, 7769, 7860, 7875},
	[7389] = {7751, 7770, 7861, 7876},
	[7380] = {7752, 7771, 7862, 7877},
	[2454] = {7753, 7772, 7863, 7878},
	[2423] = {7754, 7773, 7864, 7879},
	[2445] = {7755, 7774, 7865, 7880},
	[7415] = {7756, 7775, 7866, 7881},
	[7392] = {7757, 7776, 7867, 7882},
	[2391] = {7758, 7777, 7868, 7883},
	[2544] = {7840, 7839, 7850, 7838},
	[8905] = {8906, 8907, 8909, 8908}
}

Regards,
Hermes
 
PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)

	if item.itemid == 2147 then
		if itemEx.itemid == 2342 then
			doTransformItem(itemEx.uid, 2343)
			doRemoveItem(item.uid, 1)
			doSendMagicEffect(toPosition, CONST_ME_MAGIC_RED)
			return TRUE
		end
	end

	local type = item.type
	if type == 0 then
		type = 1
	end
 
	local mana = 300 * type
	local soul = 2 * type
 
	if isInArray(enchantableGems, item.itemid)== TRUE then
		for i=1, #enchantableGems do
			if item.itemid == enchantableGems[i] then
				a = i
			end
		end

		if isInArray(enchantingAltars[a], itemEx.itemid)== TRUE and itemEx.actionid == 101 then
			if getPlayerMana(cid) >= mana and getPlayerSoul(cid) >= soul then
				doTransformItem(item.uid, enchantedGems[a])
				doPlayerAddMana(cid, -mana)
				doPlayerAddSoul(cid, -soul)
				doSendMagicEffect(fromPosition, CONST_ME_HOLYDAMAGE)
			else
				doPlayerSendCancel(cid,"You dont have mana or soul points.")
			end
		else
			return 2
		end
 
	elseif isInArray(enchantedGems, item.itemid)== TRUE then
		for i=1, #enchantedGems do
			if item.itemid == enchantedGems[i] then
				b = i
			end
		end

		if isInArray(enchantableItems, itemEx.itemid)== TRUE then
			doTransformItem(itemEx.uid, eweapons[itemEx.itemid][b], 1000)
			doSendMagicEffect(fromPosition, CONST_ME_HOLYDAMAGE)
			doRemoveItem(item.uid, 1)
		else
			doPlayerSendCancel(cid, "You can't enchant this.")
		end
	else
		return FALSE
	end

	return TRUE
end

its based on someone else script (dont remember who)
 
Back
Top