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

help with enchanting

stonger

New Member
Joined
Oct 27, 2009
Messages
32
Reaction score
0
hi, i cant make the enchanting action to work. it doesnt send me error, but it doesnt work. im not good in this stuff, i dont know a lo t about this. thats why im asking for help.

my enchanting script is this one:
PHP:
local config = {
	manaCost = 300,
	soulCost = 2
}

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

	local type = item.type
	if(type == 0) then
		type = 1
	end
 
	local mana = config.manaCost * type
	local soul = config.soulCost * type
 
	if(isInArray(enchantableGems, item.itemid) == TRUE) then
		if(getPlayerMana(cid) < mana) then
			doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHMANA)
			return TRUE
		end

		if(getPlayerSoul(cid) < soul) then
			doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHSOUL)
			return TRUE
		end

		local a = 1
		for i, id in pairs(enchantableGems) do
			if(item.itemid == id) then
				a = i
			end
		end

		if(isInArray(enchantingAltars[a], itemEx.itemid) ~= TRUE or itemEx.actionid ~= 100) then
			return FALSE
		end

		doTransformItem(item.uid, enchantedGems[a])
		doPlayerAddMana(cid, -mana)
		doPlayerAddSoul(cid, -soul)
		doSendMagicEffect(fromPosition, CONST_ME_HOLYDAMAGE)
		return TRUE
	end
 
	if(isInArray(enchantedGems, item.itemid) == TRUE) then
		if(isInArray(enchantableItems, itemEx.itemid) ~= TRUE) then
			return FALSE
		end

		local b = 1
		for i, id in pairs(enchantedGems) do
			if(item.itemid == id) then
				b = i
			end
		end

		if(isInArray({2544, 8905}, itemEx.itemid) ~= TRUE) then
			itemEx.type = 1000
		end

		doTransformItem(itemEx.uid, enchantedItems[itemEx.itemid][b], itemEx.type)
		doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_HOLYDAMAGE)
		doRemoveItem(item.uid, 1)
		return TRUE
	end

	return FALSE
end

I want to make the rainbow shield to change into sparking, fiery and icy.

i dont know if i have to put something in actions.xml

please help.
 
@up
i opened constant.lua, and i have this.

PHP:
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}

i use the items that are in this script (the normal ones). I put use in the enchanted gem, the, the crosschairs appears, but when i click the weapon, in this case spike sword, it says you cant use this object.
 
Back
Top