How do I code the event return to village before upgrading?

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
Jaca_the_Elf
Posts: 5
Joined: May 2nd, 2017, 1:21 pm

How do I code single move turns?

Post by Jaca_the_Elf »

Can anyone code single move turns, so that you can play Wesnoth like chess?
Jaca_the_Elf
Posts: 5
Joined: May 2nd, 2017, 1:21 pm

How do I code the event return to village before upgrading?

Post by Jaca_the_Elf »

Can anyone code the event of returning to a village as a condition for upgrading a unit?
User avatar
Ravana
Forum Moderator
Posts: 3009
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: How do I code the event return to village before upgradi

Post by Ravana »

Chess-type movement has already been done. You can download those addons and see how it is done there.
User avatar
The_Gnat
Posts: 2217
Joined: October 10th, 2016, 3:06 am
Contact:

Re: How do I code the event return to village before upgradi

Post by The_Gnat »

Coding advancement after moving to a village would be complicated.

You probably could create a pre advance event that makes a unit advance to nothing but meanwhile stores what it advances to.

Then it wouldn't advance even though it has plenty of experience.

Then when it moves to a village you could reset it's advancement with the variable you stored.
User avatar
beetlenaut
Developer
Posts: 2825
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: How do I code the event return to village before upgradi

Post by beetlenaut »

The_Gnat wrote:Coding advancement after moving to a village would be complicated.
I don't think it has to be that hard. I'm pretty sure this would work just fine: You could make an pre_advance event that stored and killed the unit (except in castles and villages), which would prevent the advancement from taking place. Then you could unstore the unit using "advance=no," and the XP would be left over the maximum. You would also need an event that would store and unstore any unit that moved into a village or castle using "advance=yes." Most of the time it wouldn't have any effect, but if the unit had XP over the maximum, it would level.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Jaca_the_Elf
Posts: 5
Joined: May 2nd, 2017, 1:21 pm

Re: How do I code the event return to village before upgradi

Post by Jaca_the_Elf »

Ravana wrote:Chess-type movement has already been done. You can download those addons and see how it is done there.
Thanks for your reply. Is there actually an add-on that would work for random maps or even campaigns? What's it called? I have only found one chess add-on, but I think it only works for the corresponding chess-like map.
User avatar
Ravana
Forum Moderator
Posts: 3009
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: How do I code the event return to village before upgradi

Post by Ravana »

The one that only works on single map is good enough to get the events that control such movement.
Post Reply