diff --git a/data/core/macros/items.cfg b/data/core/macros/items.cfg index 21b9b4f9dee..6edf5edb8a1 100644 --- a/data/core/macros/items.cfg +++ b/data/core/macros/items.cfg @@ -485,13 +485,15 @@ [/event] #enddef -#define PICKUPPABLE_ITEM ID X Y EXTRA_FILTER IMAGE MESSAGE OBJECT +#define PICKUPPABLE_ITEM ID X Y EXTRA_FILTER IMAGE MESSAGE CANNOT_USE_MESSAGE OBJECT # This places an item on the map which can be picked up once, but allows the # player to choose whether the unit stepping on it should take it or not. # The "object" doesn't necessarily need to be an [object], any action works. # # Example: - # ! {PICKUPPABLE_ITEM ring_of_hp 8 12 side=1 items/ring-red.png _"$unit.name finds a pretty ring. Should he pick it up?" ( + # ! {PICKUPPABLE_ITEM ring_of_hp 8 12 race=human items/ring-red.png + # ! _"$unit.name finds a pretty ring. Should he pick it up?" + # ! _"$unit.name finds a pretty ring. But only a human can take it!" ( # ! [object] # ! name= _ "Ring of HP" # ! image=items/ring-red.png @@ -515,10 +517,14 @@ [filter] x,y={X},{Y} - {EXTRA_FILTER} [/filter] [if] + [have_unit] + x,y={X},{Y} + {EXTRA_FILTER} + [/have_unit] + [variable] name=item_{ID}_picked_up not_equals=yes @@ -558,6 +564,21 @@ [/then] [else] + [if] + [variable] + name=item_{ID}_picked_up + not_equals=yes + [/variable] + + [then] + [message] + speaker=narrator + message={CANNOT_USE_MESSAGE} + image={IMAGE} + [/message] + [/then] + [/if] + [allow_undo][/allow_undo] [/else] [/if]