Loot
Introduction
This wikipage is for general information and guides dealing with loot related things.
Basic Loot Objects
You can add loot into your map by right clicking the orthoview in DR and selecting create entity. Preconfigured loot objects are available in the entitylists. You can also make new non-standard objects into loot by changing an already added loot items spawnargs: inv_loot_value, model, etc.
Advanced Loot Objects
Sometimes more elaborate loot elements are required.
Loot Cache
A Loot Cache is a special object that gives items to the player upon frobbing. A closed bag, for example. The player frobs it and receives an arrow. He frobs again and receives a health potion. When the player frobs the third time the bag is empty and the player gets nothing. These kind of objects could be useful for random stashes in the map. Mapper could prepare such a bag and teleport it anywhere in the map upon each mission restart, making the loot be in a different place each playtime, increasing replayability of the mission. When placing Loot Caches, be sure to make them seem unusual and different from their surroundings, luring the player to go and frob it.
Recipe: Create a func_static stash object. A bag, for example. Give it spawnarg "frobable 1". Select the object and open it in the S&R editor. Add frob from the response list. The effect of the response should be trigger. The target should be a name of a atdm:target_callscriptfunction-entity, which "call inventory_grab".
The end result should be that when the object receives a frob, the S&R triggers the atdm:target_callscriptfunction, which in turn calls a script named inventory_grab.
Create in your maps folder, alongside the mission-name.map a file called mission-name.script. Enter this kind of script into the file:
float cache_state = 0; // a global mapwide variable to tell the map how much stuff the player has taken from the cache. void inventory_grab() { sys.println("inventory grab script running"); // Print the text to the console if ( cache_state == 0 ) { sys.println("Give item 0"); $item_name_0.addItemToInv($player1); //put item_name_0 into player inventory and let the player know about it. } if ( cache_state == 1 ) { sys.println("Give item 1"); $item_name_1.addItemToInv($player1); } if ( cache_state == 2 ) { sys.println("Give item 2"); $item_name_2.addItemToInv($player1); } cache_state = cache_state + 1; // increment the variable to make the script give the next object to the player when he frobs the cache again. }
You need to create item_name_X objects into your map's blueroom. These objects could be anything that can be picked up: loot, scrolls, books, player tools, player weapons, arrows. Expand the script if you have more objects in the cache, ie add more if sentences. Handy tip: remember that arrows have the inv_ammo_amount spawnarg. Setting this to 10 on the arrow entity could make the player receive 10 broadheads with a single frob.