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

Creating new item

Jalorius

Intermediate OT User
Joined
Sep 2, 2015
Messages
62
Reaction score
103
I'm really new to scripting and would like some help trying to figure out how I can make an item with the same look as another item..

for ex. Star Amulet - itemid = 2131
I would like to use this as separate necklace used in my remeres/server.

I have tried editing both Items.xml in the server database and also in the remeres database but I still haven't gotten anywhere.

What I have in both files currently is:
Code:
  <item id="18698" lookid="2131" article="a" name="Julius' Necklace">
     <attribute key="description" value="A very precious necklace that belongs to Julius." />
     <attribute key="weight" value="610" />
   </item>

Cheers~
Jal
 
I'm not sure but I think you can't do this in XML, you must open your items.otb and clone the item 2131 if you want a copy of it, also you will get a new id for your cloned item so you don't have to pick it.
 
I'm not sure but I think you can't do this in XML, you must open your items.otb and clone the item 2131 if you want a copy of it, also you will get a new id for your cloned item so you don't have to pick it.
Right it can't be done in xml
As Lava Titan said you have to edit the .otb too
Search how to duplicate items or make new ones ;)
You don't need to edit the otb.

I'm really new to scripting and would like some help trying to figure out how I can make an item with the same look as another item..
for ex. Star Amulet - itemid = 2131
I would like to use this as separate necklace used in my remeres/server.
You can achieve this with a script in lua in any distro.
 
Right it can't be done in xml

You don't need to edit the otb.


You can achieve this with a script in lua in any distro.

You can add a new item with an old item looktype using LUA? :eek:
Will it have old item OTB attributes or just looktype?
Could you please provide an example how would you do this, or if you can't show us, could you explain how it's done in LUA? For example TFS 1.X or TFS 0.4 which are the most used I guess..
 
You can add a new item with an old item looktype using LUA? :eek:
Will it have old item OTB attributes or just looktype?
Could you please provide an example how would you do this, or if you can't show us, could you explain how it's done in LUA? For example TFS 1.X or TFS 0.4 which are the most used I guess..
I won't provide an example.. I will only tell you it is possible and I have the code already written up long ago.
This community leeches enough without breaking a sweat, go learn to program and you can build simple stuff too.
 
Weird, I never heard this could be done in LUA, but will check 4sure tomorrow, also I asked if you couldnt provide the script example, if you could just explain how you done, like what files did you edit, cuz the only way I see that this can be done is creating some kind of new function idk, like I said I never heard this could be done in LUA and I know some kickass programmers who also done this on their servers but using otb item editor and not LUA...

I'm not really interested in this script since I use TFS 1.2 with 10.82 otb, theres more than enought items to use, I'm just curious cuz I wanna learn doing this, it can open me doors for way more usefull scripts than this one I guess...

I'm sure people who share their works doesn't have a gun pointed to their head to do it, they share cuz even knowing 99% of the people will just use the script even without say thanks or contributing something there will always be 1% which is open to improve those shared ideas or others who like what you can do with that syntax used to make that script and decide to start learning how to use it...

I guess when you share something you shouldn't expect anything in return.

P.S: FOR ALL THOSE WITH GUTS TO READ THIS BORING TEXT I'M POSTING, THANK YOU FOR YOUR TIME :p AND SORRY FOR MY ENGLISH SKILLS xD
 
From the beginning of this community to its present state, lua this community's servers' supporting script language has not changed much since the dawn of otland and communities like it..

If you want to learn how to write awesome code/scripts then you need to learn to program, sorry but that is just the way it is...

Each distro that comes out differs very little from the previous.. you can not learn programming logic by only utilizing a framework, which is what tfs is.. you need to learn the core language lua.
 
Last edited:
@Lava Titan
You can simply create an item with Game.createItem and set its attributes with item:setAttribute(attribute, value).

These are the attributes you can change that way:

Code:
registerEnum(ITEM_ATTRIBUTE_NONE)
registerEnum(ITEM_ATTRIBUTE_ACTIONID)
registerEnum(ITEM_ATTRIBUTE_UNIQUEID)
registerEnum(ITEM_ATTRIBUTE_DESCRIPTION)
registerEnum(ITEM_ATTRIBUTE_TEXT)
registerEnum(ITEM_ATTRIBUTE_DATE)
registerEnum(ITEM_ATTRIBUTE_WRITER)
registerEnum(ITEM_ATTRIBUTE_NAME)
registerEnum(ITEM_ATTRIBUTE_ARTICLE)
registerEnum(ITEM_ATTRIBUTE_PLURALNAME)
registerEnum(ITEM_ATTRIBUTE_WEIGHT)
registerEnum(ITEM_ATTRIBUTE_ATTACK)
registerEnum(ITEM_ATTRIBUTE_DEFENSE)
registerEnum(ITEM_ATTRIBUTE_EXTRADEFENSE)
registerEnum(ITEM_ATTRIBUTE_ARMOR)
registerEnum(ITEM_ATTRIBUTE_HITCHANCE)
registerEnum(ITEM_ATTRIBUTE_SHOOTRANGE)
registerEnum(ITEM_ATTRIBUTE_OWNER)
registerEnum(ITEM_ATTRIBUTE_DURATION)
registerEnum(ITEM_ATTRIBUTE_DECAYSTATE)
registerEnum(ITEM_ATTRIBUTE_CORPSEOWNER)
registerEnum(ITEM_ATTRIBUTE_CHARGES)
registerEnum(ITEM_ATTRIBUTE_FLUIDTYPE)
registerEnum(ITEM_ATTRIBUTE_DOORID)

If you want more complex stuff, like skill bonus or regeneration bonus, you will have to use onEquip events to add/remove the correct conditions.

And by the way, Lua is not an acronym. It's a Portuguese noun that stands for Moon, and as such should not be written as "LUA".
 
And by the way, Lua is not an acronym. It's a Portuguese noun that stands for Moon, and as such should not be written as "LUA".
I know it is not an acronym.. where did i say it was?

Oh i see.. just because he capitalized it does not mean its an acronym, normally acronym's are indicated when you use periods after each letter, but i guess it really doesn't matter.
 
I know it is not an acronym.. where did i say it was?
I wasn't referring to you.

Back to topic, I don't think it is a good idea to have two items sharing the same spriteId (clientId), there would be no way for the server to know which item the client is referring to, since the client only knows about the clientId.

This is a function that wouldn't work as intended if an item shared the same spriteId:
Code:
const ItemType& Items::getItemIdByClientId(uint16_t spriteId) const
{
    auto it = reverseItemMap.find(spriteId);
    if (it != reverseItemMap.end()) {
        return getItemType(it->second);
    }
    return items.front();
}
 
@Lava Titan
You can simply create an item with Game.createItem and set its attributes with item:setAttribute(attribute, value).

These are the attributes you can change that way:

Code:
registerEnum(ITEM_ATTRIBUTE_NONE)
registerEnum(ITEM_ATTRIBUTE_ACTIONID)
registerEnum(ITEM_ATTRIBUTE_UNIQUEID)
registerEnum(ITEM_ATTRIBUTE_DESCRIPTION)
registerEnum(ITEM_ATTRIBUTE_TEXT)
registerEnum(ITEM_ATTRIBUTE_DATE)
registerEnum(ITEM_ATTRIBUTE_WRITER)
registerEnum(ITEM_ATTRIBUTE_NAME)
registerEnum(ITEM_ATTRIBUTE_ARTICLE)
registerEnum(ITEM_ATTRIBUTE_PLURALNAME)
registerEnum(ITEM_ATTRIBUTE_WEIGHT)
registerEnum(ITEM_ATTRIBUTE_ATTACK)
registerEnum(ITEM_ATTRIBUTE_DEFENSE)
registerEnum(ITEM_ATTRIBUTE_EXTRADEFENSE)
registerEnum(ITEM_ATTRIBUTE_ARMOR)
registerEnum(ITEM_ATTRIBUTE_HITCHANCE)
registerEnum(ITEM_ATTRIBUTE_SHOOTRANGE)
registerEnum(ITEM_ATTRIBUTE_OWNER)
registerEnum(ITEM_ATTRIBUTE_DURATION)
registerEnum(ITEM_ATTRIBUTE_DECAYSTATE)
registerEnum(ITEM_ATTRIBUTE_CORPSEOWNER)
registerEnum(ITEM_ATTRIBUTE_CHARGES)
registerEnum(ITEM_ATTRIBUTE_FLUIDTYPE)
registerEnum(ITEM_ATTRIBUTE_DOORID)

If you want more complex stuff, like skill bonus or regeneration bonus, you will have to use onEquip events to add/remove the correct conditions.

And by the way, Lua is not an acronym. It's a Portuguese noun that stands for Moon, and as such should not be written as "LUA".

I might have some reading problems, could you explain me which of those attributes will create an item that does not exist in items.otb and make it look for example like an AOL?

P.S: I'm sorry, I know lua is moon in Portuguese, cuz I'm Portuguese myself but when I say LUA, I'm yelling and not turning it into an acronym XD

Like I said before, sorry for my english skills :p
 
@Lava Titan
I just mentioned you are writing it wrong. Anyway, there is no such attribute, what you need to do is create an amulet of loss with Game.createItem and then change this item's attributes to whatever your "new" item should have, if it should be called Amulet of the Stars, change its name attribute to "Amulet of the Stars", and so on.

Oh i see.. just because he capitalized it does not mean its an acronym, normally acronym's are indicated when you use periods after each letter, but i guess it really doesn't matter.
Not necessarily, these are all acronyms that I doubt you have ever seen written that way: XML, HTML, NATO, UNICEF, LotR, GOT, TFS.
 
I think the creator of the post is trying to create a new item that doesn't exist in ITEMS.OTB and make it look like another item that already exists, my issue here is that Codex said this could be done in Lua, and thats messing with my head lol..

Maybe I'm the one who didn't get the request on this thread correctly?
 
@Non Sequitur @Codex NG
But if need to have another id?
And he wants to use on Remeres

I know he wants to, I was just explaining to @Lava Titan how to create an item with its own attributes that looks like an existing item. If the OP wants a new item type, then there is no other way than editing the items.otb/items.xml accordingly. And even then, having two items sharing the same clientId/spriteId isn't a good idea, for reasons previously mentioned.
 
@Lava Titan
There is no way to create an item like that in Lua, what you can do is create a "fake" item, it will have the same id but you can customize its attributes/behavior with Lua.

I know that, but the creator of the thread want's a new ID so he can use it on map editor, etc...

And @Codex NG must have misunderstood that because he's saying that could be done in Lua, or maybe I'm just dumb idk, but it's weird when I know I'm right and he comes "blalba you leechers go learn how to program" when this has nothing related to programming at all .L.O.L.
 
Well, I thank those who are actually attempting to help me with the matter. I didn't in any way think that I was leeching for a code or someone to blatantly give me the answer. I was only asking a simple question if I was going in the right direction or not. I am new to all of this scripting and I am trying to learn to the best of my knowledge and what is given to me.

As for editing my items.otb file, I may need a little assistance as I have never done anything of this sort.

Special thanks to @Non Sequitur for carrying on with the aforementioned question which I had asked.


Cheers~
Jal
 
Back
Top