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

items change

ConAn Edujawa

Member
Joined
Feb 23, 2015
Messages
457
Reaction score
17
i need script
when click on weapon change from club to axe and when use again change from axe to sword and than from sword to club but don't change weapon id im.
use tfs 0.4
 
first i know this but the script i need not Transform weapons i need change weapon type like if u have sword id 7778 and used click right on weapon type change to axe but items still 7778
 
first i know this but the script i need not Transform weapons i need change weapon type like if u have sword id 7778 and used click right on weapon type change to axe but items still 7778
How is it? lOl every item got his own ID so you can't change it or duplicate any of them , sorry i can't help you that's all i know
 
doTransformItem(item.uid, itemid)
that will change it item it self. not the type.


-- NOTE below item id's are examples and i'm unsure if they are real weapons in game --
ex. it will change item 9931
to item 9932

and it doesnt give item with id 9931 the weapon type axe.
that was before weapon type sword.
 
that will change it item it self. not the type.


-- NOTE below item id's are examples and i'm unsure if they are real weapons in game --
ex. it will change item 9931
to item 9932

and it doesnt give item with id 9931 the weapon type axe.
that was before weapon type sword.
I know how to code & what functions do what, I am just not writing scripts for people anymore, and I already wrote this script for someone on the forums here some time ago so why bother writing it again.

All too often we see in support and request boards people asking for scripts to be written which have already been made a dozen times over.

So I am responding to their thread with as much effort as they put into looking for other threads that do exactly the same thing.

Btw you can use doTransformItem to transform from any item to another.

If I want to convert a blade of grass to a wall or a trash can to an mpa I can do that with doTransformItem
 
Last edited:
I know how to code & what functions do what, I am just not writing scripts for people anymore, and I already wrote this script for someone on the forums here some time ago so why bother writing it again.

All too often we see in support and request boards people asking for scripts to be written which have already been made a dozen times over.

So I am responding to their thread with as much effort as they put into looking for other threads that do exactly the same thing.

Btw you can use doTransformItem to transform from any item to another.

If I want to convert a blade of grass to a wall or a trash can to an mpa I can do that with doTransformItem
But the goal here is to change the properties of an item. not to change it for another item.
 
guys if talking about transform items i cn use script like this
Code:
local ITEM_IDS = {
[7850] = 7839,
[7838] = 7839,
[7839] = 7840,
[7840] = 7838,
[7838] = 7850,
}

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

doTransformItem(item.uid, ITEM_IDS[item.itemid])
doDecayItem(item.uid)
return true
end
but i want transform type and don't transform id
example
17:56 You see a sword (Atk:14, Def:12 +1).
It weighs 35.00 oz.
ItemID: [2376].
when transform
17:56 You see a axe (Atk:14, Def:12 +1).
It weighs 35.00 oz.
ItemID: [2376].
and same in club
 
That would work if a script just changes the attributes of the weapon but what you are looking for is not possible, the item can not change its looktype while not changing Item ID. Thats like having a carrot, smashing it in the table and hoping it'll become an apple, however the only way to make it feel like an apple is to imagine it does ;)
 
Code:
local ITEM_IDS = {
    [7850] = 7839,
    [7838] = 7839,
    [7839] = 7840,
    [7840] = 7838,
    [7838] = 7850
}

local attributes = {
    "speed",
    "attack",
    "extraAttack",
    "defense",
    "extraDefense",
    "armor",
    "breakChance",
    "hitChance",
    "maxHitChance",
    "lightLevel",
    "lightColor",
    "shootRange",
    "attackSpeed",
    "name", -- take out name if you don't want to set it with the same name
    "plural",
    "article",
    "description",
    "slotPosition",
    "wieldPosition",
    "wieldInfo",
    "weight"
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(not ITEM_IDS[item.itemid]) then
        return false
    end
    local newItem = doCreateItemEx(ITEM_IDS[item.itemid], 1)
    for i = 1, #attributes do
        if getItemAttribute(item.uid, attributes[i]) and getItemAttribute(newItem.uid, attributes[i]) then
            doItemSetAttribute(newItem.uid, attributes[i], getItemAttribute(item.uid, attributes[i]))
        end
    end
    doRemoveItem(item.uid, 1)
    doPlayerAddItemEx(cid, newItem, true)
    return true
end
 
Last edited:
Back
Top