question about unit's direction

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
User avatar
Cavalcadeur
Posts: 7
Joined: December 21st, 2014, 4:18 pm

question about unit's direction

Post by Cavalcadeur »

Hi everyone,
I'm trying to make a campaign about the second punic war but I have a problem with some units named "Walls".
I have made immobile units with lot of hitpoints used to protect castles. Like castle's walls.
The problem is here : when the wall is under attack, he changes direction to look at his opponent but he's not supposed to do this because he's a wall and he can't move !!!
I can't find how to avoid ths mirroring. Anybody have a solution ??

PS: Sorry for my english ...
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: question about unit's direction

Post by zookeeper »

I believe you need to do that with direction-filtered animations.
User avatar
Cavalcadeur
Posts: 7
Joined: December 21st, 2014, 4:18 pm

Re: question about unit's direction

Post by Cavalcadeur »

Thanks a lot !
User avatar
Elvish_Hunter
Posts: 1575
Joined: September 4th, 2009, 2:39 pm
Location: Lintanir Forest...

Re: question about unit's direction

Post by Elvish_Hunter »

Cavalcadeur wrote:Hi everyone,
The problem is here : when the wall is under attack, he changes direction to look at his opponent but he's not supposed to do this because he's a wall and he can't move !!!
I can't find how to avoid ths mirroring. Anybody have a solution ??
Another solution is that your wall unit can have "misc/empty.png" as base frame, then you'll put the wall image on its hex with an [item] tag. Then, in an appropriate die event, you'll use [remove_item] to clear the hex. Or you can define your own terrain overlay with the wall image and change the terrain in the die event.
Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
User avatar
Iris
Site Administrator
Posts: 6798
Joined: November 14th, 2006, 5:54 pm
Location: Chile
Contact:

Re: question about unit's direction

Post by Iris »

Elvish_Hunter wrote:Another solution is that your wall unit can have "misc/empty.png" as base frame, then you'll put the wall image on its hex with an [item] tag.
misc/empty.png is a 640x480 image. For units it’s safer to use misc/blank-hex.png, which is 72x72 and will take up less memory in the event it’s instantiated as an uncompressed surface. A larger image will also cause problems in 1.13.0 due to the overlays+bars repositioning “feature”.
Author of the unofficial UtBS sequels Invasion from the Unknown and After the Storm.
User avatar
Elvish_Hunter
Posts: 1575
Joined: September 4th, 2009, 2:39 pm
Location: Lintanir Forest...

Re: question about unit's direction

Post by Elvish_Hunter »

shadowm wrote:misc/empty.png is a 640x480 image. For units it’s safer to use misc/blank-hex.png
You're right, I confused the two files: I meant "misc/blank-hex.png". :oops:
Current maintainer of these add-ons, all on 1.16:
The Sojournings of Grog, Children of Dragons, A Rough Life, Wesnoth Lua Pack, The White Troll (co-author)
Post Reply