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

item upgrade tfs 1.2

Doomdice

The N00betarian
Joined
Jul 20, 2009
Messages
659
Reaction score
108
Location
Indiana
trying to make a tfs 1.2 script item upgrade to a item this is what i built from github trying to get the scripts & not working.

if(item:getId() == 24334) then
item:transform(24335)
return true
end
return false
end
 
Make sure to register it in actions.xml

Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
item:transform(item.itemid + 1)
return true
end
 
Make sure to register it in actions.xml

Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
item:transform(item.itemid + 1)
return true
end


function onUse(player, item, fromPosition, target, toPosition, isHotkey)
player:removeMoney(50000) < cost then
else
player:sendCancelMessage("You dont have enough money.")
item:transform(item.itemid + 1)
return false
else
player:removeMoney(50000)
item:transform(item.itemid+ 1)
return true
end

This script aint working which I read the luascript.cpp & im trying to make it where if you do not have 50k it will not upgrade
 
Last edited:
Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if not player:removeItem(2182, 1) and not player:removeItem(2190, 1) then
        player:sendCancelMessage("You dont have the req item.")
        return true
    end

    if not player:removeMoney(50000) then
        player:sendCancelMessage("You dont have enough money.")
        return true
    end

    item:transform(item.itemid + 1)
    return true
end
 
Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if not player:removeItem(2182, 1) and not player:removeItem(2190, 1) then
        player:sendCancelMessage("You dont have the req item.")
        return true
    end

    if not player:removeMoney(50000) then
        player:sendCancelMessage("You dont have enough money.")
        return true
    end

    item:transform(item.itemid + 1)
    return true
end

thanks printer for the full script I understand where i mess up on lol

but still aint fix way i want it still upgrades with the 1 item but it wont take both
 
No problem, i'm glad to help.

if not player:removeItem(2182, 1) and not player:removeItem(2190, 1) then


I know this is a simple fix but aint removing both at once it goes one at a time then upgrades i know there a " or , and ) remove but I cant seem to figure this one out
 
If you use or, then it will check one of these conditions. But if you use and. The both conditions has to be true before continue.
 
Ok i see the problem:

Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getItemCount(2182) < 1 or player:getItemCount(2190) < 1 then
        player:sendCancelMessage("You dont have the req item.")
        return true
    end

    if not player:removeMoney(5) then
        player:sendCancelMessage("You dont have enough money.")
        return true
    end

    player:removeItem(2182, 1)
    player:removeItem(2190, 1)
    item:transform(item.itemid + 1)
    return true
end

Since the removeItem get condition as true, it will remove the item and ignore the other conditions. So we have todo in this way.
 
Ok i see the problem:

Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getItemCount(2182) < 1 or player:getItemCount(2190) < 1 then
        player:sendCancelMessage("You dont have the req item.")
        return true
    end

    if not player:removeMoney(5) then
        player:sendCancelMessage("You dont have enough money.")
        return true
    end

    player:removeItem(2182, 1)
    player:removeItem(2190, 1)
    item:transform(item.itemid + 1)
    return true
end

Since the removeItem get condition as true, it will remove the item and ignore the other conditions. So we have todo in this way.

thanks for the full script made by you
 
Back
Top