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

change item with jewelry

nips

Da.Nb
Joined
Oct 15, 2009
Messages
152
Reaction score
0
Location
Germany
Hello folks :D
I would like to ask a good scripter if this is possible;

For example I got this item
rainbow shield -> ID (8905)

And when I use it with a small emerald [2149] it will change into terran rainbow shield [8909].

And when I use small amethyst [2150] on it it change to spaking rainbow shield [8908]

and when I use small ruby on it [2147] it will change to fiery rainbow shield [8906]

And when I use small sapphire on it [2146] it will change to icy rainboiw shield [8907]

Would be awesome if anyone could script me this idea =)
(You can use the jewelry so i think its possible) xD

++rep ofcourse.. that's the least I could give ;/
 
enchanting.lua
I think
Code:
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)
        doDecayItem(itemEx.uid)
        doRemoveItem(item.uid, 1)

        doSendMagicEffect(toPosition, CONST_ME_MAGIC_RED)
        return true
    end

    if(item.itemid == 7760 and isInArray({9934, 10022}, itemEx.itemid)) then
        doTransformItem(itemEx.uid, 9933)
        doRemoveItem(item.uid, 1)

        doSendMagicEffect(toPosition, CONST_ME_MAGIC_RED)
        return true
    end

    if(isInArray(enchantableGems, item.itemid)) then
        local subtype = item.type
        if(subtype == 0) then
            subtype = 1
        end

        local mana = config.manaCost * subtype
        if(getPlayerMana(cid) < mana) then
            doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHMANA)
            return true
        end

        local soul = config.soulCost * subtype
        if(getPlayerSoul(cid) < soul) then
            doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHSOUL)
            return true
        end

        local a = table.find(enchantableGems, item.itemid)
        if(a == nil or not isInArray(enchantingAltars[a], itemEx.itemid)) then
            return false
        end

        doTransformItem(item.uid, enchantedGems[a])
        doPlayerAddMana(cid, -mana)
        doPlayerAddSoul(cid, -soul)

        doPlayerAddSpentMana(cid, mana)
        doSendMagicEffect(fromPosition, CONST_ME_HOLYDAMAGE)
        return true
    end
 
    if(isInArray(enchantedGems, item.itemid)) then
        if(not isInArray(enchantableItems, itemEx.itemid)) then
            doSendMagicEffect(fromPosition, CONST_ME_POFF)
            return false
        end

        local b = table.find(enchantedGems, item.itemid)
        if(b == nil) then
            return false
        end

        local subtype = itemEx.type
        if(not isInArray({2544, 8905}, itemEx.itemid)) then
            subtype = 1000
        end

        doTransformItem(itemEx.uid, enchantedItems[itemEx.itemid][b], subtype)
        doSendMagicEffect(getThingPos(itemEx.uid), CONST_ME_HOLYDAMAGE)
        doDecayItem(itemEx.uid)

        doRemoveItem(item.uid, 1)
        return true
    end

    return false
end
 
Okay I've been using the example but im a REAL noob in .lua functions so I tried to copy/paste this file 10x because it has only 2 examples and I don't know how to make more of these in 1 script ;/

So I wanted to ask if you could put this 2 "scripts" into one working?

Code:
local config = {
	manaCost = 300,
	soulCost = 2
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(item.itemid == 7762 and itemEx.itemid == 8906) then
		doTransformItem(itemEx.uid, 8908)
		doDecayItem(itemEx.uid)
		doRemoveItem(item.uid, 1)

		doSendMagicEffect(toPosition, CONST_ME_MAGIC_RED)
		return true
	end

	if(item.itemid == 7762 and isInArray({8909, 8909}, itemEx.itemid)) then
		doTransformItem(itemEx.uid, 8908)
		doRemoveItem(item.uid, 1)

		doSendMagicEffect(toPosition, CONST_ME_MAGIC_RED)
		return true
	end

Code:
local config = {
	manaCost = 300,
	soulCost = 2
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(item.itemid == 7762 and itemEx.itemid == 8907) then
		doTransformItem(itemEx.uid, 8908)
		doDecayItem(itemEx.uid)
		doRemoveItem(item.uid, 1)

		doSendMagicEffect(toPosition, CONST_ME_MAGIC_RED)
		return true
	end

	if(item.itemid == 7762 and isInArray({8905, 8905}, itemEx.itemid)) then
		doTransformItem(itemEx.uid, 8908)
		doRemoveItem(item.uid, 1)

		doSendMagicEffect(toPosition, CONST_ME_MAGIC_RED)
		return true
	end

Thanks I understand if you don't want to do that
I rep you already anyway because you tried to help me <3
 
Ah yeah

I just did a misstake before lol
I'm so stupid^^
thank you!

Can't rep you man else I would ;/
You're a very helpful person
 
Back
Top Bottom