Bending ZoC Rules

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
meriton
Posts: 77
Joined: March 17th, 2007, 1:17 pm

Bending ZoC Rules

Post by meriton »

I'd like to slightly bend the zone of control rules for a multiplayer scenario of mine. That is, if unit A kills unit B, I don't want unit A to be restricted by unit B's ZoC.

Can I do that in WML? How?

I know how I can set the number of moves left in a "die" event. However, so far I haven't figured out how to determine the number of moves the unit would have left if there was no ZoC. I tried storing the unit in the moveto-event and record unit.moves to a variable, but unit.moves is already 0 because the ZoC rule has already been taken into account.
User avatar
Cloud
Art Contributor
Posts: 502
Joined: December 17th, 2008, 7:43 pm
Location: The land of pixels
Contact:

Re: Bending ZoC Rules

Post by Cloud »

See movement_used. Shouldn't be hard to code a small change to that tag for A, for when A fights B. I think that's your best bet.
Softly/SoftlySplinter on IRC. Will be lurking around more these days
Mainline Animations|The Væringjar
Art for these mead-sodden, bearded mushroom-junkies by Girgistian!
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Bending ZoC Rules

Post by zookeeper »

meriton wrote:Can I do that in WML?
No, I think you can't. Not in a good way anyway.

The best simulation I can think of would be giving A skirmisher when next to B (but not any other unit with ZoC) and then having a moveto event for when A moves next to B in which you store the amount of moves A has left and set them to 0 and then have a die event for B in which you restore A's stored moves.
meriton
Posts: 77
Joined: March 17th, 2007, 1:17 pm

Re: Bending ZoC Rules

Post by meriton »

Wouldn't this allow A to walk right past B without fighting? That might be a bit too powerful.

I guess I'll have to think of another rule then, thanks for your ideas.
Lord_Aether
Posts: 127
Joined: November 11th, 2005, 9:06 am
Location: California

Re: Bending ZoC Rules

Post by Lord_Aether »

I think you should re-read zookeeper's post :wink:
Mac OS X 10.5.7
Wesnoth 1.6.2
meriton
Posts: 77
Joined: March 17th, 2007, 1:17 pm

Re: Bending ZoC Rules

Post by meriton »

I have. No new insight comes to mind.

I understand "giving A skirmisher when next to B" as giving A a skirmishing ability with a filter saying that there is at most one enemy unit with level > 0 in adjacent hexes. My thought is that this filter expression will match regardless of whether A is attacking B, and hence allow A to violate B's ZoC even it it doesn't attack.

The moveto event, if I recall correctly, only fires for the destination hex, not every hex travelled over, and hence can not interrupt a move either.

If I err, please tell me where.
User avatar
Simons Mith
Posts: 821
Joined: January 27th, 2005, 10:46 pm
Location: Twickenham
Contact:

Re: Bending ZoC Rules

Post by Simons Mith »

When the unit attacks, record how many movement points it has at that point. If it kills its opponent, and there is not another opponent within one hex, give them back to it.

If that's what you want, I believe it could be coded. I've often given units thier movement back in debug mode when mucking about. If you have something else in mind, I have not understood what you meant to say.
 
meriton
Posts: 77
Joined: March 17th, 2007, 1:17 pm

Re: Bending ZoC Rules

Post by meriton »

The moveto-event fires before the attack event, doesn't it?
meriton wrote:I tried storing the unit in the moveto-event and record unit.moves to a variable, but unit.moves is already 0 because the ZoC rule has already been taken into account.
Lord_Aether
Posts: 127
Joined: November 11th, 2005, 9:06 am
Location: California

Re: Bending ZoC Rules

Post by Lord_Aether »

Woops, sorry. I guess I misunderstood what you meant :P
Mac OS X 10.5.7
Wesnoth 1.6.2
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Re: Bending ZoC Rules

Post by zookeeper »

meriton wrote:Wouldn't this allow A to walk right past B without fighting?
Yeah, that's true. So I'd say it's simply impossible to do currently.
Post Reply