Changing unit types
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.
- DeCoolest_Cat
- Posts: 128
- Joined: December 5th, 2015, 8:29 pm
Changing unit types
In my campaign, there is a scenario similar to "Capturing the Ogres" in Eastern Invasion. You recruit dwarves to try and capture bears. So lets say I recruit two thunderers and a fighter. I have also created bear rider units (with fighter and thunderer variants). I want to know is there any way to change the fighter to the fighter version of the bear rider, and the thunderer to their version of the bear rider in the next scenario. I'm assuming it would have to be done in the recall list, but correct me if I'm wrong.
Author of beta campaign Kalbruk's Journey - My art thread - My collection of single player scenarios: The Archives
Re: Changing unit types
Wouldnt {VARIABLE unit.type bear_thunderer} work for you? If those different variants have same type then you might need to use [object] to select which one.
Doesnt matter much if you want to do it in recall list of normally.
Doesnt matter much if you want to do it in recall list of normally.
- DeCoolest_Cat
- Posts: 128
- Joined: December 5th, 2015, 8:29 pm
Re: Changing unit types
I'm not entirely sound with variables, but most likely it would. However, would something like this here work as well?Ravana wrote:Wouldnt {VARIABLE unit.type bear_thunderer} work for you?
Code: Select all
[if]
[have_unit]
type=Dwarvish Thunderer
[/have_unit]
[then]
[modify_unit]
type=Bear Thunderer
[/modify_unit]
[/then]
[/if]
Author of beta campaign Kalbruk's Journey - My art thread - My collection of single player scenarios: The Archives
Re: Changing unit types
DirectActionsWML#.5Btransform_unit.5D looks like what you want.
- DeCoolest_Cat
- Posts: 128
- Joined: December 5th, 2015, 8:29 pm
Re: Changing unit types
Thanks, zookeeper. So if I read that correctly I would change "[modify_unit]" to "[transform_unit]" and "type=" to "transform_to="?
Author of beta campaign Kalbruk's Journey - My art thread - My collection of single player scenarios: The Archives
Re: Changing unit types
Yes. Notice that unless you also include some filter, it will change all units.
- DeCoolest_Cat
- Posts: 128
- Joined: December 5th, 2015, 8:29 pm
Re: Changing unit types
So this would be it? If so, thanks to both of you!
Code: Select all
[if]
[have_unit]
type=Dwarvish Thunderer
[/have_unit]
[then]
[transform_unit]
[filter]
type=Dwarvish Thunderer
[/filter]
transform_to=Bear Thunderer
[/transform_unit]
[/then]
[/if]
Author of beta campaign Kalbruk's Journey - My art thread - My collection of single player scenarios: The Archives
Re: Changing unit types
Except it said not to use a [filter] tag.
- DeCoolest_Cat
- Posts: 128
- Joined: December 5th, 2015, 8:29 pm
Re: Changing unit types
Forgot about that. So should I put the [filter] tags outside of the [transform_unit] tags?
Author of beta campaign Kalbruk's Journey - My art thread - My collection of single player scenarios: The Archives
Re: Changing unit types
No, just remove them. And you don't need the [if] [have_unit] [then] construct ([transform_unit] will just do nothing if no unit matches the filter)DeCoolest_Cat wrote:should I put the [filter] tags outside of the [transform_unit] tags?
Note that [transform_unit]:
- does not modify hit points and move points (just max hit points and max move points), so you may want to add some code to handle this,
- does not work on units in the recall list (as it is unclear to me when you want the change to happen).