Okay guys, I was.. "inspired" to make this tutorial. I can see that a lot of you STILL don't realize how loot works so i'll go ever this in detail.
1. How to do I place loot spawns?
First, you spawn an obj_ItemSpawnPoint and add locations where you want things to spawn.
To add location to an item spawn point, make sure that the pole is checked, then go to edit tab, scroll down and right below LootID there will be locations tab. where you just press "Add location" then select that location and click anywhere on the map while holding Control key.
After that, you want to decide what loot should spawn at those locations. For this example I used ZOMBIE - Money, but it doesn't matter which one it is because procedure is same for everything.
2. How does studio know?
Studio takes data from the itemsDB.xml located in data\weapons\ folder. there's some useful things here and that's where everything studio related is.
itemsDB.xml and items database on the server have to be synced for the server to work properly.
Important note: Name you see here is NOT. I repeat. IS NOT!!! the name you see in-game. For seeing proper names inside studio, you must go to data\LangPack\ and open english.lang.
In there, you must configure name of the item by writing it's ID and adding "_name". Like this:
"******_name=Write name here" (****** marks the item ID)
Note: For loot tables, there's no need for a description, but add it regardless.
3. How does the server know?
Server takes everything from the database on the server, and checks the data written in itemsDB.xml (that's why they need to be synced.
Loot boxes are located inside items_generic database table. There are a lot of entries in that table, but with a simple sql query I can get what I need easily.
It's important for loot boxes to have Category=7 and FNAME = Item_LootBox. You can also set your name here, but it's not important, so don't worry, rest of the columns in these cases are irrelevant too.
ItemID here is actually the ID of the lootbox, not a real "item".
4. How do I decide what spawns?
What will which loot box spawn is decided elsewhere and to be precise, it is located inside items_lootdata database table.
In there you will see a lot of stuff and I'll go over the columns first.
RecordID column is just for indexing all of the loot boxes (aka, Loot tables)
LootID column is the ID of the lootBox. this MUST be equal to ItemID in items_generic and to the ID of the LootBox inside itemsDB.xml
Chance column is the column what decides the chance of items spawning. higher the number, higher the chance of that item spawning.
ItemID column stands for what items will spawn.
if you want any loot table to spawn money, then itemID must be 0 and GDMin (Game Dollars Minimum) and GDMax (Game Dollars Maximum) have to be set accordingly.
if you want any loot table to have chance of spawning nothing, then as ItemID put "-1"
Note: You can't have lootboxes spawn other or the same lootbox. ItemIDs have to be equal to an ItemID of a weapon/gear/armor/ whatever is that you want to spawn that a player can pick up and use.
Any questions?







Reply With Quote![[Tutorial] How loot spawns work](http://ragezone.com/hyper728.png)



