Usage of variation

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
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Usage of variation

Post by turin »

It looks to me like the only ways to make a unit switch to one of its [variation]s are either to have an [object] give it to the unit, or store the unit and set $temp.variation equal to the name of the variation. I have elected to do the latter, since [object] was acting funny. So...


My question is, how can I later REMOVE the variation? I tried setting $temp.variation to a null string, and I tried clearing $temp.variation (using [clear_variable]); neither worked.



Here's the code I used (for the latter method):

AT SOME POINT IN START EVENT:

Code: Select all

		[store_unit]
			[filter]
			description=Ravanal
			[/filter]
		variable=temp
		kill=yes
		[/store_unit]
		[set_variable]
		name=temp.variation
		value=invisible
		[/set_variable]
		[unstore_unit]
		variable=temp
		[/unstore_unit]
		[clear_variable]
		name=temp
		[/clear_variable]
AT SOME POINT LATER IN THE SCENARIO:

Code: Select all

		[store_unit]
			[filter]
			description=Ravanal
			[/filter]
		variable=temp
		kill=yes
		[/store_unit]
		[clear_variable]
		name=temp.variation
		[/clear_variable]
		[unstore_unit]
		variable=temp
		[/unstore_unit]
		[clear_variable]
		name=temp
		[/clear_variable]

Giving him the initial variation is working, but when I try to take it away, it doesn't. It leaves him exactly as he was before.
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
scott
Posts: 5248
Joined: May 12th, 2004, 12:35 am
Location: San Pedro, CA

Post by scott »

As far as I know effects can't be erased. What if you invoked variation 1 then later on invoke variation 2? Make variation 2 be identical to the normal version of the unit. The Battle for Wesnoth in SVN uses an invisible object to invoke a variation if you want an example.

Edit: what about this?
turin wrote: AT SOME POINT LATER IN THE SCENARIO:

Code: Select all

		[store_unit]
			[filter]
			description=Ravanal
			[/filter]
		variable=temp
		kill=yes
		[/store_unit]
		{VARIABLE temp.variation (" ")}
		[unstore_unit]
		variable=temp
		[/unstore_unit]
		[clear_variable]
		name=temp
		[/clear_variable]
Hope springs eternal.
Wesnoth acronym guide.
User avatar
turin
Lord of the East
Posts: 11662
Joined: January 11th, 2004, 7:17 pm
Location: Texas
Contact:

Post by turin »

:? I definitely don't want to have a whole second variation just so I can switch back... I'll try your suggestion. Just might work.
For I am Turin Turambar - Master of Doom, by doom mastered. On permanent Wesbreak. Will not respond to private messages. Sorry!
And I hate stupid people.
The World of Orbivm
Post Reply