How to Add an Item

From DSP Wiki
Jump to: navigation, search

by PrBlahBlahtson

Okay, time for a very basic and probably ugly tutorial on making items and finding appearances. If someone wants to improve it for user friendliness and formatting, feel free.

How do I make an item?

Item id: Find it on The itemid is part of the URL.

Not all tables are required. Except item_basic. item_basic is always required.

item_basic -- I'm guessing that flags handles rare/ex, and probably some other things.

item_usable -- If it's usable, it goes here. Think clusters, potions, and items that have charges.

item_armor -- The name is deceiving. If you want the item to be equipped, it must exist in this table, even if it's a weapon. Determines the level, jobs, appearance, slot(s) it can be equipped in, and what slots should be turned off in the case of 2hd weapons, or cloaks with hoods. I've never puzzled out what scriptType is for.

item_weapon -- For weapons, of course. Determines skill (h2h, sword, etc), damage type (slashing, blunt, etc), how many times it can hit (K Club, Joyeuse, etc,) the delay, and the dmg.

item_mods -- Stats go here. A list for modId can be found in /scripts/globals/status.lua.

I haven't done much with the other tables.

You can also view the Items page from the Database guide for a longer explanation of each field, and what the values mean.

One side note: if the item can be equipped and is usable, you may want to add a script to /scripts/globals/items, otherwise you're going to have an error message every time someone puts on or takes off that item. File name of the script should be, not sort_name.

How do I find an appearance/mId?

You need a GM account. If you haven't made one, make one. While a GM account is technically optional, you are wasting time without one. It's such a horrible waste of time that I won't even cover how to find them using just the database and constant server restarts.

To find an mId, you create an appearance packet (info below.) Then on a GM, you use the command @inject file name where file name is the name of the packet's file.

So how do I make an appearance packet?

You need a hex editor. I have Frhed left over from some project or another. It works and isn't obnoxious, but any hex editor should do. For hex editor novices, type on the left, not on the right. Unless you're entering a text string, then you type on the right. We're not entering text strings.

Make a file in darkstar's root directory (c:\dsp). I use things like "appearance.dat," but the file name is mostly irrelevant, as long as you remember it. You're going to be making an appearance packet. Here's how they're structured.

Packet Type Packet Number Face Race Head Body Hands Legs Feet Main Hand Off Hand Ranged/Instrument ?? Ammo?
51 0c 57 00 08 07 28 11 28 21 28 31 28 41 28 51 A1 61 00 70 00 80 00

The first four pairs (51 0c 57 00) are pretty much irrelevant for what you're doing. Just use the ones supplied. Technically, they identify the packet type and the packet number, as far as "this is the tenth packet that has been sent."

The fifth pair (08) is the face to use, while the sixth (07) is race. Race may be important with armor, because MId isn't always the same when you're messing with things like swimsuits. Why? Because male and female tarutarus use the same armor models, just a different MId when gender matters.

Every two pairs after that is a slot, in the following order: head, body, hands, legs, feet, main hand, off hand, ranged/instrument. The order is reversed, and it will be necessary to convert between base-10 and base-16. Windows Calculator in Scientific Mode (Vista and earlier) or Programmer Mode (Windows 7) can be useful for doing this. Set the calculator to Hex and enter the values in the corrected order, then click Dec to get the Base-10 value.

28 11 is actually 0x1128, except that first digit is just packet formatting, so you're left with 0x128, or 296 in base-10. This is the Summoner's Caller (Empyrean) set if you're working with armor.

For a second example, a1 61 is 0x61a1, which you trim to 0x1a1 or 417 (Nirvana.)

At the moment, armor mIds seem to go up to around 0x151/337. Weapons go up to about 0x259 or 601. There are gaps by the way, just to keep things interesting.

Simplifying the process

So yeah, checking every single mId in a substantial range sucks. Been there, done that, fixed a few dozen pieces of armor that were invisible.

Use SQL queries to simplify life. For example:

SELECT itemid, name, mId FROM item_armor WHERE slot <= 3 AND mId != 0 GROUP BY mId ORDER BY mId ASC;

That query will show you every mId currently in use for main and offhand items. Why would you do this?

If the item you're trying to create looks like a different item, now you know the mId that item uses.

If it's completely unique, then you know the mId won't be in use elsewhere. Look in the gaps. For example, Zanbato is 151 and Mukademaru is 153. Nothing's using 152 right now. We change the packet to use 98 60, @inject appearance.dat and we find... it's just another Zanbato/Hagun. The colors might be slightly different, but yeah, that's a Hagun.

Finding Monster/NPC appearances

Wooo, you're in for some fun.

Normal humanoid NPCs will use look data that's very similar to the appearance packet above. Not even kidding. Want an example? Have an example. 0x01000E0312107520663066400050006000700000. That's appearance 0e 03 12 10 75 20 66 30 66 40 and so on. The same rules apply. Decimal to hexadecimal, reverse the order of the pairs.

Humanoid NPCs with special appearances or animations (ex: Cid), as well as monsters will use something different. Bahamut is 0x0000C10500000000000000000000000000000000. 0x05C1 -> 1473. @costume 1473, poof, you're Bahamut. It's that simple. Note that some appearances will require a prefix in the first pair of 00s, such as 05 for the Fomor Thieves in CoP regions.

Quick warnings on @costume:

- @costume 0 to return to normal

- Some costumes require an animation to look right. What's interesting is that Empties in Promyvion seem to have 4 DATs for all 8 elements, so finding those animation IDs may be necessary later on. I haven't explored those yet. They may have their own appearances. (Ed: Turns out these are animationsubs)

- Due to the above, moving can sometimes show what you're costumed as, even if standing still leaves you invisible. Example: Iron Golem (heads)

- You can't use @animation on yourself while costumed :)

- Corollary: If you're already engaged when you use @costume, your appearance will be engaged.

- There are often multiple appearances for the "same" thing. For example, elementals have a set of appearances for wild elementals, and for Summoner pets. We're using the appearance for pets at the moment. Light elementals should have their orbiting spheres. There's probably three or more Carbuncles. Be aware this can happen.

- Some costumes have... interesting effects on your camera. Dualboxing or a partner is suggested. @wallhack and walking into an empty space can be useful as well, since sometimes you're in the floor/air.

- I've had some odd things happen with size after using @costume for extensive periods. We're talking an Elvaan so tall that a Mithra stood as tall as their hip. Either that or the Mithra was extremely short.

- I've found costumes all the way up to 0x94F / 2383, but I haven't really tried to find an end to it :)

- The groupings seem to be somewhat similar to AltanaViewer and Model_Viewer, although they're not necessarily identical. That may help you by finding something that's in the right neighborhood at least.

- Just to really twist the knife, some costumes will only display when you use @costume 0 to return to your normal appearance. An example of this is the Fomor costumes such as 1022. Those appearances have a prefix, which may be related.