• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Rust remover and rusty gear

4Muki4

HOROHOROHORO
Joined
May 1, 2012
Messages
757
Reaction score
72
Hello,

i have my potions on infinite but i want to rusty remover disappear when u use it.
here script:
LUA:
local config = {
	removeOnUse = "no",
	usableOnTarget = "no", -- can be used on target? (fe. healing friend)
	splashable = "no",
	range = -1,
	realAnimation = "no", -- make text effect visible only for players in range 1x1
	multiplier = {
		health = 1.0,
		mana = 1.0
	}
}

	config.removeOnUse = getBooleanFromString(config.removeOnUse)
	config.usableOnTarget = getBooleanFromString(config.usableOnTarget)
	config.splashable = getBooleanFromString(config.splashable)
	config.realAnimation = getBooleanFromString(config.realAnimation)

local POTIONS = {
	[8704] = {empty = 7636, splash = 42, health = {50, 100}}, -- small health potion
	[7618] = {empty = 7636, splash = 42, health = {100, 200}}, -- health potion
	[7588] = {empty = 7634, splash = 42, health = {200, 400}, level = 50, vocations = {3, 4, 7, 8}, vocStr = "knights and paladins"}, -- strong health potion
	[7591] = {empty = 7635, splash = 42, health = {500, 700}, level = 80, vocations = {4, 8}, vocStr = "knights"}, -- great health potion
	[8473] = {empty = 7635, splash = 42, health = {950, 1200}, level = 130, vocations = {4, 8}, vocStr = "knights"}, -- ultimate health potion

	[7620] = {empty = 7636, splash = 47, mana = {70, 130}}, -- mana potion
	[7589] = {empty = 7634, splash = 47, mana = {110, 190}, level = 50, vocations = {1, 2, 3, 5, 6, 7}, vocStr = "sorcerers, druids and paladins"}, -- strong mana potion
	[7590] = {empty = 7635, splash = 47, mana = {200, 300}, level = 80, vocations = {1, 2, 5, 6}, vocStr = "sorcerers and druids"}, -- great mana potion

	[8472] = {empty = 7635, splash = 43, health = {200, 400}, mana = {110, 190}, level = 80, vocations = {3, 7}, vocStr = "paladins"} -- great spirit potion
}

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local potion = POTIONS[item.itemid]
	if(not potion) then
		return false
	end

	if(not isPlayer(itemEx.uid) or (not config.usableOnTarget and cid ~= itemEx.uid)) then
		if(not config.splashable) then
			return false
		end

		if(toPosition.x == CONTAINER_POSITION) then
			toPosition = getThingPosition(item.uid)
		end

		doDecayItem(doCreateItem(POOL, potion.splash, toPosition))

		if(not potion.empty or config.removeOnUse) then
			return true
		end

		if(fromPosition.x ~= CONTAINER_POSITION) then
			doCreateItem(potion.empty, fromPosition)
		else
			doPlayerAddItem(cid, potion.empty, 0)
		end

		return true
	end

	if(hasCondition(cid, CONDITION_EXHAUST)) then
		doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
		return true
	end

	if(((potion.level and getPlayerLevel(itemEx.uid) < potion.level) or (potion.vocations and not isInArray(potion.vocations, getPlayerVocation(itemEx.uid)))) and
		not getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES))
	then
		doCreatureSay(itemEx.uid, "Only " .. potion.vocStr .. (potion.level and (" of level " .. potion.level) or "") .. " or above may drink this fluid.", TALKTYPE_MONSTER)
		return true
	end

	if(config.range > 0 and cid ~= itemEx.uid and getDistanceBetween(getThingPosition(cid), getThingPosition(itemEx.uid)) > config.range) then
		return false
	end

	local health = potion.health
	if(health and not doCreatureAddHealth(itemEx.uid, math.ceil(math.random(health[1], health[2]) * config.multiplier.health))) then
		return false
	end

	local mana = potion.mana
	if(mana and not doPlayerAddMana(itemEx.uid, math.ceil(math.random(mana[1], mana[2]) * config.multiplier.mana))) then
		return false
	end

	doSendMagicEffect(getThingPosition(itemEx.uid), CONST_ME_MAGIC_BLUE)
	if(not config.realAnimation) then
		doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_MONSTER)
	else
		for i, tid in ipairs(getSpectators(getThingPosition(itemEx.uid), 1, 1)) do
			if(isPlayer(tid)) then
				doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_MONSTER, false, tid)
			end
		end
	end

	doAddCondition(cid, exhaust)
	if(not potion.empty or config.removeOnUse) then
		return true
	end

	if(fromPosition.x ~= CONTAINER_POSITION) then
		doCreateItem(potion.empty, fromPosition)
	else
		doPlayerAddItem(cid, potion.empty, 0)
	end

	return true
end
and how can i change what u get from rusty armor or etc. ?
 
Hello that is potion script not rust remover, this is rust remover script i found somewhere around this works and the config is very easy to understand I think

LUA:
-- Made by Leon Zawodowiec --
     -- Rusty Remover --
      -- Only Armors & Legs (Thanks Mooosie) --
       -- VersioN 3.0 --
        -- I don\'t let the copy of this on other forums with the exception of OTsoft.pl --        
function onUse(cid, item, frompos, item2, topos)
 
    local effect_broke = CONST_ME_BLOCKHIT
    local effect_renew = CONST_ME_FIREWORK_YELLOW
    local wylosowany = 0
    local const = item2.itemid
    local pos = getCreaturePosition(cid)
    local itemy = {
 
                    [9808] = {
                                [1] = {id = 2464, name = "Chain Armor", szansa = 33},
                                [2] = {id = 2483, name = "Scale Armor", szansa = 25},
                                [3] = {id = 2465, name = "Brass Armor", szansa = 10},
                                [4] = {id = 2463, name = "Plate Armor", szansa = 2}
                             },
 
                    [9809] = {
                                [1] = {id = 2464, name = "Chain Armor", szansa = 16},
                                [2] = {id = 2465, name = "Brass Armor", szansa = 14},
                                [3] = {id = 2483, name = "Scale Armor", szansa = 13},
                                [4] = {id = 2463, name = "Plate Armor", szansa = 10},
                                [5] = {id = 2476, name = "Knight Armor", szansa = 6},
                                [6] = {id = 8891, name = "Paladin Armor", szansa = 3},
                                [7] = {id = 2487, name = "Crown Armor", szansa = 1}
                             },
 
		    [9810] = {
                                [1] = {id = 2464, name = "Chain Armor", szansa = 20},
                                [2] = {id = 2465, name = "Brass Armor", szansa = 17},
                                [3] = {id = 2483, name = "Scale Armor", szansa = 15},
                                [4] = {id = 2463, name = "Plate Armor", szansa = 12},
                                [5] = {id = 2476, name = "Knight Armor", szansa = 10},
                                [6] = {id = 8891, name = "Paladin Armor", szansa = 5},
                                [7] = {id = 2487, name = "Crown Armor", szansa = 4},
                                [8] = {id = 2466, name = "Golden Armor", szansa = 2},
                                [9] = {id = 2472, name = "Magic Plate Armor", szansa = 1}
                             },
 
		    [9811] = {
                                [1] = {id = 2468, name = "Studded Legs", szansa = 33},
                                [2] = {id = 2648, name = "Chain Legs", szansa = 25},
                                [3] = {id = 2478, name = "Brass Legs", szansa = 10},
                                [4] = {id = 2647, name = "Plate Legs", szansa = 2}
                             },
 
                    [9812] = {
                                [1] = {id = 2468, name = "Studded Legs", szansa = 16},
                                [2] = {id = 2648, name = "Chain Legs", szansa = 14},
                                [3] = {id = 2478, name = "Brass Legs", szansa = 13},
                                [4] = {id = 2647, name = "Plate Legs", szansa = 10},
                                [5] = {id = 2477, name = "Knight Legs", szansa = 6},
                                [7] = {id = 2488, name = "Crown Legs", szansa = 1}
                             },
 
                    [9813] = {
                                [2] = {id = 2478, name = "Brass Legs", szansa = 17},
                                [4] = {id = 2647, name = "Plate Legs", szansa = 12},
                                [5] = {id = 2477, name = "Knight Legs", szansa = 10},
                                [7] = {id = 2488, name = "Crown Legs", szansa = 4},
                                [8] = {id = 2470, name = "Golden Legs", szansa = 2}
                             }
 
                }  
 
    if itemy[const] then
        local random_item = math.random(1, 100)
 
        for i = 1, #itemy[const] do
            if random_item <= itemy[const][i].szansa then
                wylosowany = i
            end
        end    
 
        if wylosowany > 0 then
            doSendMagicEffect(topos, effect_renew)
            doTransformItem(item2.uid, itemy[const][wylosowany].id)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have renewed the ".. itemy[const][wylosowany].name .." !")
            doRemoveItem(item.uid, 1)
        else
            doSendMagicEffect(topos, effect_broke)
            doRemoveItem(item2.uid, 1)
            doRemoveItem(item.uid, 1)
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your Rusty Remover has broken.")
            return 0
        end
    else
          doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Use it on Rusty Items (Common, Semi-Rare or Rare: Armors or Legs).")
        return 0
    end
return true
end

Btw if you have already rust remover script already but you don't know where it is go to /actions/actions.xml and probably starts like this <action itemid="9930"
 
If there isnt then you don't have the script, add it yourself, copy the script I sent you and save it as "rustremover.lua" in /actions/scripts/

Edit actions.xml and add:

<action itemid="9930" event="script" value="rustremover.lua"/>
 
Back
Top