Changing unit type mid-campaign?
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.
Changing unit type mid-campaign?
Hey, is it possible to change a unit type mid-campaign?
As in, unit x was a frog in the first few campaigns, and then in the start of the next scenario gets kissed by a girl or sth and then changes into a prince.
I want him to keep the xp he had as a frog. Is that doable?
As in, unit x was a frog in the first few campaigns, and then in the start of the next scenario gets kissed by a girl or sth and then changes into a prince.
I want him to keep the xp he had as a frog. Is that doable?
Easily. Research [store_unit] - the most powerful tool at a campaign-writer's disposal.
Example:
Example:
Code: Select all
[store_unit]
[filter]
description=Frogman
[/filter]
variable=temp
kill=yes
[/store_unit]
[set_variable]
name=temp.type
value=Prince
[/set_variable]
[unstore_unit]
variable=temp
[/unstore_unit]
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
And I hate stupid people.
The World of Orbivm
So one could basically use the store_unit for knowing what level your hero is on?
Would it be something like this? Or is there a more elegant way of doing it?
I would use this for example to give my hero another name, like Lord "Something", instead of Master "Something", when he becomes level 2.
Would it be something like this? Or is there a more elegant way of doing it?
Code: Select all
[store_unit]
[filter]
description=Hero
[/filter]
variable=temp
[/store_unit]
[if]
[variable]
name=temp.type
value="lvl2 unit"
[/variable]
[then]
...
[/then]
[/if]
Yes, except in the [variable] tag replace "value" with "equals". You must consult the WML reference to learn the correct syntax. Another way to do it is to take advantage of the "advance" event, which triggers when the unit levels up. If you keep track of level-ups it would be easier to know when to change his name.niceman wrote:So one could basically use the store_unit for knowing what level your hero is on?
Would it be something like this? Or is there a more elegant way of doing it?
I would use this for example to give my hero another name, like Lord "Something", instead of Master "Something", when he becomes level 2.Code: Select all
[store_unit] [filter] description=Hero [/filter] variable=temp [/store_unit] [if] [variable] name=temp.type value="lvl2 unit" [/variable] [then] ... [/then] [/if]
Hope springs eternal.
Wesnoth acronym guide.
Wesnoth acronym guide.