• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction Enchant Gems

xxgoosexx

GoosioOT
Joined
Jul 10, 2007
Messages
298
Reaction score
2
Code:
local egem = {7759,7760,7761,7762}
local gems = {2146,2147,2149,2150}
function onSay(cid, words, param)
	if string.find(param," ",string.find(param,"[ice,fire,earth,energy]")+1) ~= nil then      
		etype = string.sub(param,0,string.find(param," ")-1)
		amount = tonumber(string.sub(param,string.find(param," ")+1,string.len(param)))
	else
		etype = param
		amount = 1
	end
	mana = amount * 200
	soul = amount * 3
		if etype == "ice" then
			gtype = 1
		elseif etype == "fire" then
			gtype = 2
		elseif etype == "earth" then
			gtype = 3
		elseif etype == "energy" then
			gtype = 4
		else
		 	doPlayerSendCancel(cid,"Please type a correct elemental type (ice/fire/earth/energy)")
		end
	if getPlayerMana(cid) > mana then
		if getPlayerSoul(cid) > soul then
			if gtype >= 1 then
				if doPlayerRemoveItem(cid,gems[gtype],amount) == TRUE then
					doPlayerAddItem(cid,egem[gtype],amount)
					doSendMagicEffect(getCreaturePosition(cid),39)
					doPlayerAddMana(cid, -mana)
					doPlayerAddSoul(cid, -soul)
				else
					doPlayerSendCancel(cid,"You do not have the correct gem or amount to do this.")
				end
			end
		else
			doPlayerSendCancel(cid,"You do not have enough soul to do this (3 soul per gem).")
		end
	else
		doPlayerSendCancel(cid,"You do not have enough mana for this (200 mana per gem).")
	end		
end

enchant multiple gems at once assuming you have enough soul/mana

Example:: !enchant "ice 99 or !enchant "ice
 
it seems to works, but it always say that is required souls or mana, can you explain me how to use it?
thnx
 
it seems to works, but it always say that is required souls or mana, can you explain me how to use it?
thnx

u need 200 mana and 3 soul to enchant 1 gem as it is written, this can be changed by changing lines 11/12 (if i counted right), if u do more than 1 gem at a time then u need to have 200* the amount of gems mana and 3* the amount of gems soul
 
could u make same but enchanting gems by using portals? then enchanted gems use on weapon and thats it :>
 
Would it be better to just write conjure spells?;PP the same result and much easier ;P

i know its a bit late, yea it would be alot easier, but this way i can do like more than XX amount at a time unless the conjure spell
 
it's suck
use it:
actions.xml
Code:
<!-- Weapon Enchanting -->
	<action itemid="2146" event="script" value="other/enchanting.lua" />
	<action itemid="2147" event="script" value="other/enchanting.lua" />
	<action itemid="2150" event="script" value="other/enchanting.lua" />
	<action itemid="2149" event="script" value="other/enchanting.lua" />
	<action itemid="7759" event="script" value="other/enchanting.lua" />
	<action itemid="7760" event="script" value="other/enchanting.lua" />
	<action itemid="7761" event="script" value="other/enchanting.lua" />
	<action itemid="7762" event="script" value="other/enchanting.lua" />
enchanting.lua
Code:
function onUse(cid, item, frompos, item2, topos)
local gems = {2146, 2147, 2149, 2150}
local egems = {7759, 7760, 7761, 7762}
local altars = {{7508, 7509, 7510, 7511}, {7504, 7505, 7506, 7507}, {7516, 7517, 7518, 7519}, {7512, 7513, 7514, 7515}}
local weapons = {2383, 7384, 7389, 7406, 7402, 2429, 2430, 2435, 7380, 2454, 2423, 2445, 7415, 7392, 2391, 2544, 8905, 2342, 9934}
local eweapons = {{7763, 7744, 7854, 7869}, {7765, 7746, 7856, 7871}, {7770, 7751, 7861, 7876}, {7766, 7747, 7857, 7872}, {7767, 7748, 7858, 7873}, {7768, 7749, 7859, 7874}, {7769, 7750, 7860, 7875}, {7770, 7751, 7861, 7876}, {7771, 7752, 7862, 7877}, {7772, 7753, 7863, 7878}, {7773, 7754, 7864, 7879}, {7774, 7755, 7865, 7880}, {7775, 7756, 7866, 7881}, {7776, 7757, 7867, 7882}, {7777, 7758, 7868, 7883}, {7839, 7840, 7838, 7850}, {8907, 8906, 8909, 8908}, {2342, 2343, 2342, 2342}, {9934,9933,9934,9934}}
local type = item.type
if type == 0 then
	type = 1
end
local mana = 300 * type
local soul = 2 * type
if isInArray(gems, item.itemid)== TRUE then
	for aa=1, #gems do
		if item.itemid == gems[aa] then
			a=aa
		end
	end
if isInArray(altars[a], item2.itemid)== TRUE then
	if getPlayerMana(cid) >= mana and getPlayerSoul(cid) >= soul then
		doTransformItem(item.uid,egems[a])
		doPlayerAddMana(cid,-mana)
		doPlayerAddSoul(cid,-soul)
	doSendMagicEffect(frompos,39)
	else
		doPlayerSendCancel(cid,"You dont have mana or soul points.")
	end
else
	return 2
end
elseif isInArray(egems, item.itemid)== TRUE then
	for bb=1, #egems do
		if item.itemid == egems[bb] then
			b=bb
		end
	end
if isInArray(weapons, item2.itemid)== TRUE then
	for cc=1, #weapons do
		if item2.itemid == weapons[cc] then
			c=cc
		end
	end
	doTransformItem(item2.uid,eweapons[c][b],100)
	doSendMagicEffect(frompos,39)
	doRemoveItem(item.uid,1)
else
	doPlayerSendCancel(cid,"You can't enchant this.")
end
else
return 0
end
return 1
end
 
it's suck
use it:
actions.xml
Code:
<!-- Weapon Enchanting -->
	<action itemid="2146" event="script" value="other/enchanting.lua" />
	<action itemid="2147" event="script" value="other/enchanting.lua" />
	<action itemid="2150" event="script" value="other/enchanting.lua" />
	<action itemid="2149" event="script" value="other/enchanting.lua" />
	<action itemid="7759" event="script" value="other/enchanting.lua" />
	<action itemid="7760" event="script" value="other/enchanting.lua" />
	<action itemid="7761" event="script" value="other/enchanting.lua" />
	<action itemid="7762" event="script" value="other/enchanting.lua" />
enchanting.lua
Code:
function onUse(cid, item, frompos, item2, topos)
local gems = {2146, 2147, 2149, 2150}
local egems = {7759, 7760, 7761, 7762}
local altars = {{7508, 7509, 7510, 7511}, {7504, 7505, 7506, 7507}, {7516, 7517, 7518, 7519}, {7512, 7513, 7514, 7515}}
local weapons = {2383, 7384, 7389, 7406, 7402, 2429, 2430, 2435, 7380, 2454, 2423, 2445, 7415, 7392, 2391, 2544, 8905, 2342, 9934}
local eweapons = {{7763, 7744, 7854, 7869}, {7765, 7746, 7856, 7871}, {7770, 7751, 7861, 7876}, {7766, 7747, 7857, 7872}, {7767, 7748, 7858, 7873}, {7768, 7749, 7859, 7874}, {7769, 7750, 7860, 7875}, {7770, 7751, 7861, 7876}, {7771, 7752, 7862, 7877}, {7772, 7753, 7863, 7878}, {7773, 7754, 7864, 7879}, {7774, 7755, 7865, 7880}, {7775, 7756, 7866, 7881}, {7776, 7757, 7867, 7882}, {7777, 7758, 7868, 7883}, {7839, 7840, 7838, 7850}, {8907, 8906, 8909, 8908}, {2342, 2343, 2342, 2342}, {9934,9933,9934,9934}}
local type = item.type
if type == 0 then
	type = 1
end
local mana = 300 * type
local soul = 2 * type
if isInArray(gems, item.itemid)== TRUE then
	for aa=1, #gems do
		if item.itemid == gems[aa] then
			a=aa
		end
	end
if isInArray(altars[a], item2.itemid)== TRUE then
	if getPlayerMana(cid) >= mana and getPlayerSoul(cid) >= soul then
		doTransformItem(item.uid,egems[a])
		doPlayerAddMana(cid,-mana)
		doPlayerAddSoul(cid,-soul)
	doSendMagicEffect(frompos,39)
	else
		doPlayerSendCancel(cid,"You dont have mana or soul points.")
	end
else
	return 2
end
elseif isInArray(egems, item.itemid)== TRUE then
	for bb=1, #egems do
		if item.itemid == egems[bb] then
			b=bb
		end
	end
if isInArray(weapons, item2.itemid)== TRUE then
	for cc=1, #weapons do
		if item2.itemid == weapons[cc] then
			c=cc
		end
	end
	doTransformItem(item2.uid,eweapons[c][b],100)
	doSendMagicEffect(frompos,39)
	doRemoveItem(item.uid,1)
else
	doPlayerSendCancel(cid,"You can't enchant this.")
end
else
return 0
end
return 1
end

lol how can you say mine sucks when its basically the same thing but requires an alter hence more effort, have fun :(
 
Back
Top