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

Action Rusty Legs and Armor.

tarjei

Necronian Engineer
Joined
May 25, 2008
Messages
505
Reaction score
126
Location
Poland
data/actions/scripts

rustyremover.lua
Code:
-------------------------------------------------
-------------------CONFIGURE-----------------------
-------------------------------------------------

	local config = {
 			rustyarmorid = 2160,
			rustylegsid = 2148,
			rustyremoveid = 5865
			}
---------------------CHANCES------------------------
	local prizes = { 
			armors = {
				{5,2472},-- mpa
				{10,2466},-- golden armor
				{50,2487},-- crown armor
				{100,8891}, --paladin armor
				{500,2463}, --plate armor
				{800,2465}, --brass
				{850,2464}, --chain arm
				{900,2483} --studded armor


				},

			 legs ={
				 {30,2488},--crownlegs
				 {400,2477},--knight legs
				 {600,2647},--plate legs
				 {750,2478},--brass legs
				 {800,2648},--chainlegs
				 {900,2468}--studded legs

				}
			}
----------------------------------------------------------
				 		
function onUse(cid, item, fromPosition, itemEx, toPosition)

	if item.itemid == config.rustyremoveid then
		if itemEx.itemid == config.rustyarmorid then
           	 local prize1 = {}
           	 local reward1 = 0 
			for i = 1, #prizes.armors do
				prize1 = prizes.armors[i]
				rand = math.random(0,999)
			 	if  rand < prize1[1] then
                   			 reward1 = prize1[2] 
					doTransformItem(itemEx.uid, reward1)
					doSendMagicEffect(toPosition,CONST_ME_BLOCKHIT)
				break 
				elseif rand > 900 then
					doRemoveItem(itemEx.uid)
					doSendMagicEffect(toPosition,CONST_ME_POFF)
					
				break
				 end
			end

		elseif itemEx.itemid == config.rustylegsid then
           	 local prize = {}
           	 local reward = 0 
			for i = 1, #prizes.legs do
				prize = prizes.legs[i]
				rand = math.random(0,999)
			 	if rand < prize[1] then
                   			 reward = prize[2] 
					doTransformItem(itemEx.uid, reward)
					doSendMagicEffect(toPosition,CONST_ME_BLOCKHIT)
				break 
				elseif rand > 900 then
					doRemoveItem(itemEx.uid)
					doSendMagicEffect(toPosition,CONST_ME_POFF)
				break

				
				 end
			end

		else
			return FALSE
		
		end

		
	end
return TRUE
end[CODE]
[/CODE]

data/actions

actions.xml
Code:
	<action itemid="XXX" script="rustyremover.lua" />

XXX = rusty remover id

VERSION 2.

- added chance for break an armor.
- added 2 magic effects.
 
Last edited:
00:47 You see a rust remover.
It weighs 2.50 oz.
ItemID: [9930].
Position: [X: 32932] [Y: 32122] [Z: 6].


the id is here ;] thx for script I wanted to write it by myself but for sure I will test ;p
 
I dont know what is in new version of Tibia. I made it like it was writen at tibiawikia.com ;p
 
Yeah it's working but he said that because he thinks this script could be better ;]

Every script could be better ;P so if sth is working and doesn't make debug don't say "that sucks"...

I know you're great scripter but everyone need to just try. He wrote script, working script, so gratz for him :)
 
@erp0t
then why don't you release better script?

as guy up said, the script is working
 
I like to have the rusty remover 1 charge. What i do it?

Then use this script
Code:
-------------------------------------------------
-------------------CONFIGURE-----------------------
-------------------------------------------------

	local config = {
 			rustyarmorid = 2160,
			rustylegsid = 2148,
			rustyremoveid = 5865
			}
---------------------CHANCES------------------------
	local prizes = { 
			armors = {
				{5,2472},-- mpa
				{10,2466},-- golden armor
				{50,2487},-- crown armor
				{100,8891}, --paladin armor
				{500,2463}, --plate armor
				{800,2465}, --brass
				{850,2464}, --chain arm
				{900,2483} --studded armor


				},

			 legs ={
				 {30,2488},--crownlegs
				 {400,2477},--knight legs
				 {600,2647},--plate legs
				 {750,2478},--brass legs
				 {800,2648},--chainlegs
				 {900,2468}--studded legs

				}
			}
----------------------------------------------------------
				 		
function onUse(cid, item, fromPosition, itemEx, toPosition)

	if item.itemid == config.rustyremoveid then
		if itemEx.itemid == config.rustyarmorid then
           	 local prize1 = {}
           	 local reward1 = 0 
			for i = 1, #prizes.armors do
				prize1 = prizes.armors[i]
				rand = math.random(0,999)
			 	if  rand < prize1[1] then
                   			 reward1 = prize1[2] 
					doTransformItem(itemEx.uid, reward1)
                                        doRemoveItem(item.uid,1)
					doSendMagicEffect(toPosition,CONST_ME_BLOCKHIT)
				break 
				elseif rand > 900 then
					doRemoveItem(itemEx.uid)
                                        doRemoveItem(item.uid,1)
					doSendMagicEffect(toPosition,CONST_ME_POFF)
					
				break
				 end
			end

		elseif itemEx.itemid == config.rustylegsid then
           	 local prize = {}
           	 local reward = 0 
			for i = 1, #prizes.legs do
				prize = prizes.legs[i]
				rand = math.random(0,999)
			 	if rand < prize[1] then
                   			 reward = prize[2] 
					doTransformItem(itemEx.uid, reward)
                                        doRemoveItem(item.uid,1)
					doSendMagicEffect(toPosition,CONST_ME_BLOCKHIT)
				break 
				elseif rand > 900 then
					doRemoveItem(itemEx.uid)
                                        doRemoveItem(item.uid,1)
					doSendMagicEffect(toPosition,CONST_ME_POFF)
				break

				
				 end
			end

		else
			return FALSE
		
		end

		
	end
return TRUE
end
 
Last edited:
I'm not sure if it works...

Code:
--Configuration
	local config = {
 			rustyarmorid = 2160,
			rustylegsid = 2148,
			rustyremoveid = 5865
			}
--Chances
	local armors = 
				{
				{5, 2472},-- mpa
				{10, 2466},-- golden armor
				{50, 2487},-- crown armor
				{100, 8891}, --paladin armor
				{500, 2463}, --plate armor
				{800, 2465}, --brass
				{850, 2464}, --chain arm
				{900, 2483} --studded armor
				}

			local legs =
				{
				 {30, 2488},--crownlegs
				 {400, 2477},--knight legs
				 {600, 2647},--plate legs
				 {750, 2478},--brass legs
				 {800, 2648},--chainlegs
				 {900, 2468}--studded legs
				}
				 		
function onUse(cid, item, item2, fromPosition, toPosition)
	--Armor
	for k, v in ipairs(armor) do
	rand = math.random(0, 9999)
		if ((rand > k) and (item.itemid == config.rustyremoveid) and (item.item2 == config.rustyarmorid)) then
			local chance = {}
			table.insert(chance, k)
				for i = 1, #chance do
					doPlayerAddItem(cid, armors[i])
					doPlayerRemoveItem(cid, config.rustyarmorid, 1)
					doPlayerRemoveItem(cid, config.rustyremoveid, 1)
				break
                end
		else
		doSendMagicEffect(toPosition, CONST_ME_POFF)
		doPlayerRemoveItem(cid, item.uid, 1)
				end
		end
	--Legs
	for k, v in ipairs(legs) do
	rand = math.random(0, 9999)
		if ((rand > k) and (item.itemid == config.rustyremoveid) and (item.item2 == config.rustylegsid)) then
			local chance = {}
			table.insert(chance, k)
				for i = 1, #chance do
					doPlayerAddItem(cid, legs[i])
					doPlayerRemoveItem(cid, config.rustylegsid, 1)
					doPlayerRemoveItem(cid, config.rustyremoveid, 1)
	            break
	            end
		else
		doSendMagicEffect(toPosition, CONST_ME_POFF)
		doPlayerRemoveItem(cid, item.uid, 1)
				end
		end				
	end

Tprocheira
 
Last edited:
hello

hello,not work in tfs 0.2 i have error
PHP:
[03/01/2009  11:20:53] Lua Script Error: [Action Interface] 
[03/01/2009  11:20:53] data/actions/scripts/rustyremover.lua:onUse

[03/01/2009  11:20:53] data/actions/scripts/rustyremover.lua:32: bad argument #1 to 'ipairs' (table expected, got nil)
[03/01/2009  11:20:53] stack traceback:
[03/01/2009  11:20:53] 	[C]: in function 'ipairs'
[03/01/2009  11:20:53] 	data/actions/scripts/rustyremover.lua:32: in function <data/actions/scripts/rustyremover.lua:30>
 
@up
yeah :p I have everything from TibiaWiki >.>

@offtop
LOL894743!!!!!

MPA on rl:
It can only be wielded properly by knights and paladins.
 
My version. ;)
Code:
I don't maked list chance of legs because i too lazy. :P
Here is example.
[itemEx Id] = {{fromChance, toChance, rewardId}, {400, 700, 2465}, {700, 900, 2483}, {900, 1000, 2463}},
PHP:
local rustyArmors = 
{
    [9808] = {{1, 400, 2464}, {400, 700, 2465}, {700, 900, 2483}, {900, 1000, 2463}}, -- Common
    [9809] = {{1, 250, 2464}, {250, 400, 2465}, {400, 600, 2483}, {600, 850, 2463}, {850, 950, 2476}, {950, 1000, 8891}}, -- Semi-Rare
    [9810] = {{1, 250, 2465}, {250, 450, 2483}, {450, 600, 2463}, {600, 750, 2476}, {750, 850, 8891}, {850, 930, 2487}, {930, 970, 2466}, {970, 1000, 2472}}, -- Rare
}
local rustyLegs = 
{
    [9811] = {{1, 400, 2464}, {400, 700, 2465}, {700, 900, 2483}, {900, 1000, 2463}}, -- Common
    [9812] = {{1, 250, 2464}, {250, 400, 2465}, {400, 600, 2483}, {600, 850, 2463}, {850, 950, 2476}, {950, 1000, 8891}}, -- Semi-Rare
    [9813] = {{1, 250, 2465}, {250, 450, 2483}, {450, 600, 2463}, {600, 750, 2476}, {750, 850, 8891}, {850, 930, 2487}, {930, 970, 2466}, {970, 1000, 2472}}, -- Rare
}

function removeAndEffect(item, itemEx, effectType)
    doRemoveItem(item.uid, 1)
    doRemoveItem(itemEx.uid, 1)
    doSendMagicEffect(getThingPos(item.uid), effectType)
    return TRUE
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local random = math.random(1, 1300)
    if(random >= 1000) then
        removeAndEffect(item, itemEx, CONST_ME_BLOCKHIT)
        return TRUE
    end
    for i, v in pairs(rustyArmors) do
        if(itemEx.itemid == i) then
            for i = 1, table.maxn(v) do
                if(random >= v[i][1] and random < v[i][2]) then
                    items = doCreateItemEx(v[i][3])
                end
            end
            doPlayerAddItemEx(cid, items)
            removeAndEffect(item, itemEx, CONST_ME_POFF)
        end
    end
    for i, v in pairs(rustyLegs) do
        if(itemEx.itemid == i) then
            for i = 1, table.maxn(v) do
                if(random >= v[i][1] and random < v[i][2]) then
                    items = doCreateItemEx(v[i][3])
                end
            end
            doPlayerAddItemEx(cid, items)
            removeAndEffect(item, itemEx, CONST_ME_POFF)
        end
    end
    return TRUE
end
 
My version. ;)
Code:
I don't maked list chance of legs because i too lazy. :P
Here is example.
[itemEx Id] = {{fromChance, toChance, rewardId}, {400, 700, 2465}, {700, 900, 2483}, {900, 1000, 2463}},
PHP:
local rustyArmors = 
{
    [9808] = {{1, 400, 2464}, {400, 700, 2465}, {700, 900, 2483}, {900, 1000, 2463}}, -- Common
    [9809] = {{1, 250, 2464}, {250, 400, 2465}, {400, 600, 2483}, {600, 850, 2463}, {850, 950, 2476}, {950, 1000, 8891}}, -- Semi-Rare
    [9810] = {{1, 250, 2465}, {250, 450, 2483}, {450, 600, 2463}, {600, 750, 2476}, {750, 850, 8891}, {850, 930, 2487}, {930, 970, 2466}, {970, 1000, 2472}}, -- Rare
}
local rustyLegs = 
{
    [9811] = {{1, 400, 2464}, {400, 700, 2465}, {700, 900, 2483}, {900, 1000, 2463}}, -- Common
    [9812] = {{1, 250, 2464}, {250, 400, 2465}, {400, 600, 2483}, {600, 850, 2463}, {850, 950, 2476}, {950, 1000, 8891}}, -- Semi-Rare
    [9813] = {{1, 250, 2465}, {250, 450, 2483}, {450, 600, 2463}, {600, 750, 2476}, {750, 850, 8891}, {850, 930, 2487}, {930, 970, 2466}, {970, 1000, 2472}}, -- Rare
}

function removeAndEffect(item, itemEx, effectType)
    doRemoveItem(item.uid, 1)
    doRemoveItem(itemEx.uid, 1)
    doSendMagicEffect(getThingPos(item.uid), effectType)
    return TRUE
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local random = math.random(1, 1300)
    if(random >= 1000) then
        removeAndEffect(item, itemEx, CONST_ME_BLOCKHIT)
        return TRUE
    end
    for i, v in pairs(rustyArmors) do
        if(itemEx.itemid == i) then
            for i = 1, table.maxn(v) do
                if(random >= v[i][1] and random < v[i][2]) then
                    items = doCreateItemEx(v[i][3])
                end
            end
            doPlayerAddItemEx(cid, items)
            removeAndEffect(item, itemEx, CONST_ME_POFF)
        end
    end
    for i, v in pairs(rustyLegs) do
        if(itemEx.itemid == i) then
            for i = 1, table.maxn(v) do
                if(random >= v[i][1] and random < v[i][2]) then
                    items = doCreateItemEx(v[i][3])
                end
            end
            doPlayerAddItemEx(cid, items)
            removeAndEffect(item, itemEx, CONST_ME_POFF)
        end
    end
    return TRUE
end


OMG.

you rox:eek:

Great job works flawlessly ^_^
 
My version. ;)
Code:
I don't maked list chance of legs because i too lazy. :P
Here is example.
[itemEx Id] = {{fromChance, toChance, rewardId}, {400, 700, 2465}, {700, 900, 2483}, {900, 1000, 2463}},
PHP:
local rustyArmors = 
{
    [9808] = {{1, 400, 2464}, {400, 700, 2465}, {700, 900, 2483}, {900, 1000, 2463}}, -- Common
    [9809] = {{1, 250, 2464}, {250, 400, 2465}, {400, 600, 2483}, {600, 850, 2463}, {850, 950, 2476}, {950, 1000, 8891}}, -- Semi-Rare
    [9810] = {{1, 250, 2465}, {250, 450, 2483}, {450, 600, 2463}, {600, 750, 2476}, {750, 850, 8891}, {850, 930, 2487}, {930, 970, 2466}, {970, 1000, 2472}}, -- Rare
}
local rustyLegs = 
{
    [9811] = {{1, 400, 2464}, {400, 700, 2465}, {700, 900, 2483}, {900, 1000, 2463}}, -- Common
    [9812] = {{1, 250, 2464}, {250, 400, 2465}, {400, 600, 2483}, {600, 850, 2463}, {850, 950, 2476}, {950, 1000, 8891}}, -- Semi-Rare
    [9813] = {{1, 250, 2465}, {250, 450, 2483}, {450, 600, 2463}, {600, 750, 2476}, {750, 850, 8891}, {850, 930, 2487}, {930, 970, 2466}, {970, 1000, 2472}}, -- Rare
}

function removeAndEffect(item, itemEx, effectType)
    doRemoveItem(item.uid, 1)
    doRemoveItem(itemEx.uid, 1)
    doSendMagicEffect(getThingPos(item.uid), effectType)
    return TRUE
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local random = math.random(1, 1300)
    if(random >= 1000) then
        removeAndEffect(item, itemEx, CONST_ME_BLOCKHIT)
        return TRUE
    end
    for i, v in pairs(rustyArmors) do
        if(itemEx.itemid == i) then
            for i = 1, table.maxn(v) do
                if(random >= v[i][1] and random < v[i][2]) then
                    items = doCreateItemEx(v[i][3])
                end
            end
            doPlayerAddItemEx(cid, items)
            removeAndEffect(item, itemEx, CONST_ME_POFF)
        end
    end
    for i, v in pairs(rustyLegs) do
        if(itemEx.itemid == i) then
            for i = 1, table.maxn(v) do
                if(random >= v[i][1] and random < v[i][2]) then
                    items = doCreateItemEx(v[i][3])
                end
            end
            doPlayerAddItemEx(cid, items)
            removeAndEffect(item, itemEx, CONST_ME_POFF)
        end
    end
    return TRUE
end

SEVERAL BUGS!
--If you use it in any object, the object will disappear (Including walls and magic walls, teleports, plants, signs, shields, armors, legs, boots, amulets, backpacks, the same rust remover and the FLOORS, anyway.. ANY OBJECT)
--If you use it in Rusty Legs, the rusty legs will be transformed to an armor.


Hahahaha you've created the best Desintegrate Run... Item xD!
So... fix it...
 
Last edited:
Back
Top