Shop

From The DarkMod Wiki
Revision as of 02:02, 6 August 2007 by Springheel (talk | contribs)
Jump to navigationJump to search

originally posted by joebarnin

Start Darkmod. Hit New Mission. On the right you'll see a text field (this is all WIP). Type in the name of the map you want to load (without the .map extension). Hit Start.

Go past the difficulty screen to the Shop screen. Unless you've updated your .map file, everything will be empty. So, here's how to update the map file: Add stuff to the worldspawn, like so:

"shop_gold_start" "700"
"shopItem_1_item" "weapon_flashbomb"
"shopItem_1_qty" "5"
"shopItem_2_item" "weapon_waterarrow"
"shopItem_2_0_qty" "5"
"shopItem_2_1_qty" "3"
"shopItem_2_2_qty" "1"
"shopItem_2_cost" "225"
"startingItem_1_item" "weapon_broadsword"
"startingItem_1_qty" "1"
"startingItem_2_item" "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: classname (entityDef name).
_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.