How to add a new item
There are many items in the game of Rappelz. Maybe you want to add a new piece of loot from a mob? Or you need a quest item that the player needs to collect? No matter what, you’ll eventually need to add new items to the game and this is the guide for that!
Steps we will take
- Add a new item to the Arcadia db.
- Understand the necessary parts of the
ItemResourcetable to create a new item - Learn how to add a new icon to the game client.
- Load up our changes in our client
Understanding the ItemResource Table
The ItemResource table contains all the items in Rappelz. It has many columns that can be confusing for beginners, but I will explain the essential columns needed to create a simple item.
| Column | Description |
|---|---|
| id | Item ID, must be unique for each item. When adding a new item, simply find a unique ID. |
| name_id | Link to StringResource.Code, so when adding an item name, you must add it to StringResource and set the Code in name_id (conventionally name_id is 10000000 + Item_ID). |
| tooltip_id | Same as name_id, but the convention is 20000000 + Item_ID. |
| wear_type | Defines which slot the item can be worn in. Set to -1 for non-equipment items. |
| rank | Item rank from 1 to 7, affects the color in chat when dropped. |
| level | Item level, usually set to 1. |
| enhance | Item enhancement level, usually set to 0. |
| use_min_level | Minimum character level to use the item. If 0, the game defaults to the value from Rank. |
| use_max_level | Maximum character level to use the item. |
| target_min_level | Minimum level of the character the item is used on. Needed for items like scrolls. |
| target_max_level | Maximum level of the character the item is used on. Needed for items like scrolls. |
| range | Range at which the item can be used on a target. |
| weight | Weight of the item. |
| price | Price of the item. |
| huntaholic_point | Item price in Gen points (relevant in Ursa shops). |
| arena_point | Item price in AP points (relevant in AP shops). |
| material | Material ID, affects the sound when the item is used, generally not important. |
| summon_id | Link to SummonResource.summon_id, useful only for creature cards. |
| item_use_flag | Bit flag defining item limitations, with a tool available to manage it. |
| available_period | Time in milliseconds; if 0, the item is not time-limited. |
| decrease_type | Type of time decrease: PERMANENT = 0, DECREASE_ON_GAME = 1, DECREASE_ALWAYS = 2. |
| drop_type | Model name displayed when the item is on the ground. |
| icon_file_name | Icon name, specified here and then added to item.spr. |
All other columns can be set to default values or 0.
SQL Query to Insert a New Item
Now that we understand the necessary columns, let’s create our first item using the following SQL query. This query will create a template item, which you can then edit as needed.
DECLARE @NewID INT;DECLARE @NewNameID INT;DECLARE @NewTooltipID INT;
-- Find the first available IDSELECT @NewID = ISNULL(MAX(id), 600000) + 1 FROM Arcadia.dbo.ItemResource;
-- Calculate name_id and tooltip_id based on the new IDSET @NewNameID = 10000000 + @NewID;SET @NewTooltipID = 20000000 + @NewID;
-- Insert new item recordINSERT INTO Arcadia.dbo.ItemResource ( id, name_id, tooltip_id, type, [group], class, wear_type, set_id, set_part_flag, grade, rank, [level], enhance, socket, status_flag, limit_deva, limit_asura, limit_gaia, job_depth, limit_fighter, limit_hunter, limit_magician, limit_summoner, use_min_level, use_max_level, target_min_level, target_max_level, [range], weight, price, huntaholic_point, arena_point, ethereal_durability, endurance, material, summon_id, item_use_flag, available_period, decrease_type, throw_range, base_type_0, base_var1_0, base_var2_0, base_type_1, base_var1_1, base_var2_1, base_type_2, base_var1_2, base_var2_2, base_type_3, base_var1_3, base_var2_3, opt_type_0, opt_var1_0, opt_var2_0, opt_type_1, opt_var1_1, opt_var2_1, opt_type_2, opt_var1_2, opt_var2_2, opt_type_3, opt_var1_3, opt_var2_3, effect_id, enhance_id, skill_id, state_id, state_level, state_time, cool_time, cool_time_group, model_type_dem, model_type_def, model_type_asm, model_type_asf, model_type_gam, model_type_gaf, deco_model_change, model_00, model_01, model_02, model_03, model_04, model_05, model_06, model_07, model_08, model_09, model_10, model_11, model_12, model_13, model_14, model_15, model_16, model_17, texture_filename, drop_type, icon_id, icon_file_name, script_text, [2nd_array], group_bit_set) VALUES ( @NewID, @NewNameID, @NewTooltipID, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 15, 1, 1, 1, 1, 1, 300, 0, 0, 0.00, 1.00, 10000000, 0, 0, 0, 0, 3, 0, 1090551876, 0, 0, 0.00, 0, 0.00, 0.00, 0, 0.00, 0.00, 0, 0.00, 0.00, 0, 0.00, 0.00, 0, 0.00, 0.00, 0, 0.00, 0.00, 0, 0.00, 0.00, 0, 0.00, 0.00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'drop_etc_box', 0, 'icon_item_etc_silverbar', '', 60000000, 32);
-- Insert into StringResource for the item name and tooltipINSERT INTO Arcadia.dbo.StringResource (name, group_id, code, value) VALUES('name_item_010009', 0, @NewNameID, 'ITEM NAME'); -- Replace 'ITEM NAME' with the actual item name
INSERT INTO Arcadia.dbo.StringResource (name, group_id, code, value) VALUES('name_itemtooltip_10010', 0, @NewTooltipID, '<b><size:13>#@itemname@#</b><br><size:4><br><size:10> PUT YOUR TEXT HERE <br><size:4><br><size:10>Weight : 1<br>'); -- Replace 'PUT YOUR TEXT HERE' with the actual tooltip text
-- Print the new item IDPRINT 'New Item ID: ' + CAST(@NewID AS VARCHAR);Adding the Item
Icon
To add a new icon, you need to edit the item.spr file so that the client reads this image. Assume our icon’s name is example_item.jpg. Add the following text to item.spr:
example_item1example_item.jpg0,00Seeing your changes in-game
To see the changes you’ve made in the game, you will have to generate new Resource files for your client. If you’re unsure how to do this, see our Developer quick start.
You’ll also have to edit the item.spr file and add your new icon for the basic item.
==- Where to put this new icon file?==
Generate the RDB file from ItemResource, edit item.spr, and add the icon. Patch the game using a patcher or hash these files using Rhash.exe and place them in the Resource folder in the Client Directory. Start the client and spawn the item with the command:
/run insert_item(ITEM_ID, 1)Extra Tip: NPC Lua Function to Check Item Count
Add the following dialog option to an NPC:
dlg_menu("Check my item count", "check_itemcount()")And the new function:
function check_itemcount() local OUR_NEW_ITEM_ID = 84574854 -- Example ID, put yours. local item_count = find_item(OUR_NEW_ITEM_ID)
if item_count >= 10 then private_notice('You have more than 10 items!!') else private_notice('You don't have enough items') endendFor more detailed instructions on NPC scripting, check out my other guide on NPC creation!