[object] trouble
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.
[object] trouble
What is wrong with this?
Obviously, when player 1 starts his turn (excluding the first turn), every one of his units should gain that new attack. Same for side 2. The problem is that, for each side, all the objects are given to one unit. To be more precise, stored_units[0].
The wiki does state that [objects] might behave oddly outside of moveto events, but this doesn't really make sense and I'd think that something like this would be outdated information. Any ideas on where the bug is and how to go around it in this case?
Code: Select all
[multiplayer]
id=Test
name= _ "Test"
map_data="gggggggggggggggggggggggggggggggggggggg
gggggggggggggggggggggggggggggggggggggg
gggggggggggggggggggggggggggggggggggggg
gggggggggggggggggggggggggggggggggggggg
gggggggggggggggggggggggggggggggggggggg
ggggggggggCCCggggggggggggggggggggggggg
ggggggggggC1Cggggggggggggggggggggggggg
ggggggggggCCCggggggggCCCgggggggggggggg
gggggggggggggggggggggC2Cgggggggggggggg
gggggggggggggggggggggCCCgggggggggggggg
gggggggggggggggggggggggggggggggggggggg
gggggggggggggggggggggggggggggggggggggg
gggggggggggggggggggggggggggggggggggggg
gggggggggggggggggggggggggggggggggggggg
gggggggggggggggggggggggggggggggggggggg"
turns=20
description= _ ""
{DAWN}
{MORNING}
{AFTERNOON}
{DUSK}
{FIRST_WATCH}
{SECOND_WATCH}
[side]
side=1
canrecruit=1
enemy=2
controller=human
[/side]
[side]
side=2
canrecruit=1
enemy=1
controller=human
[/side]
[event]
name=side turn
first_time_only=no
[store_unit]
[filter]
side=$side_number
[/filter]
variable=stored_units
kill=no
animate=no
[/store_unit]
{FOREACH stored_units i}
[object]
duration=forever
silent=yes
[filter]
x=$stored_units[$i].x
y=$stored_units[$i].y
[/filter]
[effect]
apply_to=new_attack
name="foo"
damage=10
number=10
type=impact
range=short
[/effect]
[/object]
{NEXT i}
[/event]
[/multiplayer]
The wiki does state that [objects] might behave oddly outside of moveto events, but this doesn't really make sense and I'd think that something like this would be outdated information. Any ideas on where the bug is and how to go around it in this case?
Code: Select all
$stored_units[$i].x
Code: Select all
{FOREACH stored_units i}
[set_variable]
name=temp_x
format=$stored_units[$i].x
[/set_variable]
[set_variable]
name=temp_y
format=$stored_units[$i].y
[/set_variable]
[object]
duration=forever
silent=yes
[filter]
x=$temp_x
y=$temp_y
[/filter]
Hope springs eternal.
Wesnoth acronym guide.
Wesnoth acronym guide.