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

Lua Discussion

Lava Titan

Developer
Joined
Jul 25, 2009
Messages
1,529
Solutions
1
Reaction score
85
Location
Portugal
Hello, my beloved Otland-Star @Codex NG says you can create a new item which does not exist in items.otb and assign it a old item sprite which does exist, he states that all this can be done in Lua and I want the opinion of other people, cuz this is messing with my head :(

So can anyone confirm his theory please?
 
Hello, my beloved Otland-Star @Codex NG says you can create a new item which does not exist in items.otb and assign it a old item sprite which does exist, he states that all this can be done in Lua and I want the opinion of other people, cuz this is messing with my head :(

So can anyone confirm his theory please?
lol? assign the items AID and give it different attributes.
 
I'm not sure if you read the first post, but I didn't mean I want to pick an existing item and give it different attributes, I mean actually CREATING a new item which does not exist in items.otb...

Example:

Your last ID in the items OTB is 19999, now instead of insert a new item so it will be your next item with new and last id (20000) in the items otb, you do it in Lua.
 
no you cant do it. but the result is the same... only difference is itemID, but even this could be fabricated in LUA
 
I know the result is the same but some guy created a thread saying he wanted to create a item with a NEW ID so he could use in map editor too, etc...

I told him to do this he needed to create the item in items.otb and choose there the sprite he wanted for that item, which in my opinion is 100x easier just put the sprite on the otb file than waste time making a script for that new item added in otb show that sprite.

I doubt you can create a new item in Lua with an ID that does not exist in items.otb, but @Codex NG says you can..

Not sure if trollin or just bad '-'
 
I know the result is the same but some guy created a thread saying he wanted to create a item with a NEW ID so he could use in map editor too, etc...

I told him to do this he needed to create the item in items.otb and choose there the sprite he wanted for that item, which in my opinion is 100x easier just put the sprite on the otb file than waste time making a script for that new item added in otb show that sprite.

I doubt you can create a new item in Lua with an ID that does not exist in items.otb, but @Codex NG says you can..

Not sure if trollin or just bad '-'
Once you make a script, you never have to make it again.
It prolly even takes less time that adding new item to .xml and somehow editing .dat file.

and in map editor you can also give items their action id.
 
lua script to edit items? I believe htis was succesfully accomplished in the OTClient map editor, anybody care to refer
 
That's true @whitevo but what your doing is picking an existing item and adding AID, not creating a new item (with a new ID)
 
That's true @whitevo but what your doing is picking an existing item and adding AID, not creating a new item (with a new ID)
Well I can't explain it better.

Yes its not creating new item in a means of COPY PASTING A SOME FREAKING PART OF DAT FILE AND ONLY CHANGING ITEM ID!
BUT AS I SAID YOU CAN FABRICATE THE ITEM ID IN LUA TOO!

So in other words. you have new item. Just used less resources to do it.
 
Why do you tag me?
I am not going to tell you how it is done, but I do like the idea that it has you thinking :p
 
Why do you tag me?
I am not going to tell you how it is done, but I do like the idea that it has you thinking :p
Tell me mission idea and I add it to my server.
For this mission players has to fight or do something with Skeleton warriors and or something in a certain maze area (the zone is like puzzle maze)
 
It can be done in lua if you create a lua function in the source to do that, besides with the existing lua functions it is not possible.

If I understood the question he is stating that he can create a new item with new ID, if is that what you meant then it is not possible without editing the sources.
 
This can be achieved by dividing items into 2 sections, atm what we do is asign each sprite which we load from otbm one item.
You would have to change it so that you load the sprite and give it a sprite id, where we refer the virtual item to the sprite id.
example in items.xml
Code:
<item spriteId="2400" virtualId="2400" article="a" name="magic sword">
     <attribute key="description" value="It is the Sword of Valor." />
     <attribute key="weight" value="4200" />
     <attribute key="defense" value="35" />
     <attribute key="attack" value="48" />
     <attribute key="weaponType" value="sword" />
     <attribute key="extradef" value="3" />
</item>
<item spriteId="2400" virtualId="999999" article="a" name="super mega hyper magic sword">
     <attribute key="description" value="It is the Sword of the doomed." />
     <attribute key="weight" value="44200" />
     <attribute key="defense" value="350" />
     <attribute key="attack" value="480" />
     <attribute key="weaponType" value="sword" />
     <attribute key="extradef" value="30" />
</item>
Then again we would have to call the item on creation with the virtualId instead of the sprite id.
 
This can be achieved by dividing items into 2 sections, atm what we do is asign each sprite which we load from otbm one item.
You would have to change it so that you load the sprite and give it a sprite id, where we refer the virtual item to the sprite id.
example in items.xml
Code:
<item spriteId="2400" virtualId="2400" article="a" name="magic sword">
     <attribute key="description" value="It is the Sword of Valor." />
     <attribute key="weight" value="4200" />
     <attribute key="defense" value="35" />
     <attribute key="attack" value="48" />
     <attribute key="weaponType" value="sword" />
     <attribute key="extradef" value="3" />
</item>
<item spriteId="2400" virtualId="999999" article="a" name="super mega hyper magic sword">
     <attribute key="description" value="It is the Sword of the doomed." />
     <attribute key="weight" value="44200" />
     <attribute key="defense" value="350" />
     <attribute key="attack" value="480" />
     <attribute key="weaponType" value="sword" />
     <attribute key="extradef" value="30" />
</item>
Then again we would have to call the item on creation with the virtualId instead of the sprite id.
It's not better replace OTB with JSON or a full XML parser? OTB will have no purpose if someone are willing to do it.
 
It's not better replace OTB with JSON or a full XML parser? OTB will have no purpose if someone are willing to do it.
I thought about this quite a while ago, since the current system is limited and kind of weird to manage tbh
 
Back
Top