Added a macro for placing items that...

...the player can choose whether to pick up or not.
This commit is contained in:
Lari Nieminen 2008-05-04 10:23:59 +00:00
parent 1765feaacd
commit 18147344d8

View file

@ -484,3 +484,82 @@
[/object]
[/event]
#enddef
#define PICKUPPABLE_ITEM ID X Y EXTRA_FILTER IMAGE 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?" (
# ! [object]
# ! name= _ "Ring of HP"
# ! image=items/ring-red.png
# ! description= _ "This ring grants the wearer +10 max hp!"
# !
# ! [effect]
# ! apply_to=hitpoints
# ! increase_total=10
# ! [/effect]
# ! [/object]
# ! )}
[item]
x,y={X},{Y}
image={IMAGE}
[/item]
[event]
name=moveto
first_time_only=no
[filter]
x,y={X},{Y}
{EXTRA_FILTER}
[/filter]
[if]
[variable]
name=item_{ID}_picked_up
not_equals=yes
[/variable]
[then]
[message]
speaker=narrator
message={MESSAGE}
image={IMAGE}
[option]
message= _ "Pick it up"
[command]
{OBJECT}
[removeitem]
x,y={X},{Y}
[/removeitem]
[set_variable]
name=item_{ID}_picked_up
value=yes
[/set_variable]
[/command]
[/option]
[option]
message= _ "Leave it"
[command]
[allow_undo][/allow_undo]
[/command]
[/option]
[/message]
[/then]
[else]
[allow_undo][/allow_undo]
[/else]
[/if]
[/event]
#enddef