Add new ability to a type of unit
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.
Add new ability to a type of unit
I am trying to add a new ability to some type of units but it isn't working. I think I am using wrong [unit_type] but I am not sure what to do.
Code: Select all
#define MAKE_HEALERS
[set_variables]
name=special
[value]
id=NE Ancient Wose Shaman
[/value]
[value]
id=Ne Saurian Holy
[/value]
[value]
id=NE Saurian Prophet
[/value]
[value]
id=NE_Saurian Healer
[/value]
[value]
id=NE Saurian Devotee
[/value]
[value]
id=NE Healer Mage
[/value]
[value]
id=NE Nature Mage
[/value]
[value]
id=NE Woods Mage
[/value]
[/set_variables]
{FOREACH special index}
[store_unit]
[filter]
id=$special[$index].id
[/filter]
variable=unit
[/store_unit]
[unit_type]
[base_unit]
id=$special[$index].id
[/base_unit]
[abilities]
{ABILITY_HEALER $unit.abilities.heals.value}
[/abilities]
[/unit_type]
{NEXT medic}
#enddef
- James_The_Invisible
- Posts: 533
- Joined: October 28th, 2012, 1:58 pm
- Location: Somewhere in the Northlands, fighting dark forces
- Contact:
Re: Add new ability to a type of unit
As far as I know, you cannot define unit types during a scenario. If you want to give some units an ability in scenario, [object] is the way to go. But be aware that object is applied only to first unit matching filter so in order to give it to multiple units you should use it in a cycle (FOREACH).
Also you used macro NEXT incorrectly. It should be {NEXT index} (just like second argument of FOREACH macro).
Also you used macro NEXT incorrectly. It should be {NEXT index} (just like second argument of FOREACH macro).
My content: For Power series
Ports: Danse Macabre Story of the Wose
Guides: How to translate your UMC
Ports: Danse Macabre Story of the Wose
Guides: How to translate your UMC
Re: Add new ability to a type of unit
So, it won't affect all the unit who share the same id? Also I'm not doing an scenario. I just want to give this abilities in the normal play. Is it the same?James_The_Invisible wrote:As far as I know, you cannot define unit types during a scenario. If you want to give some units an ability in scenario, [object] is the way to go. But be aware that object is applied only to first unit matching filter so in order to give it to multiple units you should use it in a cycle (FOREACH).
Also you used macro NEXT incorrectly. It should be {NEXT index} (just like second argument of FOREACH macro).
Re: Add new ability to a type of unit
Normally, no two units should have the same ID. You can check this via :inspect, there should be some suffix to distinguish them. You should filter unit type instead, and iterate over each unit.
- James_The_Invisible
- Posts: 533
- Joined: October 28th, 2012, 1:58 pm
- Location: Somewhere in the Northlands, fighting dark forces
- Contact:
Re: Add new ability to a type of unit
So you are making a multiplayer era/modification? Well, it does not really matter in the end, [unit_type] should do nothing in [scenario]/[multiplayer]/[era]/[modification].
My content: For Power series
Ports: Danse Macabre Story of the Wose
Guides: How to translate your UMC
Ports: Danse Macabre Story of the Wose
Guides: How to translate your UMC
Re: Add new ability to a type of unit
Oh, I am doing a multiplayer era, which also has a modification. So I can't give a new ability to some types of units?James_The_Invisible wrote:So you are making a multiplayer era/modification? Well, it does not really matter in the end, [unit_type] should do nothing in [scenario]/[multiplayer]/[era]/[modification].