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

Lua Click on armor = transform...

Joined
Jun 19, 2009
Messages
1,852
Reaction score
5
Hello!

I request a script that goes like this:

If you click on, i.e plate armor, it will transform to dragon scale armor and if you click on dragon scale armor, it will transform to a magic plate armor!

However, after you have clicked on one of the armors, you will have to wait like 3 seconds to transform again...


need this asap and you will get rep!

thanks
 
I just scripted this ALL BY MYSELF LOl

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if (item.itemid == XXXX) then
		doTransformItem(item.itemid, XXXX)
		doCreatureSay(cid, "Dragon Scale Armor!", TALKTYPE_ORANGE_1)
	elseif (item.itemid == XXXX) then
		doTransformItem(item.itemid, XXXX)
		doCreatureSay(cid, "Magic Plate Armor!", TALKTYPE_ORANGE_1)
	elseif (item.itemid) == XXXX then
		doTransformItem(iten.itemid, XXXX)
		doCreaturesay(cid, "Plate Armor!", TALKTYPE_ORANGE_1)
	end
	return true
end

however... it doesn't work :( what's wrong? The script seems to be ok for me.. when I right-click one of the armors, the server laggs and nothing happens
 
Code:
  function onUse(cid, item, fromPosition, itemEx, toPosition)
        if (item.itemid == XXXX) then
                doTransformItem(item.uid, XXXX)
                doCreatureSay(cid, "Dragon Scale Armor!", TALKTYPE_ORANGE_1)
        elseif (item.itemid == XXXX) then
                doTransformItem(item.uid, XXXX)
                doCreatureSay(cid, "Magic Plate Armor!", TALKTYPE_ORANGE_1)
        elseif (item.itemid) == XXXX then
                doTransformItem(item.uid, XXXX)
                doCreaturesay(cid, "Plate Armor!", TALKTYPE_ORANGE_1)
        end
        return true
end

Your actions.xml
Code:
 <action itemid="xxxx" event="script" value="armor.lua"/>  
 <action itemid="xxxx" event="script" value="armor.lua"/>  
 <action itemid="xxxx" event="script" value="armor.lua"/>
 
Doesn't work... the item transformation works but it laggs everytime the interval "takes place" if you know what I mean xD

example: i click on magic plate armor, it transformes to a plate armor and when i click on the plate armor, it laggs like 2~ seconds..
 
nah, no msg :s

Edit: this is probably the error in GUI:

[14/03/2010 00:56:38] [Error - Action Interface]
[14/03/2010 00:56:38] data/actions/scripts/tools/darmors.lua:eek:nUse
[14/03/2010 00:56:38] Description:
[14/03/2010 00:56:38] data/actions/scripts/tools/darmors.lua:16: attempt to index global 'cfg' (a nil value)
[14/03/2010 00:56:39] stack traceback:
[14/03/2010 00:56:39] data/actions/scripts/tools/darmors.lua:16: in function <data/actions/scripts/tools/darmors.lua:1>
 
still laggs

error in gui:

[14/03/2010 01:00:42] [Error - Action Interface]
[14/03/2010 01:00:42] data/actions/scripts/tools/darmors.lua:eek:nUse
[14/03/2010 01:00:43] Description:
[14/03/2010 01:00:43] data/actions/scripts/tools/darmors.lua:4: attempt to index global 'cfg' (a nil value)
[14/03/2010 01:00:43] stack traceback:
[14/03/2010 01:00:43] data/actions/scripts/tools/darmors.lua:4: in function <data/actions/scripts/tools/darmors.lua:1>
 
Works :thumbup:

however, when I spam right-click on the armor, it says i have to wait 3 seconds. when 1 second has passed (2 seconds left then) and if I spam right click - it goes back to three seconds.. is it supposed to be like that? just wondering :p
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local storage, exhausted = 13315, 3
	if(getPlayerStorageValue(cid, storage) > os.time()) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You must wait another " .. getPlayerStorageValue(cid, storage) - os.time() .. ' second' .. ((getPlayerStorageValue(cid, storage) - os.time()) == 1 and "" or "s") .. " to upgrade again.")
	elseif (item.itemid == 8885) then
		doTransformItem(item.uid, 8886)
		doCreatureSay(cid, "Donation Knight Armor!", TALKTYPE_ORANGE_1)
	elseif (item.itemid == 8886) then
		doTransformItem(item.uid, 8887)
		doCreatureSay(cid, "Donation Paladin Armor!", TALKTYPE_ORANGE_1)
	elseif (item.itemid) == 8887 then
		doTransformItem(item.uid, 8885)
		doCreatureSay(cid, "Donation Mage Armor!", TALKTYPE_ORANGE_1)
	end
		setPlayerStorageValue(cid, storage, os.time() + exhausted)
	return true
end
 
Back
Top