Post tutorial RSS Item_Random for Random Loot !

This brief tutorial will explain how the random placement and selection of items/weapons works in Underhell, as well as a short tutorial on how to place them.

Posted by on - Basic Mapping/Technical

Randomization = Replay Value

This is a simple rule, that has driven Underhell to take steps to ensure that no playthrough will be exactly the same.
The Random Factors of the game are so diverse and complex, that I couldn't explain it all in one tutorial, so for this tutorial, let's focus on one VERY important Random Factor, the LOOT!

In many games, especially Survival games, Looting is one of the key elements of gameplay, it's about making the player NEED certain elements, and then HIDING those elements to encourage the player to explore, open drawers, lockers, cabinets, closets, footlockers ect...

There is just one common problem with many of those games, the loot is always the same, and it is always placed at the same location.

This, is where Item_Random comes in.


Item_Random is a brand new entity that we have created for Underhell.
This item's keyvalues determine which item will spawn at the selected location, but it also possesses a few tricks that are worth mentioning.

The basic keyvalues are :

  • TargetName: The name of the "Item_Random" is passed to the Item it will create.
  • Angles: For the spawn angles of any item this "Item_Random" will create.
  • DisableShadows:(0-1): To avoid item's shadows from inside a locker/cabinet.

Special Keyvalues

Respawn: (0-1)

If set to 0, the "Item_Random" will delete itself after creating the first item, to avoid spamming the Edicts Count.
The Item_Random also comes with a "Respawn" Input, when sent, the previous Item that was created will get deleted, and the Item_Random will spawn another Randomized Item from it's list.In order to use the "Respawn" Input, the "Respawn" Keyvalue must be set to 1.

Nothing: (0% - 100%)

This is where the magic occurs.This keyvalue specifies how often the Item_Random will NOT spawn anything.If set to 50, the Item_Random will have 50-50 chances of spawning an item from it's list.
This is a great tool to easily balance maps, especially considering the "Respawn" keyvalue as well, to easily re-create items when necessary.

Item_X: (Item Name)

The Entity uses it's keyvalues as "Flags" to decide which items can be spawned from the "Item_Random".


As you can see, this particular Item_Random can spawn any item from the ones specified in the list, and it will have 50-50 chances of spawning something.

Thanks to this very simple yet effective system, Item_Random can be placed at EVERY potential position where an item could spawn, and yet the game will randomly decide which one will exist, and which one will not.

Furthermore, if one of the item_random was to have a special weapon as one of it's keyvalues, for example a "Weapon_Shotgun_XM1014", only a few lucky players would get this weapon, which would considerably change the way they will play certain parts of the game.

Of course, this wouldn't be much without the 20+ NEW Item Types that we have created for the game, which includes Tools, Food, Drinks and Medical Items.

Programming by Carlos "Charly" Sotelo


Reply Good karma Bad karma+8 votes

So freakin awesome, I hate findin the same SMG in the same spot everytime I play again. This should be added to all linear games, so the experience is different everytime, from "Im totally ******" to "I just found the best weapon in the game, lets have some fun"

Reply Good karma Bad karma+7 votes

It reminds me l4d item system :D
Good work guys !

Reply Good karma Bad karma+7 votes

Awesome, im very very happy to see you guys are making progress. It's always awesome to see a project go well :)
keep up the good work you too, it's just getting better and better :D

Reply Good karma Bad karma+5 votes

The food and drinks portion kicked up my enthusiasm:D

I appreciate this insight into the workings of the mod,
it is very interesting (for me at least) to know how what you are playing works.

Updated Underhell will be so epic!

Reply Good karma Bad karma+7 votes
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.