Shop: Difference between revisions
No edit summary |
mNo edit summary |
||
Line 4: | Line 4: | ||
Click here for a [[default purchasable items]] template. | Click here for a [[default purchasable items]] template. | ||
==How to NOT show the shop== | |||
The shop shows by default at mission start. If you don't want it then add this spawnarg and value to your map's worldspawn: | The shop shows by default at mission start. If you don't want it then add this spawnarg and value to your map's worldspawn: | ||
Line 11: | Line 11: | ||
== | ==Notes== | ||
I added code support for shop entities to be placed the map, like difficulty settings or objectives entities. | I added code support for shop entities to be placed the map, like difficulty settings or objectives entities. | ||
Line 29: | Line 29: | ||
Note the missing "2" in the indexing. The parser just continues, which should make prefabbing easier and set up more robust against user errors. | Note the missing "2" in the indexing. The parser just continues, which should make prefabbing easier and set up more robust against user errors. | ||
==Setting up Shop== | |||
Add an atdm:shop entity to your map (probably in the "blue room"). You can add the following lines in the editor, but it might be easier to load up your map file in a text editor, find the adtm:shop entity, and cut and paste. | Add an atdm:shop entity to your map (probably in the "blue room"). You can add the following lines in the editor, but it might be easier to load up your map file in a text editor, find the adtm:shop entity, and cut and paste. | ||
Line 70: | Line 71: | ||
==Preventing the player dropping critical items== | |||
There is a cannot drop' option for start items, eg, a spawnarg, "startingitem_15_2_nodrop" "1" (default 0). For use with mission-critical items (like lockpicks) so full start equipment can be shown in the shop without risk the player will drop something crucial. | There is a cannot drop' option for start items, eg, a spawnarg, "startingitem_15_2_nodrop" "1" (default 0). For use with mission-critical items (like lockpicks) so full start equipment can be shown in the shop without risk the player will drop something crucial. |
Revision as of 09:58, 26 September 2010
originally posted by joebarnin
Click here for a default purchasable items template.
How to NOT show the shop
The shop shows by default at mission start. If you don't want it then add this spawnarg and value to your map's worldspawn:
shop_skip 1
Notes
I added code support for shop entities to be placed the map, like difficulty settings or objectives entities.
- The entity is called atdm:shop. - The spawnarg format is the same as for the worldspawn. - Settings on Worldspawn are still supported, for "backwards" compatibility. - Multiple atdm:shop entities can be added to the map, all of them are considered.
Additionally, I refactored the shop parsing code, so that a "gap" in the spawnarg numbering doesn't stop the parser. For instance, it's now possible to do something like this:
"shopItem_1_0_item" "atdm:weapon_broadhead" "shopItem_1_0_qty" "10" "shopItem_3_0_item" "atdm:weapon_waterarrow" "shopItem_3_0_qty" "10"
Note the missing "2" in the indexing. The parser just continues, which should make prefabbing easier and set up more robust against user errors.
Setting up Shop
Add an atdm:shop entity to your map (probably in the "blue room"). You can add the following lines in the editor, but it might be easier to load up your map file in a text editor, find the adtm:shop entity, and cut and paste.
"shop_gold_start" "700" "shopItem_1_item" "atdm:playertools_flashbomb" "shopItem_1_qty" "5" "shopItem_2_item" "atdm:weapon_waterarrow" "shopItem_2_0_qty" "5" "shopItem_2_1_qty" "3" "shopItem_2_2_qty" "1" "shopItem_2_cost" "225" "startingItem_1_item" "atdm:weapon_broadsword" "startingItem_1_qty" "1" "startingItem_2_item" "atdm:weapon_blackjack" "startingItem_2_qty" "1" "startingItem_3_item" "atdm : playertools_health_potion" (remove the spaces around the colon) "startingItem_3_0_qty" "2" "startingItem_3_1_qty" "1" "startingItem_3_2_qty" "0"
_# : item number, starting from 1. No gaps. _#_X: X is the skill (difficulty) level this value applies to. So in the above example, the shop contains 5 water arrows at easy, 3 at medium, 1 at hard (difficulty goes from 0 (easy) to 2 (hard)). If you leave off a skill, quantity zero is assumed (e.g., if there was no "shopItem_2_2_qty", then there would be zero arrows for sale at hard level). Note you can have cost vary by difficulty as well. And starting item quantities too. _item: the "classname" listed in the entitydef (see tdm_shopitems.def). _qty: how many are for sale (or, if a starting item, how many to start with) _cost field is optional (otherwise it uses the default cost defined in tdm shopitems.def).
Okay, now you've updated your map with something like this, so get back to the Shop and buy what you want. Start the mission. You should have the appropriate number of items.
tdm-shopitems.def defines the list of the common items that can be purchased (or that can be in the Starting Items list). This file documents the format of ShopItem entityDefs, so if you want to add unique items to your own .def file, you can.
shop.cpp and shop.h are new files that define CShop and CShopItems, classes for dealing with the Shop screen.
player.cpp was updated to create the purchased items
game_local.cpp was modified to handle the Main Menu commands. This was the only way I could figure out to have the shop talk to our code. Apparently the id code behaves differently when your in the main menu.
Preventing the player dropping critical items
There is a cannot drop' option for start items, eg, a spawnarg, "startingitem_15_2_nodrop" "1" (default 0). For use with mission-critical items (like lockpicks) so full start equipment can be shown in the shop without risk the player will drop something crucial.