• 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.0 Adding new items - copy

giddy92

New Member
Joined
Aug 8, 2014
Messages
69
Reaction score
0
I need copy some items, and make it new
Like:
Magic Plate Armor
Mystic Magic Plate Armor

The same graphic, but new attributes
How to make it?
 
Ah my bad, didn't notice the TFS version.

i will give you a general code, you'll have to put it inside a function like onUse or something

Code:
-- functions like onUse() or onSay() goes here
local original_item = Item(uid) --gets the original item by the uid
local copy_item = original_item:clone()  --clones the original item
local player = Player(cid)  --gets the player by the cid

local item_name = copy_item:getName()  --gets the name of the time

copy_item:setAttribute(ITEM_ATTRIBUTE_NAME, "Mystic "..item_name) --adds Mystic to the name of the time
copy_item:setAttribute(ITEM_ATTRIBUTE_ARMOR, 45) --sets the armor to 45

player:addItemEx(copy_item) --gives the new item to player

--end of function goes here

I made this on the fly, please tell me if you face any error :) i hope it helps and teaches you about it :D

Also here's a list of attributes
Code:
ITEM_ATTRIBUTE_NONE
ITEM_ATTRIBUTE_ACTIONID
ITEM_ATTRIBUTE_UNIQUEID
ITEM_ATTRIBUTE_DESCRIPTION
ITEM_ATTRIBUTE_TEXT
ITEM_ATTRIBUTE_DATE
ITEM_ATTRIBUTE_WRITER
ITEM_ATTRIBUTE_OWNER
ITEM_ATTRIBUTE_DURATION
ITEM_ATTRIBUTE_DECAYSTATE
ITEM_ATTRIBUTE_CORPSEOWNER
ITEM_ATTRIBUTE_CHARGES
ITEM_ATTRIBUTE_FLUIDTYPE
ITEM_ATTRIBUTE_DOORID
ITEM_ATTRIBUTE_ATTACK
ITEM_ATTRIBUTE_DEFENSE
ITEM_ATTRIBUTE_EXTRA_DEFENSE
ITEM_ATTRIBUTE_ARMOR
ITEM_ATTRIBUTE_SHOOTRANGE
ITEM_ATTRIBUTE_HITCHANCE
ITEM_ATTRIBUTE_NAME
ITEM_ATTRIBUTE_ARTICLE
 
Back
Top