wesnoth-wiki-changes
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Wesnoth-wiki-changes] DroppableItem


From: wiki
Subject: [Wesnoth-wiki-changes] DroppableItem
Date: Tue, 16 Nov 2004 19:23 +0100

UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
IP: 216.20.1.213
URI: http://wesnoth.slack.it/?DroppableItem
 - - - - -

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
 [event]
 name=prestart
        
        {VARIABLE {XVAR} {X}}
        {VARIABLE {YVAR} {Y}}

        [item]
        x=${XVAR}
        y=${YVAR}
        image={IMAGE}
        [/item]

        [event]
        name=moveto
        first_time_only=no
                [filter]
                x=${XVAR}
                y=${YVAR}
                [/filter]
                
                [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]
                
                [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]
                
                {VARIABLE {XVAR} 0}
                {VARIABLE {YVAR} 0}
                
                [object]
                name={NAME}
                image={IMAGE}
                duration=forever
                        [filter]
                        x=${XVAR}
                        y=${YVAR}
                        [/filter]
 #enddef
                
 #All this should be between the DROPPABLE_ITEM macro and /DROPPABLE_ITEM
 #              description="-the description-"
 #              cannot_use_message="-cannot use message-"
 #                      [effect]
 #                      blahblahblah=somethingorother
 #                      [/effect]

 #define /DROPPABLE_ITEM
                [/object]
        [/event]
 [/event]
 #enddef


||See Also||

* UsefulWMLFragments






reply via email to

[Prev in Thread] Current Thread [Next in Thread]