Difference between revisions of "DroppableItem"
From The Battle for Wesnoth Wiki
(→Droppable Item) |
|||
| Line 13: | Line 13: | ||
IMAGE=the image of the object | IMAGE=the image of the object | ||
| − | #define DROPPABLE_ITEM X Y XVAR YVAR NAME IMAGE | + | #define DROPPABLE_ITEM X Y XVAR YVAR NAME IMAGE ADDITIONAL_FILTERS |
| + | [label] | ||
| + | x={X} | ||
| + | y={Y} | ||
| + | text="{NAME}" | ||
| + | [/label] | ||
[event] | [event] | ||
name=prestart | name=prestart | ||
| Line 19: | Line 24: | ||
{VARIABLE {XVAR} {X}} | {VARIABLE {XVAR} {X}} | ||
{VARIABLE {YVAR} {Y}} | {VARIABLE {YVAR} {Y}} | ||
| − | + | ||
[item] | [item] | ||
x=${XVAR} | x=${XVAR} | ||
| Line 25: | Line 30: | ||
image={IMAGE} | image={IMAGE} | ||
[/item] | [/item] | ||
| − | + | ||
| + | [event] | ||
| + | name=die | ||
| + | first_time_only=no | ||
| + | [store_unit] | ||
| + | [filter] | ||
| + | x=$x1 | ||
| + | y=$y1 | ||
| + | [/filter] | ||
| + | variable=itemstore | ||
| + | [/store_unit] | ||
| + | [if] | ||
| + | [variable] | ||
| + | name=itemstore.variables.{XVAR} | ||
| + | equals=on | ||
| + | [/variable] | ||
| + | [then] | ||
| + | {VARIABLE_OP {XVAR} to_variable x1} | ||
| + | {VARIABLE_OP {YVAR} to_variable y1} | ||
| + | [item] | ||
| + | x=$x1 | ||
| + | y=$y1 | ||
| + | image={IMAGE} | ||
| + | [/item] | ||
| + | [/then] | ||
| + | [/if] | ||
| + | [/event] | ||
| + | |||
[event] | [event] | ||
name=moveto | name=moveto | ||
| Line 32: | Line 64: | ||
x=${XVAR} | x=${XVAR} | ||
y=${YVAR} | y=${YVAR} | ||
| + | {ADDITIONAL_FILTERS} | ||
[/filter] | [/filter] | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
[removeitem] | [removeitem] | ||
| Line 72: | Line 78: | ||
[/filter] | [/filter] | ||
[/store_unit] | [/store_unit] | ||
| − | + | {VARIABLE itemstore.variables.{XVAR} on} | |
[unstore_unit] | [unstore_unit] | ||
variable=itemstore | variable=itemstore | ||
[/unstore_unit] | [/unstore_unit] | ||
| − | + | [unit_overlay] | |
| − | + | x=${XVAR} | |
| + | y=${YVAR} | ||
| + | image={IMAGE} | ||
| + | [/unit_overlay] | ||
[object] | [object] | ||
| Line 84: | Line 93: | ||
image={IMAGE} | image={IMAGE} | ||
duration=forever | duration=forever | ||
| + | cannot_use_message="-cannot use message-" | ||
[filter] | [filter] | ||
x=${XVAR} | x=${XVAR} | ||
| Line 90: | Line 100: | ||
#enddef | #enddef | ||
| − | #All this should be between the DROPPABLE_ITEM macro and /DROPPABLE_ITEM | + | #All this should be between the usage of the DROPPABLE_ITEM macro and its /DROPPABLE_ITEM |
# description="-the description-" | # description="-the description-" | ||
| − | |||
# [effect] | # [effect] | ||
# blahblahblah=somethingorother | # blahblahblah=somethingorother | ||
# [/effect] | # [/effect] | ||
| − | + | ||
| − | #define /DROPPABLE_ITEM | + | #define /DROPPABLE_ITEM XVAR YVAR |
[/object] | [/object] | ||
| + | |||
| + | {VARIABLE {XVAR} 0} | ||
| + | {VARIABLE {YVAR} 0} | ||
[/event] | [/event] | ||
[/event] | [/event] | ||
#enddef | #enddef | ||
| − | |||
== See Also == | == See Also == | ||
* [[UsefulWMLFragments]] | * [[UsefulWMLFragments]] | ||
| − | |||
Revision as of 13:24, 22 August 2005
Droppable Item
X=the starting X-location for the object
Y=the starting Y-location for the object
XVAR=the variable to store the item's current X-location in
YVAR=the variable to store the item's current Y-location in
NAME=the name of the object
IMAGE=the image of the object
#define DROPPABLE_ITEM X Y XVAR YVAR NAME IMAGE ADDITIONAL_FILTERS
[label]
x={X}
y={Y}
text="{NAME}"
[/label]
[event]
name=prestart
{VARIABLE {XVAR} {X}}
{VARIABLE {YVAR} {Y}}
[item]
x=${XVAR}
y=${YVAR}
image={IMAGE}
[/item]
[event]
name=die
first_time_only=no
[store_unit]
[filter]
x=$x1
y=$y1
[/filter]
variable=itemstore
[/store_unit]
[if]
[variable]
name=itemstore.variables.{XVAR}
equals=on
[/variable]
[then]
{VARIABLE_OP {XVAR} to_variable x1}
{VARIABLE_OP {YVAR} to_variable y1}
[item]
x=$x1
y=$y1
image={IMAGE}
[/item]
[/then]
[/if]
[/event]
[event]
name=moveto
first_time_only=no
[filter]
x=${XVAR}
y=${YVAR}
{ADDITIONAL_FILTERS}
[/filter]
[removeitem]
x=${XVAR}
y=${YVAR}
[/removeitem]
[store_unit]
variable=itemstore
[filter]
x=${XVAR}
y=${YVAR}
[/filter]
[/store_unit]
{VARIABLE itemstore.variables.{XVAR} on}
[unstore_unit]
variable=itemstore
[/unstore_unit]
[unit_overlay]
x=${XVAR}
y=${YVAR}
image={IMAGE}
[/unit_overlay]
[object]
name={NAME}
image={IMAGE}
duration=forever
cannot_use_message="-cannot use message-"
[filter]
x=${XVAR}
y=${YVAR}
[/filter]
#enddef
#All this should be between the usage of the DROPPABLE_ITEM macro and its /DROPPABLE_ITEM
# description="-the description-"
# [effect]
# blahblahblah=somethingorother
# [/effect]
#define /DROPPABLE_ITEM XVAR YVAR
[/object]
{VARIABLE {XVAR} 0}
{VARIABLE {YVAR} 0}
[/event]
[/event]
#enddef