PickupMessage

From ZDoom Wiki
Jump to navigation Jump to search

Inventory

virtual String PickupMessage ()

Usage

Called by Inventory items to obtain the text string that the item should print when the player picks up the item. By default, simply returns pickupMsg, which is a String variable whose value is determined by the item's PickupMessage property. Can be overridden to modify the string.

Notes:

  1. If a LANGUAGE reference is used anywhere in this process, it will not be automatically localized. First, StringTable.Localize() must be called on the string.
  2. This function does nothing if called directly, it should only be used as an override. To actually force an item to print its pickupmessage, call PrintPickupMessage, and that function will call this one to obtain the string.

Example

This override, when inserted into an Inventory item, will print a formatted string, consisting of the item's regular PickupMessage, followed by an amount picked up in parentheses. For example, in case of a Clip, this would print: "Picked up a Clip (+10)".

override string PickupMessage()
{
	return String.Format("%s (+%d)", StringTable.Localize(pickupMsg), amount);
}

See also