Fosprey Problems with his era

The place to post your WML questions and answers.

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.
Post Reply
Fosprey
Posts: 254
Joined: January 25th, 2008, 8:13 am

Fosprey Problems with his era

Post by Fosprey »

It kind of works properly (the idea is that you give one order per turn to units) But i want it to filter so it doesn[t work when there are adjacent enemies.
There is only one reason for it. If you press attack on a unit to see the the attack window and you choose not to attack (press cancel) The unit doesn't go back. I assumed this has to do with the store/unstore thing. But after adding a filter, it still don[t allow you to press cancel and return. Is there anything i should know about how events mess up in some way that feature?

Code: Select all

[event]
name=moveto
first_time_only=no
[have_unit]
side=$side_number
x,y=$x1,$y1
[/have_unit]
[if]
[have_unit]
x,y=$x1,$y1
[filter_adjacent]
count=1-6
is_enemy=true
[/filter_adjacent]
[/have_unit]
[then]
[/then]
[else]


[store_unit]
[filter]
x=$x1
y=$y1
[/filter]
kill=yes
mode=replace
variable=munit
[/store_unit]


[set_variable]
name=munit.moves
value=0
[/set_variable]
[unstore_unit]
variable=munit
[/unstore_unit]
[/else]
[/if]
[/event]
mich
Translator
Posts: 134
Joined: November 11th, 2008, 8:54 am
Location: Italy

Re: Fosprey Problems with his era

Post by mich »

You can try to put an [allow_undo] inside the [then], or to use a proper [filter] instead of that first [have_unit] that i don't understand.
Try something like

Code: Select all

[filter]
    side=$side_number
    [not]
    [filter_adjacent]
        count=1-6
        is_enemy=true
    [/filter_adiacent]
    [/not]
[/filter]
Post Reply