Adding new actions for inventory items

Chris H.'s Ultima / ACS-style game development system!

Moderators: Ice Cream Jonsey, joltcountry

rld
Posts: 223
Joined: Sun Jan 25, 2009 2:17 am
Location: Dallas, TX

Adding new actions for inventory items

Post by rld »

I am thinking about a possible method to add more custom actions that the player can perform with objects in the inventory. Right now, items that the player can carry can be one of (not counting spells/skills):
- weapons: can be readied/unreadied, dropped
- armor: can be readied/unreadied, dropped
- misc. items: can be used, dropped

So, the actions that can be performed with these items are limited. For example, one useful action might be to allow the player to more closely Examine an item (such as a book or spell scroll) before deciding whether to use it.

Some action options that might be useful to add would be:
o Examine
o Read
o Eat
o Drink
o Combine (would involve the player selecting two objects in a row)
o Give
o Sell (if selling items to someone outside the shop interface)

So, if you selected one of these from a macro, an inventory selection screen would come up listing items that the player could select from (similar to the USE, READY, DROP, etc.) selection screens. The screen would say "SELECT ITEM TO EXAMINE" or a similar message depending on the action.

The macro would then receive the number of the item that the player selected (or 0 if none was selected), and the macro would take over from that point.

The one detail would come in that the macro would have to pre-specify which objects would be available in the list, if you didn't want irrelevant objects being displayed (like a silver key for the EAT command). But there might be a way to automate this; I will have to think about it.

Any suggestions for any other actions that could be added?

Admiral Ackguh

Post by Admiral Ackguh »

Why not combine this with the Game Setup page in the Configure Adventure editor? Right now there is space for four custom commands; maybe add two more inventory-based ones.

For more flexibility (and complexity), I can also see a new Game Setup page for custom commands and macros, looking like this:

Code: Select all

 
        KEY     NAME      USAGE    SELECT    FIRE
-1-      E     EXAMINE      I        21       22
-2-      S     SEARCH       T        23       24
-3-      H     HOLE UP                        25
-4-      P     PRAY                           26
-5-      V     VIEW                           27
-6-
KEY - Key used for custom command
NAME - Name of action
USAGE - I for items in inventory, T for terrain
SELECT - Pre-select macro, optional
FIRE - Execution macro

Pre-selection: The system would go through every inventory item and call the SELECT macro each time, passing the item number in the SUCCESS variable. The select macro would return SUCCESS of 1 to include that item, or 0 to exclude it. If no SELECT macro specified; all items included.

That way, one could design a Nethack-ish game with many commands, able to exclude irrelevant items dynamically. Thus, the EAT command could always exclude the silver key, and the iron key too (unless you're polymorphed into a rust monster).

- A:A:

Admiral Ackguh

Post by Admiral Ackguh »

Another feature that will prove useful, both with custom actions and otherwise, is target variables.

TOBJ - Target object

This is the object number of the last object Used or skill Cast. In the case of custom actions, the object selected (or pre-selected) from the list, and acted upon. With TOBJ it could be possible to set the same macro as the action for many different objects, thus saving macros.

LOC[TX] - X coordinate of target map location
LOC[TY] - Y coordinate of target location

The map location is the one of the last object or creature Attacked, Looked at, Talked to, or bumped into. The Drop, Get, Board. and eXit commands affect both a map location and an inventory item. In the case of Drop-Destroy, LOC[TX] and [TY] are zero.

Presently, if you need to know the map location of a bumped object, you need use in the macro the unreliable LASTMOV, and a MAPCHK for four possible locations (NESW). Finding the target of an attack with ranged weapon is impossible.

- A:A:

User avatar
Garth's Equipment Shop
Posts: 638
Joined: Fri Dec 05, 2008 5:55 pm
Location: Festering Foothills
Contact:

Re: Adding new actions for inventory items

Post by Garth's Equipment Shop »

rld wrote:I am thinking about a possible method to add more custom actions that the player can perform with objects in the inventory.
(....)
Some action options that might be useful to add would be:
o Examine
o Read
o Eat
o Drink
o Combine (would involve the player selecting two objects in a row)
o Give
o Sell (if selling items to someone outside the shop interface)

So, if you selected one of these from a macro, an inventory selection screen would come up listing items that the player could select from (similar to the USE, READY, DROP, etc.) selection screens. The screen would say "SELECT ITEM TO EXAMINE" or a similar message depending on the action.

The macro would then receive the number of the item that the player selected (or 0 if none was selected), and the macro would take over from that point.
Any progress with this very useful idea rld?

Post Reply