BrainBread 2

BrainBread 2

Nicht genug Bewertungen
HowTo - Creating your own Inventory Items!
Von Wuffesan
This guide will explain how the system works, and an easy step by step tutorial how to create your own inventory item for your own custom Story, Arena and or Objective map!
   
Preis verleihen
Favorisieren
Favorisiert
Entfernen
Introduction
Today, we are going to learn what inventory_item does, and what its used for. Inventory_item is used for plenty of things, such as objectives, quests or an simple item you just need to bring from A to B.

"So how do we create a custom item, and place it in the map?" you may ask, well look no further! We are now going to get into details on how to create our own item, and what we can do with them.
Step 1: Creating the map data
Intro
Before we begin, we must create our map data structure first. The map data structure is a file that will read the maps required players, level, gamemode, title, description and of course, our custom items.

Creating the data file
To begin, lets head to the root folder of BrainBread 2, and head into data/maps folder. There you will find our current ones for maps such as bbc_laststand, bba_cargo or bbd_district.


Now, lets create our own file, in this example we are using the name bbc_heavensgate. When the data file is created, we then start with the basic info:
"MapData" { "Name" "bbc_heavensgate" // The map name that the script will launch "Title" "Heaven's Gate" // The name of the map "Description" "#MAP_OFFICIAL_HEAVENSGATE_DESC" // This can be a simple string, or an universal string within brainbread2_<lang> files "arg1" "1+" // Required level "arg2" "3+" // Recommended players }
Step 2: Item Creation
Now that we created the basic info, we should now start creating our items that we can use within the game.

All items must be within the InventoryData structure to work properly in-game, without this structure your custom items will not spawn. And for each item, they need their own unique index value, so the game knows where to look.

An example of an item:
"InventoryData" { // Unique item index "1" { // The title of the item // -------------- // This will display on the inventory screen "Title" "Military Radio" // The description of the item // -------------- // This will show if you are hovering over the item on the inventory screen "ToolTip" "Powered with 40 AAA-Batteries, or a cable." // Item type // -------------- // This will tell the game which kind of item it is "Type" "1" // Item subtype // -------------- // This will tell the game which kind of subitem it is "SubType" "4" // Item rarity // -------------- // The rarity of the item "Rarity" "2" // Item level requirement // -------------- // The level required to pickup this item "LevelReq" "0" // Item weight // -------------- // This will slow down the player "Weight" "0" // Hud Icon // -------------- // Optional // This will make the item show on your HUD "HUDIconTexture" "vgui/hud/inventory/radio" // Sounds // -------------- // These sounds will play if you have picked it up, or if you don't have the enough level to pick it up "PickupSound" "ItemShared.Pickup" "DenySound" "ItemShared.Deny" // Model // -------------- // Set which model it is, and the angles & origin for the inventory screen. // You can also set which animation(s) it should play "model" { "spotlight" "1" "modelname" "models/bb2_props/computers/radio01.mdl" "origin_x" "40" "origin_y" "0" "origin_z" "0" "angles_x" "0" "angles_y" "60" "angles_z" "0" "animation" { "sequence" "idle" } } // Item Glow // -------------- // Optional // This will make the item glow "GlobalGlow" { "r" "204" "g" "204" "b" "0" "a" "255" } } }
Step 3: Hammer Time!
Alright, so now we have the data file fully setup, lets go ahead and startup Hammer Editor and place down the actual entity, force spawn our own for a certain objective and create an actual trigger for the inventory item.

Method 1; Spawn on map start
Alright, lets create the entity, and place it down on the world. After that, we need to change the Map Item property to Yes.

This will make it read the map data script, and search for the inventoryData item that has the index of 1, since we didn't change the Item ID.

Method 2; Spawn when needed
Now, lets copy the one we made and give it a name, and use point_template to make it spawn when we need it to.

Creating the Trigger
Let's create the trigger for our inventory item, and make it spawn a bucket whenever we find our item. The brush entity we should look up is trigger_inventory_check. This item will trigger OnFound whenever we enter the trigger with the needed Inventory Item it needs.

And like the actual inventory_item itself, we need to set the Map Item to Yes, and set the ID to 1 (or the Item ID you want it to find).



Video Example
Types & SubTypes
Title
Types
Sub Types
Consumables
0
0 -- Large medkit
1 -- Small medkit
3 -- Drugs
4 -- Syringe
5 -- Light Armor
6 -- Medium Armor
7 -- Heavy Armor
Objective Items
1
0 -- No Glow
1 -- Vital (No Glow)
2 -- Vital
3 -- Key (Removed when used)
4 -- Key Glow (Removed when used)
Rarity
N/A
0 -- Common
1 -- Rare
2 -- Legendary
Full Example
"MapData" { "Name" "bbc_heavensgate" "Title" "Heaven's Gate" "Description" "#MAP_OFFICIAL_HEAVENSGATE_DESC" "arg1" "1+" "arg2" "3+" "InventoryData" { "1" { "Title" "Military Radio" "ToolTip" "Powered with 40 AAA-Batteries, or a cable." "Type" "1" "SubType" "4" "Rarity" "2" "LevelReq" "0" "Weight" "0" "HUDIconTexture" "vgui/hud/inventory/radio" "PickupSound" "ItemShared.Pickup" "DenySound" "ItemShared.Deny" "model" { "spotlight" "1" "modelname" "models/bb2_props/computers/radio01.mdl" "origin_x" "40" "origin_y" "0" "origin_z" "0" "angles_x" "0" "angles_y" "60" "angles_z" "0" "animation" { "sequence" "idle" } } "GlobalGlow" { "r" "204" "g" "204" "b" "0" "a" "255" } } } }
2 Kommentare
Nyx 18. Aug. 2016 um 0:11 
很不错的教程:eng:
Shepherd 14. Aug. 2016 um 3:52 
Awesome, this is pretty handy for a Hammer Nooblord such as I :B1: