movement question

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
revenant
Posts: 49
Joined: January 9th, 2010, 3:41 pm

movement question

Post by revenant »

Is there a way to increase a unit's movement for a limited amount of time, say 1 turn? If so then can someone tell me what it is.

Thanks.
User avatar
Luke the Flaming
Posts: 215
Joined: October 18th, 2006, 6:25 pm

Re: movement question

Post by Luke the Flaming »

Have an [event] triggering when you wish (using proper name= and [filter] ) to:
-) store the unit;
-) modify its movement (+1);
-) add a variable (let's say "extra_mov=yes") in its [variables] ;
-) unstore the unit.

Have another [event] with name=side 1 turn (assuming it's side 1 that you want to affect, otherwise modify it accordingly; and don't forget first_time_only=no !) storing units with extra_mov=yes (use [filter_wml] inside [filter] ), reducing their movement by 1, removing the extra_mov variable and unstoring them.


If you want effects lasting longer than 1 turn (e.g. 3), set extra_mov="$turn_number+3" rather than "yes" and check when extra_mov is equal to $turn_number to end the effect.
O, Wind, if Winter comes, can Spring be far behind?
Anonymissimus
Inactive Developer
Posts: 2461
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: movement question

Post by Anonymissimus »

If it's just one turn for some specific units, do {VARIABLE unit.moves $new_movement} (store it previously, unstore afterwards), in the next turn it'll be unit.max_moves again, then.
A good way to let something happen a fixed number of turns than something else is a structure like (untested)

Code: Select all

	[event]
		{VARIABLE turns "$($turn_number + 1)"}
		[event]
			name=turn $turns
			delayed_variable_substitution=no
		[/event]
	[/event]
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
revenant
Posts: 49
Joined: January 9th, 2010, 3:41 pm

Re: movement question

Post by revenant »

O.K. thanks guys.
Post Reply