Problems with DroppableItem macro
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Problems with DroppableItem macro
i want to use DroppableItem macro from wiki, but i get errors...
Code: Select all
########################## MACRO DEFINE PART #############################
#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]
apply_to=new_atack
[atack]
name="Wand"
type=cold
special=plague(Walking Corpse)
icon=dark-missile.png
range=long
damage=10
number=2
[/atack]
[/effect]
#define /DROPPABLE_ITEM
[/object]
[/event]
[/event]
#enddef
######################## MACRO DEFINE PART END ###########################
{DROPPABLE_ITEM 20 20 XBLAH YBLAH ("Wand") (attacks/darkstaff.png)}
I think attack is spelled with two 't' not one. ( new_attack, [attack] and [/attack] )
You forgot the effect of the object (makes no sense to put it between the definition of the macros) and {/DROPPABLE_ITEM}:
{DROPPABLE_ITEM 20 20 XBLAH YBLAH ("Wand") (attacks/darkstaff.png)}
description="-the description-"
cannot_use_message="-cannot use message-"
[effect]
apply_to=new_attack
[attack]
name="Wand"
type=cold
special=plague(Walking Corpse)
icon=dark-missile.png
range=long
damage=10
number=2
[/attack]
[/effect]
{/DROPPABLE_ITEM}
You forgot the effect of the object (makes no sense to put it between the definition of the macros) and {/DROPPABLE_ITEM}:
{DROPPABLE_ITEM 20 20 XBLAH YBLAH ("Wand") (attacks/darkstaff.png)}
description="-the description-"
cannot_use_message="-cannot use message-"
[effect]
apply_to=new_attack
[attack]
name="Wand"
type=cold
special=plague(Walking Corpse)
icon=dark-missile.png
range=long
damage=10
number=2
[/attack]
[/effect]
{/DROPPABLE_ITEM}
Looks like something with the [filter] inside of [object] does not work.
I guess it is the following code in front of [object] (inside the definition of DROPPABLE_ITEM):
{VARIABLE {XVAR} 0}
{VARIABLE {YVAR} 0}
Know the filter inside the object should check wether a unit stands on (0,0) or not, can not find one and the can not use message of the object is displayed. You can try what happens when you move
{VARIABLE {XVAR} 0}
{VARIABLE {YVAR} 0}
into the definition of /DROPPABLE_ITEM (behind [/object])
I guess it is the following code in front of [object] (inside the definition of DROPPABLE_ITEM):
{VARIABLE {XVAR} 0}
{VARIABLE {YVAR} 0}
Know the filter inside the object should check wether a unit stands on (0,0) or not, can not find one and the can not use message of the object is displayed. You can try what happens when you move
{VARIABLE {XVAR} 0}
{VARIABLE {YVAR} 0}
into the definition of /DROPPABLE_ITEM (behind [/object])
- Elvish_Pillager
- Posts: 8137
- Joined: May 28th, 2004, 10:21 am
- Location: Everywhere you think, nowhere you can possibly imagine.
- Contact:
Urgh. I discovered some problems in this a while ago, but forgot to update the wiki. It is now updated.
There is also now an ADDITIONAL_FILTERS parameter, which should be set to "" in general.
There is also now an ADDITIONAL_FILTERS parameter, which should be set to "" in general.
It's all fun and games until someone loses a lawsuit. Oh, and by the way, sending me private messages won't work. :/ If you must contact me, there's an e-mail address listed on the website in my profile.
i dont see any unclosed " } ) or '
code:
code:
Code: Select all
[multiplayer]
id= WfW
name= _ "War For Wand"
map_data="cccccZcccccckkgggggggFFFVFSVSF
cZcccccccZcckkggcggggFFFFnSSFF
cccQQQcccccckkgggcggFFVFn4nVFF
cccQ5QccccckkkgcggggFFFgnnnFFF
ccccQccccckkkgggggggggFggggFFF
cccckccZckcckkggggggggggggFFFg
kkcckcccckkkcckkgggHHHgggggggg
kkkkkcckkkkgkkckgggHHHVggggggg
gfkkkkkkkggggkckggggHggggggggg
ffggkkkggggggkckgggggggggggggf
ffffgfgccfgggkcckkggggggffggff
ggtCfgcffffgggkkckgggggfffgwfw
ggC3CgtfffffgggkckggggggfwwwwY
tgCCCggfffgggkkcckgggfgggwYwww
ffggggfffggkkcckkgggffgwwwwqww
ffftgffffggkckkgggggffgwwwq2qw
gffffffggggkckggggggffgwwwqqqw
ggfgfgfggggkckggggggggggwwwwww
gggtgggggggkcckggggggggggwwYww
gfffggggggggkckgggggggfffgwwwY
gffffhhmggggkckgggggggffffggww
ggfgfghhmhggkckggkkkggggfggggg
ggggggaghgggkckkkccckkgggggffg
gmmmmmggggggkkccckkkcckggggggg
mmmWmmmgggggggkkkggkkckggggggg
mWWuWumggggkkkgggkkcckkggggggg
WDuouuumggkccckkkcckkggggIIIgg
uuo1ouWmmgkckkccckkggggIIIPIgg
DuoooDWmmgkckgkkkggggggIUIIgIg
uDuuuWWmmgkckgggggggggggIggggg"
description= _ ""
turns=50
{DAWN}
{MORNING}
{AFTERNOON}
{DUSK}
{FIRST_WATCH}
{SECOND_WATCH}
[side]
side=1
enemy=2
canrecruit=1
controller=human
[/side]
[side]
side=2
enemy=1
canrecruit=1
controller=human
[/side]
########################## MACRO DEFINE PART #############################
#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
#define /DROPPABLE_ITEM XVAR YVAR
[/object]
{VARIABLE {XVAR} 0}
{VARIABLE {YVAR} 0}
[/event]
[/event]
#enddef
######################## MACRO DEFINE PART END ###########################
{DROPPABLE_ITEM 30 30 XBLAH YBLAH ("Wand") (attacks/darkstaff.png) ("")}
description="blah blah"
cannot_use_message="-cannot use message-"
[effect]
apply_to=new_attack
[attack]
name="Wand"
type=cold
special=plague(Walking Corpse)
icon=dark-missile.png
range=long
damage=10
number=2
[/attack]
[/effect]
{/DROPPABLE_ITEM}
[/multiplayer]
now i get error 'unexpected chars on begin of line 157' its line where is {DROPPABLE_ITEM 30 30 XBLAH YBLAH ("Wand") (attacks/darkstaff.png) ("")} , what the...
P.S.: i think [side] tags dont affect multiplayer, its 5 player map and i have here [side] tags only for two.. but scenaro runs with 5(when i comment out dont working lines)
P.S.: i think [side] tags dont affect multiplayer, its 5 player map and i have here [side] tags only for two.. but scenaro runs with 5(when i comment out dont working lines)