StellaBellum Creating New Items - SWG-Source/swg-main GitHub Wiki

Creating a New Item

Creating a new Item begins in the Master Item data file. The Master Item file contains all items that can be referenced by an alias and handles game-necessary features auto-magically (i.e. like attaching necessary scripts and turning flags like 'unique' or reverse engineer-able on or off for each item):

datatables/item/master_item/master_item.tab

The Master Item TAB file (it's TAB delimited) has the following format and possible variables:

name	template_name	type	unique	required_level	required_skill	creation_objvars	charges	tier	value	scripts	version	can_reverse_engineer	string_name	string_detail	comments

Adding Items

We start with a simple example that will add a new belt to the game using an existing template (creating a new template is not covered here). We will use the generic Mabari belt template for this example.

item_belt_special_01	object/tangible/wearables/belt/belt_faux_mabari_generic.iff									2	200	"item.buff_worn_item"		1	Belt of the Junior Painter 	

As you see we add the script item.buff_worn_item to it which will give us the possibility to add stats to our item.

We will now add stats to our newly created belt by adding an entry to the Item Stats TAB file (duh, right?). This file obviously handles item stats, but also handles other flags that the Master Item file does not. Peruse the file to understand more about it. For now, let's get back to our belt.

Open the file datatables/item/item_stats.tab and add:

item_belt_special_01	"constitution_modified=500,agility_modified=500,strength_modified=500,staminamodified=500,precision_modified=500"									appearance/pt_heal.prt	

These are the basic steps to create a new Item.

Adding an Item with a Proc (TBD)

Adding an Item with a Buff (TBD)

Adding Items to Loot-Tables

We're not going to cover this topic here as there are many ways to add items to loot tables. The first and most obvious way is to add the item to the actual TAB file that handles loot for the NPC/Creature in question. See below how we did it for IG-88. Another method may be to add the item to the NPC's script file. You can add the item to the NPC's Java script file by using the appropriate spawn method (depending on whether you put it on the corpse or in the player's inventory or whatever is required - i.e. granting them an ability, like ITV usage, requires neither). Again, this is not covered here.

Heroic Loot Tables

Now we may want to add our item to something to actually loot it! As our loot item is pretty special we wanna add it to something special!

Lets say IG88? Just because we can beat him in two minutes ;)

For this we need to find out which Loot-Table our target NPC is using. For starters, take a look at the Creatures TAB file. This file contains all settings for individual creatures in the game. Since IG-88 is a "creature" we should find him there:

datatables/mob/creatures.tab

To find his entry, let's search for "88" in the creatures file:

heroic_ig88_ig88_rocket

Now find what loot table is assigned to him in the loottable column for IG-88's row. Take note of the formatting:

heroic/heroic:ig88

This says, "My loot table is in the heroic/heroic.tab file and I reference all tables with the 'ig88' extension."

With a little searching through the datatables/loot/loot_types filesystem tree, we find the heroic/heroic table in the following location:

datatables/loot/loot_types/heroic/heroic.tab

The format is a bit weird to understand on the first look, but, if needed, you can import the tab File directly into Excel to have a really good look at it. The tabs have to be exact later, so be careful when modifying and make sure to use a proper editor with tabs and linebreaks shown (i.e. like Notepad++). Note that this file does not contain actual references to loot, but instead contains references to additional loot tables. Considering this, we can't add our loot directly here, but if you wanted to add a new loot table for heroic instances, this would be the place.

Because of the specific "ig88" tag, we find that IG-88's loot table links to a specific other table called:

dungeon/heroic_drops:ig88

This loot table can be found in

datatables/loot/loot_items/dungeon/heroic_drops.tab

Again this file format maybe a bit confusing as it has rows for all heroic instances, but if you import them into excel you should get your head around it.

We will see the following items for IG88:

item_heroic_ig_88_head_01_01
item_heroic_ig_88_head_01_01
item_heroic_schematic_saber_03_01
item_heroic_schematic_saber_03_01
item_heroic_random_ring_01_01
item_heroic_random_ring_01_01
item_heroic_random_ring_01_02
item_heroic_random_ring_01_02
item_heroic_random_ring_01_03

Notice the duplications? Let's go over that. Basically, the system loads each item entry and sticks them into an array. Then the system uses the resulting size of that array as a calculation to figure out "how often an item drops". In this case, there are 9 items in his loot table. Which means, each single entry has a 1 in 9 chance of dropping - or basically a 1/9% chance which equates to roughly 11% and change. However, most items are listed twice. For those items, they have a double chance of dropping than normal, or a 2 in 9 chance to drop which equates to roughly a 22% chance of dropping. However, we may also have other script modifiers that would say, "do I even have a chance of looting an item" that may come into play as well so be on the look out for those in the scripts.

We have to add our new created belt now to this, as we want to increase the chances abit, we add it abit more often:

item_heroic_ig_88_head_01_01
item_heroic_ig_88_head_01_01
item_heroic_schematic_saber_03_01
item_heroic_schematic_saber_03_01
item_heroic_random_ring_01_01
item_heroic_random_ring_01_01
item_heroic_random_ring_01_02
item_heroic_random_ring_01_02
item_heroic_random_ring_01_03
item_belt_special_01
item_belt_special_01
item_belt_special_01
item_belt_special_01

Now, because we upped the amount of items in that table by 4, each entry has a 1 in 13 chance of being selected. This now affects the drop chance of ALL items in the table (we went from a 22% chance of our items to now roughly 15%) so be careful when adding new items that you don't tweak out drop chances for your players - they don't like that. We will add our belt 4 times though so its chances of dropping are now 4 in 13 (or 30% chance of dropping).

Creature Loot Tables

Let's say we want to add our belt to the Krayt Dragon's loot table because pearls get boring over time. Using the same process as above, we see the actual loot table for our Krayt Dragons are stored again in loot_types and loot_items files. The actual loot_items File for Krayt Dragons is

datatables/loot/loot_items/cash_loot/creature_cash_krayt.tab

This File is alot easier to understand then the Heroic Loot Tables we looked at first, here we can just add our belt at the bottom of the File and are done with it, but yes, drop percentages are affected here as well.

strItemType
s
item_junk_imitation_pearl_01_01
item_junk_imitation_pearl_01_01
item_junk_imitation_pearl_01_01
item_junk_imitation_pearl_01_01
item_junk_imitation_pearl_01_02
item_junk_imitation_pearl_01_02
item_belt_special_01
item_belt_special_01
item_belt_special_01
item_belt_special_01