[Help]Moveto events and attacking?

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
quantumfleet
Posts: 38
Joined: June 17th, 2011, 1:26 am

[Help]Moveto events and attacking?

Post by quantumfleet »

Hi all,
I am being plauged by a very annoying bug caused by a single fact: When a unit is selected, an overlay appears on screen, darkening any areas the unit can't reach. When the unit is ordered to attack an enemy, the overlay stays on-screen while the unit moves, and only disappears when the attack starts.
The problem occurs when a unit attempts to attack an enemy, and triggers a moveto event when moving into position. The overlay stays put until the moveto event ends! Is there any way around this? I've tried using an 'advance' event, but the wiki doesn't seem to have any useful information on how it works. I used this filter:

Code: Select all

[filter]
side=1
x=21-23,22
y=8-9,7
[/filter]
[filter_second]
side=2
[/filter_second]
I've also used an attack end event placed before the moveto event in the code, but the moveto event triggers first anyway.
Currently working on various ideas using 1.9.8.9
User avatar
Dugi
Posts: 4965
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: [Help]Moveto events and attacking?

Post by Dugi »

You can use an object to set both unit's attack number to 0, causing that there will be no fight at all. But that way, the attack will never happen, but you'll have the event without the overlay.
quantumfleet
Posts: 38
Joined: June 17th, 2011, 1:26 am

Re: [Help]Moveto events and attacking?

Post by quantumfleet »

I haven't been able to find any information on the wiki about a unit's attack number; I just tried using a [modify_unit] tag to change set its 'attacks' number to 0 (and back again after the event), but that didn't work.

(And for the record, the unit being attack runs away halfway though the event, so preventing a fight isn't a problem).
Currently working on various ideas using 1.9.8.9
User avatar
8680
Moderator Emeritus
Posts: 742
Joined: March 20th, 2011, 11:45 pm
Location: The past

Re: [Help]Moveto events and attacking?

Post by 8680 »

Try attacks_left= instead of attacks=.
quantumfleet
Posts: 38
Joined: June 17th, 2011, 1:26 am

Re: [Help]Moveto events and attacking?

Post by quantumfleet »

No, that didn't work either. . .
Currently working on various ideas using 1.9.8.9
User avatar
artisticdude
Moderator Emeritus
Posts: 2424
Joined: December 15th, 2009, 12:37 pm
Location: Somewhere in the middle of everything

Re: [Help]Moveto events and attacking?

Post by artisticdude »

So you're saying you did this and it didn't set the filtered units' attacks to 0?

Code: Select all

[modify_unit]
    [filter]
        #your filter conditions here
    [/filter]
    attacks_left=0
[/modify_unit]
Regardless of whether it changed the locations of the shaded hexes, the unit should still have 0 attacks left.
"I'm never wrong. One time I thought I was wrong, but I was mistaken."
JaMiT
Inactive Developer
Posts: 511
Joined: January 22nd, 2012, 12:38 am

Re: [Help]Moveto events and attacking?

Post by JaMiT »

quantumfleet wrote:When a unit is selected, an overlay appears on screen, darkening any areas the unit can't reach. When the unit is ordered to attack an enemy, the overlay stays on-screen while the unit moves, and only disappears when the attack starts.
I wonder if this should be considered a bug? The overlay is removed before moving if there is no attack, so there is an inconsistency.


Edit: Will be fixed in 1.10.3.
Post Reply