- Joined
- Apr 13, 2008
- Messages
- 669
- Reaction score
- 20
Yo.
This little action script will reveal (or break) all the rusty items out there.
The base was made by AGS from OTFans / OTland , I modified it in a way, so now it is harder to get better items, instead of it being completely random. You can set the chance for the item to break on use as well as how hard it is to get the best items. The values I left as default work good for me.
TFS 0.3.x
actions.xml:
data/actions/scripts/tools/ruster.lua:
TFS 0.2.x
data/actions/scripts/tools/ruster.lua should be the same. If it doesn't work try changing getItemNameById to getItemName, otherwise I can't see the difference.
Well you can rep me if this has helped you
This little action script will reveal (or break) all the rusty items out there.
The base was made by AGS from OTFans / OTland , I modified it in a way, so now it is harder to get better items, instead of it being completely random. You can set the chance for the item to break on use as well as how hard it is to get the best items. The values I left as default work good for me.
TFS 0.3.x
actions.xml:
Code:
<action itemid="9930" event="script" value="tools/ruster.lua"/>
Code:
-- break chance on use, comes into play before any other calculations
local breakChance = 40
-- 1-100 range for difficulty. The higher it is, the less likely it is that player will get a good item
local difficulty = 50
local rustyItems = {
[9808] = {2464, 2465, 2483, 2463, 2476}, --common rusty armor
[9809] = {2464, 2465, 2483, 2463, 2476, 8891}, --semi-rare rusty armor
[9810] = {2464, 2465, 2483, 2463, 2476, 8891, 2487, 2466, 2472}, --rare rusty armor
[9811] = {2468, 2648, 2478, 2647, 2477}, --common rusty legs
[9812] = {2468, 2648, 2478, 2647, 2477, 2488}, --semi-rare rusty legs
[9813] = {2468, 2648, 2478, 2647, 2477, 2488, 2470}, --rare rusty legs
[9814] = {2511, 2510, 2530, 2509, 2513, 2515}, --common rusty shield
[9815] = {2511, 2510, 2530, 2509, 2513, 2515, 2516, 2519}, --semi-rare rusty shield
[9816] = {2511, 2510, 2530, 2509, 2513, 2515, 2516, 2519, 2520, 2514}, --rare rusty shield
[9817] = {2643, 3982, 5462, 7457}, --common rusty boots
[9818] = {2643, 3982, 5462, 7457, 2195}, --semi-rare rusty boots
[9819] = {2643, 3982, 5462, 7457, 2195, 2645}, --rare rusty boots
[9820] = {2458, 2460, 2480, 2481, 2457, 2491}, --common rusty helmet
[9821] = {2458, 2460, 2480, 2481, 2457, 2491, 2497}, --semi rare rusty helmet
[9822] = {2458, 2460, 2480, 2481, 2457, 2491, 2497, 2475, 2498} --rare rusty helmet
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if rustyItems[itemEx.itemid] ~= nil then
if math.random(100) <= breakChance then
doRemoveItem(itemEx.uid)
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You broke it.")
else
local q = #rustyItems[itemEx.itemid]
local z = rustyItems[itemEx.itemid]
local newId
for i = 1, q do
local x = math.random(100)
if (x < difficulty) then
newId = z[i]
break
elseif (i >= q) then
newId = z[q]
end
end
doTransformItem(itemEx.uid,newId)
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You removed the rust, revealing a "..getItemNameById(newId))
end
doRemoveItem(item.uid,1)
return TRUE
end
return FALSE
end
TFS 0.2.x
Code:
<action itemid="9930" script="tools/ruster.lua"/>
data/actions/scripts/tools/ruster.lua should be the same. If it doesn't work try changing getItemNameById to getItemName, otherwise I can't see the difference.
Well you can rep me if this has helped you
Last edited: