• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Equipment/Inventory Systems

Level 4
Joined
Jan 3, 2010
Messages
39
This tutorial assumes the user has basic knowledge of the Data Editor. It will cover these topics...

1. Creating Item Classes

2. Creating Item Containers

3. Adding Equipment and Inventory to a Unit

4. Creating Items


ItemTutEndResult.Jpg


Before starting, make sure that under View within the Data Editor you have "Show Table View" and "Show Advanced Values" both checked.

Note: After completing this tutorial, the buttons to open the equipment/inventory windows are on the right-hand side of the screen just above basic commands in-game.


1. Creating Classes

Item Classes are just categories used to define items. We can use them to define a certain item as a weapon, for example, then create an equipment slot that holds only weapons. For this example I'm going to create 3 item classes: Weapons, Armor, and Accessories.

From within the Data Editor select the Data Type: Item Classes. Right click within the data window and select Add Object. Under Name type "WeaponClass" and hit suggest to generate an ID. Hit OK.

ItemTut1.JPG


Create 2 more objects using the same method, but name these "ArmorClass" and "AccessoryClass".

We will reference these Item Classes later when creating new Items and Containers.



2. Creating Item Containers...

Containers are essentially backpacks, which store the items your character picks up. We will create 2 types of containers: one for Equipment and one for Inventory.

From within the Data Editor select the Data Type: Item Containers. Right click within the data window and select Add Object. Under name type "EquipmentContainer" and hit suggest to generate an ID. Hit OK.

Set the following fields of this Object to these values...

Model: Marine

Model Height: 300

Model Width: 300

ItemTut2.JPG


This defines the background of the equipment window, which in this case would display a 300x300 Marine.

Next, edit the Slots + field. This causes a new window to pop up. Click the green X (adjacent to the box labeled "Slots") to create a new slot, make sure the newly created slot is selected, then click the second green X (adjacent to the window labeled "Classes") and from the drop-down menu that appears select "WeaponClass". Next, check the box marked "Enabled" (under Equip), then set the field labeled "Column" to 0, and the field labeled "Row" to 1.

ItemTut3.JPG


This defines where the Weapon slot will appear within the equipment window and makes sure that it can only hold items of the Weapon Class.

Create 5 more slots using the same method described above, but input the following values for each slot...

Index: 1, Classes: ArmorClass, Column: 5, Equip: Enabled, Row: 1

Index: 2, Classes: AccessoryClass, Column: 1, Equip: Enabled, Row: 5

Index: 3, Classes: AccessoryClass, Column: 2, Equip: Enabled, Row: 5

Index: 4, Classes: AccessoryClass, Column: 3, Equip: Enabled, Row: 5

Index: 5, Classes: AccessoryClass, Column: 4, Equip: Enabled, Row: 5

ItemTut4.JPG


Now the equipment screen is set to have 1 weapon slot, 1 armor slot, and 4 slots to hold accessories. Hit OK.

Right click within the data window and add another object. Name this one "InventoryContainer", suggest the ID, and hit OK.

Next, edit the Slots + field. Create 16 slots (Index 0-15) for this container, but this time around NONE of the slots should have equip enabled nor should they have any defined classes. Input these values...

Index: 1, Column: 0, Row: 0

Index: 2, Column: 0, Row: 1

Index: 3, Column: 0, Row: 2

Index: 4, Column: 0, Row: 3

Index: 5, Column: 1, Row: 0

Index: 6, Column: 1, Row: 1

Index: 7, Column: 1, Row: 2

Index: 8, Column: 1, Row: 3

Index: 9, Column: 2, Row: 0

Index: 10, Column: 2, Row: 1

Index: 11, Column: 2, Row: 2

Index: 12, Column: 2, Row: 3

Index: 13, Column: 3, Row: 0

Index: 14, Column: 3, Row: 1

Index: 15, Column: 3, Row: 2

Index: 16, Column: 3, Row: 3

This will create a 4x4 container matrix, a.k.a. a 16 slot bag. Since we've left the classes of these slots undefined they can hold any type of item AND since equip has been left disabled the items held in this bag will not provide bonuses to their carrier.



3. Adding Equipment & Inventory to a Unit

From within the Data Editor select the Data Type: Buttons. Right click within the data window and select Add Object. Under name type "Inventory", hit suggest to generate an ID, and set the race to Terran. Hit OK.

Set the following fields of this Object to these values...

Alert Icon: btn-techupgrade-terran-combatshield.dds (type "combat" into the search field to find it easily)

Icon: btn-techupgrade-terran-combatshield.dds (you can copy paste the value from the Alert Icon field rather than finding it again)

Alert Tooltip: Inventory

ItemTut5.JPG


Then, create a second button object named "Equipment", hit suggest to generate an ID, and set the race to Terran. Hit OK.

Set the following fields of this Object to these values...

Alert Icon: btn-unit-terran-marine.dds (type "marine" into the search field and it's the first choice on the list)

Icon: btn-unit-terran-marine.dds (you can copy paste the value from the Alert Icon field rather than finding it again)

Alert Tooltip: Equipment

Next, from within the Data Editor select the Data Type: Abilities. Right click within the data window and select Add Object. Under name type "Inventory", hit suggest to generate an ID, set the Ability Type to Inventory, and set the race to Terran. Hit OK.

Set the following fields of this Object to these values...

Range: 2

Maximum Drop Range: 2

ItemTut6.JPG


These values adjust the distances required to pick up and drop items.

Next, edit the Info + field. This causes a new window to pop up. Click the green X (adjacent to the box labeled "Info") to create a new container, select the container, set "Alignment Field" to Left, set "Container" to EquipmentContainer, and set "Empty Face" to Equipment (the button we just created).

ItemTut7.JPG


Click the green X again, but this time set "Alignment Field" to Right, set "Container" to InventoryContainer, and set "Empty Face" to Inventory.

Now simply add this ability to a unit (the Marine, for example), place it on the map under Player 1's control, and you have a working equipment and inventory system.

Note: The size of the equipment window will automatically expand to meet the farthest row or column specified. You can go back and edit the equipment container at any time to include more slots or adjust their placement. If you have trouble visualizing how you want things to line up this may help...

ItemTut8.JPG




4. Creating Items...

Making items is somewhat of a pain. Each item requires the creation of at least 5 objects: a button, an item, a unit, an actor, and a behavior or effect. (Behaviors are used to create passive bonuses and effects can be used to create items with actively used abilities). I'll provide a general template for creating items and show how passive and actively used items differ.

Step 1 - Make a Button

From within the Data Editor select the Data Type: Buttons. Right click within the data window and select Add Object. Name the button (the same name you plan on giving the item itself), hit suggest to generate an ID, and set the race to Neutral. Hit OK.

Set the following fields of this Object...

Alert Icon: The icon you want to represent this item from within the inventory/equipment windows. (It's best to select an icon that begins with the letters 'btn'. While browsing you can hit Shift+P to preview the icons and find one you like).

Icon: Same as above.

Alert Tooltip: A description of the item, what bonuses or abilities it provides, etc.

Step 2 - Set Behaviors or Effects

This is the step with the most variance. In the case of items with passive bonuses...

From within the Data Editor select the Data Type: Behaviors. Right click within the data window and select Add Object. Name it, suggest the ID, set Behavior Type to "Buff", and set the race to neutral. Hit OK. Then modify the following fields for this object...

Behavior - Alignment: Positive

UI - Icon: Set this to the same icon you used for the item's button.

Then edit the "Behavior - Modification +" field to open a window with a list of adjustable values. Use the tabs at the top of this window to navigate and set passive bonuses. For example, I decided to set the "Movement Speed Multiplier" to 2 under the Movement tab and "Vital Max Bonus - Life" to 500 under the Unit tab.

ItemTut9.JPG


If you're making an item that is actively used instead...

From within the Data Editor select the Data Type: Effects. Right click within the data window and select Add Object. Name it, suggest the ID, and set the effect type to whatever you want it to do (there's a long list and each has a varying list of adjustable fields). For example, I set the Effect Type to "Create Unit", then set "Effect - Effect - Spawn" to Infested Swarm (Initial Set), set "Target - Location +" to Target Point, "Unit - Spawn Range" to 3, AND "Unit - Spawn Unit" to Infested Swarm Egg.

ItemTut10.JPG


Once you've set the fields of the Behavior or Effect to your liking you can move on.

Step 3 - Make an Item

From within the Data Editor select the Data Type: Items. Right click within the data window and select Add Object. Name it, suggest the ID, then for passive items leave the "Item Type" field as Generic otherwise set it to Instant or Target (depending on the sort of effect you created), and finally set the Item Class to whatever you want it to be (Accessory, Armor, etc). Hit OK. Then modify the following fields of this object...

If you're creating an item with passive bonuses modify the "Equip Behaviors" field of this object and add the behavior you just created.

If you're creating an item that is actively used modify the "Effect" field of this object and add the effect you just created.

Note: If you want your effect to have charges modify the "Effect Cost+" field then set Count Max and Count Start to the total number of charges you want the item to have, set Count Use to 1, and make sure location is set to Ability. Then modify the "Flags" field and check the box labeled "Destroy when Depleted".

For my actively used item I set the "Item Type" to target and also set the "Range" to 15 so it would fire Infested Terran Eggs from a distance.

Step 4 - Make a Unit

From within the Data Editor select the Data Type: Units. Right click within the data window and select Add Object. Name it, suggest the ID, set the Race to Neutral, and the Object Type to Item. Hit OK. Then modify the following fields for this object...

Unit - Flags: Pawnable (check this on the list of flags)

Stats - Item: Set this to the name of the item you just created.

Step 5 - Make an Actor

Now pick any actor to duplicate and then set the unitName of that actor to the name of the unit you just created (you can right click to duplicate an object and then right click again to change its name and suggest a new ID).

ItemTut11.JPG


Note: You can scale down the actor to be more item-like by modifying the Art - Scale field and changing the X, Y, Z values to decimals.

Now place your item on the map under the control of a neutral player. It should auto-equip when picked up.

View attachment EquipmentTutorial.SC2Map
 
Last edited:
Level 10
Joined
Jan 27, 2009
Messages
424
This is a very well written tutorial. +rape.
There's only one thing that I can't find for the behavior of the item: the damage field?
I mean, I found everything from movement to armor, from radars to resources...but damage!
Help is appreciated :)
 
Level 1
Joined
Jul 31, 2010
Messages
1
Ok, followed your brilliant tutorial. And everything seems to work fine.

But for some reason, the item picture in the equipment tab is plain white. Also tried making an item which spawned infested tarren, but after I'd fire them onto the ground. A white sphere-thing appears. (See picture below)

Wth.jpg


Any help would be much appriciated.
 
Last edited:
Level 9
Joined
Nov 4, 2007
Messages
931
I'm not sure why, but adding the object doesnt show me all the fields that yours does, when I add an item container, all it shows me are its editor description, name, prefix, and suffix, I even tried doing this in the example map you gave, but still it didn't work, help me out here.
Found the extra fields by messing around, honestly this editor is so convoluted, good tutorial.
 
Last edited:
Level 4
Joined
Jan 3, 2010
Messages
39
@Bommelding - You'll have to be more specific...

This is a very well written tutorial. +rape.
There's only one thing that I can't find for the behavior of the item: the damage field?
I mean, I found everything from movement to armor, from radars to resources...but damage!
Help is appreciated :)

In the Modification + field of your behavior go to the combat tab and edit one of the Damage Dealt fields such as setting Damage Dealt Fraction melee or ranged to .50 to add 50% extra damage with the behavior.

@Barakna - I've updated the tutorial and map. I wrote this during the beta so a few button images and actors needed changing to prevent them from showing up as white.
 
Last edited:
Level 4
Joined
Apr 16, 2008
Messages
80
I'm having a problem at the steps that involve the Ability: Inventory and when you add the items to the "Ability - Info+". I can't find any of the custom things I made earlier in the list to be able to choose for the Container and Empty Face. I followed all of the steps, so I have no idea why they aren't appearing -_-
 
Level 4
Joined
Jan 3, 2010
Messages
39
I'm having a problem at the steps that involve the Ability: Inventory and when you add the items to the "Ability - Info+". I can't find any of the custom things I made earlier in the list to be able to choose for the Container and Empty Face. I followed all of the steps, so I have no idea why they aren't appearing -_-

If I understand you correctly you're having trouble adding the Equipment and Inventory containers to the ability. With the Inventory ability's Info+ window open click the first green X on the side, then click on the blank string in the white box marked 'info'. With that string selected click the drop down menu marked 'container' and you should see all the objects of the Item Container type you've created (EquipmentContainer and InventoryContainer if you've followed the tutorial). If that drop down menu is empty you'll want to go back and make sure you've created Item Container objects and not something else.
 
Level 4
Joined
Apr 16, 2008
Messages
80
Wow that's weird....when I closed the map and reloaded it, then the stuff now appears.

*sigh* I hope all of the issues with this editor are resolved through some patches soon -_-

Thanks for the guide, and I hope I don't run into anymore issues ;)

EDIT: One thing I noticed (saw this in your demo map too); the marine model in the equipment inventory when you bring it up in-game is way too zoomed in. It doesn't look nice like your screenshot above. You can only see the head and part of the gun. Feet and legs are not shown. Any way to zoom out or at least control the zoom of the model in that?
 
Level 4
Joined
Jan 3, 2010
Messages
39
EDIT: One thing I noticed (saw this in your demo map too); the marine model in the equipment inventory when you bring it up in-game is way too zoomed in. It doesn't look nice like your screenshot above. You can only see the head and part of the gun. Feet and legs are not shown. Any way to zoom out or at least control the zoom of the model in that?

Changing the model height and width to 300 on the Equipment Container does the trick. The change from beta to launch versions caused a few issues with the tutorial map, but I've just updated the tutorial and uploaded a new map with corrections. Thanks for catching that.
 
Last edited:
Level 3
Joined
May 1, 2010
Messages
54
Having read and now done this tutorial it was quite useful. Pictures are "Da best" XD
Anyways, one little note/improvement. The way to OPEN the inventory should be clearly stated, preferably in red and bolded somewhere, that you have to click the little icons right above your unit abilities. If it's there, I missed it, thus bound to happen to others.
 
Level 4
Joined
Apr 16, 2008
Messages
80
If you have a weapon equipped (and only one weapon equip slot), and then you pick up another weapon, will you drop the first weapon and equip the second? Or will the second weapon go into your inventory (and NOT provide bonuses)?

I hope there is a way to be able to do the latter. Being able to keep equipment in your inventory until you want to equip it would be handy. Rather than just having an inventory for non-equipable items.
 
Level 4
Joined
Jan 3, 2010
Messages
39
@TheOverWhelming - Good idea, just added that note to the tutorial.

@I-am-murloc - I'll look into that.

If you have a weapon equipped (and only one weapon equip slot), and then you pick up another weapon, will you drop the first weapon and equip the second? Or will the second weapon go into your inventory (and NOT provide bonuses)?

I hope there is a way to be able to do the latter. Being able to keep equipment in your inventory until you want to equip it would be handy. Rather than just having an inventory for non-equipable items.

The new piece of equipment will go directly to inventory if all equipment slots of that type are full and it will not provide bonuses from within the inventory using this method, just as you would expect.
 
Last edited:
Level 2
Joined
Jun 4, 2007
Messages
11
Very nice. Was looking for this tutorial.
@gaby-boy : Really ? I never tried having 2 items, but if i equip 2 of the same items, they both stack. ( meaning they both work )
If i want to equip a weapon, say a Phoenix's ion cannons, will it replace the weapon on my unit ?
 
Top