Added a way to specify a message for units that can't pick up the item.

This commit is contained in:
Lari Nieminen 2008-05-04 11:44:53 +00:00
parent f4e9115306
commit b58f95fdff

View file

@ -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]