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

TFS 1.X+ Change 25 items to other item

erikbs

Member
Joined
Jul 15, 2010
Messages
40
Reaction score
8
Hi there.

This is most likely a very simple script, but this is what i got so far:

Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    item:remove (25)
    Game.createItem(26520, 1, fromPosition)
    player:addExperience((player:getLevel()*6), true)
    return true
end

This is basically a script where you simply right-click on Iron Ore to convert it to Refined Iron.
The issue is that I want the player to need have 25 crude irons in a stack to be able to change it into 1 Refined Iron, and then remove the 25 crude irons from the stack.

Now it creates Refined Irons even if I have less then 25 crude irons in the stack. And if its less then 25, it doesnt remove any crude irons.

So what Iam asking for is for the script to check if the player has the required 25 crude irons, and if the player does NOT have the 25 crude irons, the player wount be able to convert, and maybe a message displaying saying: " You need 25 crude irons to make 1 piece of Refined Iron", and if the player HAS the 25 crude Irons it will convert them into 1 refined iron and remove the 25 crude irons.


I hope this make sense, and I hope someone is able to help me with this. :)

Much love <3
 
Back
Top