Shop: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 23: Line 23:


  _# : item number, starting from 1. No gaps.
  _# : 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.
  _#_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).
  _item: classname (entityDef name).
  _qty: how many are for sale (or, if a starting item, how many to start with)
  _qty: how many are for sale (or, if a starting item, how many to start with)

Revision as of 22:22, 5 August 2007

originally posted by joebarnin

Start Darkmod. Hit New Mission. On the left you'll see a Start button. Above it is a text field -- sorry, you can't see it, just click in the area above Start until you can see the cursor. Type in the name of the map you want to load (without the .map extension). Hit Start.

Go 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" "7000"
"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.