Changing Alignment with a Trait
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.
- BedazzleHooves
- Posts: 9
- Joined: October 12th, 2014, 9:45 pm
- Location: United States, Colorado
Changing Alignment with a Trait
Howdy all... I'm trying to make my first add-on and I am pretty far along, but there is one thing I can't seem to figure out....
I want to add a trait that changes alignment. Like if a Loyalist_Spearman spawned with the trait "Darkheart", they would be Chaotic.
I've tried quite a few ways and this is what I have now... It doesn't crash, but it also doesn't work. All the rest of my traits work fine, but I just don't know what to do to fix this one. Any advice would be greatly appreciated.
I want to add a trait that changes alignment. Like if a Loyalist_Spearman spawned with the trait "Darkheart", they would be Chaotic.
I've tried quite a few ways and this is what I have now... It doesn't crash, but it also doesn't work. All the rest of my traits work fine, but I just don't know what to do to fix this one. Any advice would be greatly appreciated.
Code: Select all
#define TRAIT_DARKHEART
[trait]
id=BH_Darkheart
male_name=_"Darkheart"
female_name=_"female^Darkheart"
description=_"Is Chaotic."
[effect]
apply_to=alignment
replace=yes
alignment=chaotic
[/effect]
[/trait]
#enddef
Co-Op for all!
Re: Changing Alignment with a Trait
Not something I've tried, but I think you could define a chaotic [variation], if this is a unit you are writing the code for, then use [trait]/[effect] to apply that variation.
BfW 1.12 supported, but active development only for BfW 1.13/1.14: Bad Moon Rising | Trinity | Archaic Era |
| Abandoned: Tales of the Setting Sun
GitHub link for these projects
| Abandoned: Tales of the Setting Sun
GitHub link for these projects
Re: Changing Alignment with a Trait
Havent tried this with trait, only ability, but +tag way might work here too.
Re: Changing Alignment with a Trait
Other ways proposed can also work. I have changed aligments and my aproach would be write an event inside unit that fires for unit with trait "darkheart"
Code: Select all
[trait]
id=darkheart
male_name= "darkheart"
female_name= "femmale^darkheart"
description= "bla bla bla"
[/trait]
[event]
id=darkheart_aligment
name=post advance,recruit
first_time_only=no
[filter]
[filter_wml]
[modifications]
[trait]
id=darkheart
[/trait]
[/modifications]
[/filter_wml]
[/filter]
[modify_unit]
[filter]
x,y=$x1,$y1
[/filter]
aligment=chaotic
[/modify_unit]
[/event]
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
World Conquest II
- BedazzleHooves
- Posts: 9
- Joined: October 12th, 2014, 9:45 pm
- Location: United States, Colorado
Re: Changing Alignment with a Trait
Thank you all for your aid. But I am still quite the noob....
This seems like it should work... however, it isn't working for me. I haven't ever put an event in a unit file before and am not quite sure where to put it... Does it go inside or outside the [unit_type] tags? Are there other tags that it needs embedded in? Any help with where to put it would be greatly appreciated.
From what I'm seeing, that would work great... however, there will be a lot of different units I would like to have this trait, and putting [variation] in all of them would take a long time from what I am seeing. Though I might not understand the code right (Been using WML for less than a week).doofus-01 wrote:Not something I've tried, but I think you could define a chaotic [variation], if this is a unit you are writing the code for, then use [trait]/[effect] to apply that variation.
I have used a trait to give a unit an ability in my Add-On already. If you could just tell me which ability it is so I can go take a look at it, I would be very thankful.Ravana wrote:Havent tried this with trait, only ability, but +tag way might work here too.
tekelili wrote:Other ways proposed can also work. I have changed aligments and my aproach would be write an event inside unit that fires for unit with trait "darkheart"
This seems like it should work... however, it isn't working for me. I haven't ever put an event in a unit file before and am not quite sure where to put it... Does it go inside or outside the [unit_type] tags? Are there other tags that it needs embedded in? Any help with where to put it would be greatly appreciated.
Co-Op for all!
Re: Changing Alignment with a Trait
I meant +tag like https://github.com/ProditorMagnus/Agele ... attack.cfg . Instead of attacks=2 you put what you want to change for each unit with that ability/trait. I believe with trait you just need to use different tags around code you want to change.
Re: Changing Alignment with a Trait
You can find an [event] inside [unit_type] looking ghoul. Anyway, that is more complicated than write events directly inside [scenario] and last one would work almost as well (I prefer it because assure load event in campaigns and keeps code near unit related). Use event is pretty straight forward but I guess is not the most clean solution for [era], because if you create a unit using [unit], it wouldn´t fire any event, so up to you if go for that solution.BedazzleHooves wrote:This seems like it should work... however, it isn't working for me. I haven't ever put an event in a unit file before and am not quite sure where to put it... Does it go inside or outside the [unit_type] tags? Are there other tags that it needs embedded in? Any help with where to put it would be greatly appreciated.tekelili wrote:Other ways proposed can also work. I have changed aligments and my aproach would be write an event inside unit that fires for unit with trait "darkheart"
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
World Conquest II