This demonstrates a way to give epithets based on ancillaries ("ancs"). It caters for the ancs to be of the same AncType and a character may hold more than one of them at the same time (therefore Transferable is allowed). It will also work for cases where the ancs have different AncTypes and/or only one at a time can be held by a character (and not Transferable), though in those cases this is a bit more complicated than it needs to be.
It contains some concepts and info that might be of interest for ancs/traits in general, not just anc-epithet situations.
Ancs can't give epithets, only traits can. So we assign the epithet to a new trait and only give that trait to a character when he has our anc. That is not a new concept but the technique of this tutorial takes it further:
- It removes the epithet when the character no longer has the anc. (Actually it replaces it with a blank one - see below.) Normally epithets remain until the character gets a new epithet.
- HasAncType is the only condition for testing that a character has a particular kind of anc. If your ancs are of the same Type (which is necessary sometimes) then HasAncType is of no use here; triggers won't know exactly which anc he has so can't know which trait to give him. The technique of this tutorial uses a different condition altogether - Attribute - to get around that.
- The epithet-giving traits are re-applied on a regular basis (e.g every turn). If a character gets another epithet from a 'standard' trait, e.g. "the Conqueror" after a battle, then he will get his anc-epithet back before very long (e.g. next turn end).
The example is a set of four "Governor" ancs. If a character has one of these then he gets a related epithet. e.g. Governor of London anc = "of London" epithet. If he has more than one of the ancs then he'll get one of those epithets. If his ancs change, so he’s now "Governor" of somewhere else, then his epithet will update accordingly. He loses the epithet when he no longer has any of the ancs.
Ancs:
Code:
;------------------------------------------
Ancillary GovOf_London
Type GovOf
Transferable 1
Image item_documents.tga
Description GovOf_London_desc
EffectsDescription GovOf_London_effects_desc
Effect Charm 1
;------------------------------------------
Ancillary GovOf_Nottingham
Type GovOf
Transferable 1
Image item_documents.tga
Description GovOf_Nottingham_desc
EffectsDescription GovOf_Nottingham_effects_desc
Effect Charm 2
;------------------------------------------
Ancillary GovOf_York
Type GovOf
Transferable 1
Image item_documents.tga
Description GovOf_York_desc
EffectsDescription GovOf_York_effects_desc
Effect Charm 4
;------------------------------------------
Ancillary GovOf_Caen
Type GovOf
Transferable 1
Image item_documents.tga
Description GovOf_Caen_desc
EffectsDescription GovOf_Caen_effects_desc
Effect Charm 8
Code:
{GovOf_London}Governor of London
{GovOf_London_desc}Governor of London
{GovOf_London_effects_desc}Effects...
{GovOf_Nottingham}Governor of Nottingham
{GovOf_Nottingham_desc}Governor of Nottingham
{GovOf_Nottingham_effects_desc}Effects...
{GovOf_York}Governor of York
{GovOf_York_desc}Governor of York
{GovOf_York_effects_desc}Effects...
{GovOf_Caen}Governor of Caen
{GovOf_Caen_desc}Governor of Caen
{GovOf_Caen_effects_desc}Effects...
The Charm effect is the key thing here. More on that later. Other effects may be added if desired.
That is, Charm is only for 'internal use' purposes, necessary for this to work. "Charm" should not be mentioned in the effects descriptions in-game - it serves no purpose to tell the player this. But if you wish these ancs to have normal effects as well, e.g. Command, then they can be added and mentioned in the descriptions. i.e. They are normal ancs that also have a 'hidden' Charm effect.
They all have the same Type: "GovOf". This is NOT necessary. You may give them different Types if you need to - it will not impact the workings of this technique.
They are all Transferable. Again, this is not necessary. You can make any or all of them non-Transferable if you need to.
Anc triggers:
Nothing special or new to show here. In this example they would probably be a bunch of triggers along the lines of "when turn-ending in London and GovOf_London anc does not exist in the faction/world then acquire it".
Traits:
First off, one trait for each anc...
Code:
;------------------------------------------
Trait GovOfEpithet_London
Characters family
Hidden
Level GovOfEpithet_London
Description hidden_desc
EffectsDescription hidden_desc
Epithet GovOfEpithet_London_epithet_desc
Threshold 1
;no effects
;------------------------------------------
Trait GovOfEpithet_Nottingham
Characters family
Hidden
Level GovOfEpithet_Nottingham
Description hidden_desc
EffectsDescription hidden_desc
Epithet GovOfEpithet_Nottingham_epithet_desc
Threshold 1
;no effects
;------------------------------------------
Trait GovOfEpithet_York
Characters family
Hidden
Level GovOfEpithet_York
Description hidden_desc
EffectsDescription hidden_desc
Epithet GovOfEpithet_York_epithet_desc
Threshold 1
;no effects
;------------------------------------------
Trait GovOfEpithet_Caen
Characters family
Hidden
Level GovOfEpithet_Caen
Description hidden_desc
EffectsDescription hidden_desc
Epithet GovOfEpithet_Caen_epithet_desc
Threshold 1
;no effects
Code:
{GovOfEpithet_London}GovOfEpithet_London
{GovOfEpithet_London_epithet_desc}of London
{GovOfEpithet_Nottingham}GovOfEpithet_Nottingham
{GovOfEpithet_Nottingham_epithet_desc}of Nottingham
{GovOfEpithet_York}GovOfEpithet_York
{GovOfEpithet_York_epithet_desc}of York
{GovOfEpithet_Caen}GovOfEpithet_Caen
{GovOfEpithet_Caen_epithet_desc}of Caen
{hidden_desc}(hidden trait; this won't be seen)
These are hidden traits, with no effects, just an epithet.
hidden_desc: As these traits are hidden we will never see their descriptions, so no need to write them. By pointing all of these descriptions to the one "{hidden_desc}" VNVs entry we save ourselves some time and effort. Somebody used this technique in the Workshop recently - I'd never seen it before and I like it a lot.
Two more traits:
Code:
;------------------------------------------
Trait GovOfEpithet_Any
Characters family
Hidden
Level GovOfEpithet_Any
Description hidden_desc
EffectsDescription hidden_desc
Threshold 1
;no effects
;------------------------------------------
Trait EpithetClearer
Characters family
Hidden
Level EpithetClearer
Description hidden_desc
EffectsDescription hidden_desc
Epithet EpithetClearer_epithet_desc
Threshold 1
;no effects
Code:
{GovOfEpithet_Any}GovOfEpithet_Any
{EpithetClearer}EpithetClearer
{EpithetClearer_epithet_desc}
^ a space character is here
These are both hidden traits with no effects.
EpithetClearer is used to remove the character's current epithet. Or rather, replace it with 'empty' text (a space). EpithetClearer_epithet_desc has a single space character after the "}".
More on these traits shortly.
Trait triggers:
Code:
;------------------------------------------
Trigger GovOfClearer_trigger1
WhenToTest CharacterSelected
Condition Trait GovOfEpithet_Any > 0
Affects GovOfEpithet_London -999 Chance 100
Affects GovOfEpithet_Nottingham -999 Chance 100
Affects GovOfEpithet_York -999 Chance 100
Affects GovOfEpithet_Caen -999 Chance 100
;------------------------------------------
Trigger GovOfClearer_trigger2
WhenToTest CharacterSelected
Condition Trait GovOfEpithet_Any > 0
Affects GovOfEpithet_Any -999 Chance 100
Affects EpithetClearer -999 Chance 100
Affects EpithetClearer 1 Chance 100
;------------------------------------------
Trigger GovOf_London_trigger1
WhenToTest CharacterSelected
Condition IsGeneral
and Attribute Charm = 1
Affects GovOfEpithet_London 1 Chance 100
Affects GovOfEpithet_Any 1 Chance 100
;------------------------------------------
Trigger GovOf_Nottingham_trigger1
WhenToTest CharacterSelected
Condition IsGeneral
and Attribute Charm >= 2
and Attribute Charm < 4
Affects GovOfEpithet_Nottingham 1 Chance 100
Affects GovOfEpithet_Any 1 Chance 100
;------------------------------------------
Trigger GovOf_York_trigger1
WhenToTest CharacterSelected
Condition IsGeneral
and Attribute Charm >= 4
and Attribute Charm < 8
Affects GovOfEpithet_York 1 Chance 100
Affects GovOfEpithet_Any 1 Chance 100
;------------------------------------------
Trigger GovOf_Caen_trigger1
WhenToTest CharacterSelected
Condition IsGeneral
and Attribute Charm >= 8
Affects GovOfEpithet_Caen 1 Chance 100
Affects GovOfEpithet_Any 1 Chance 100
There are two "Clearer" triggers at the top followed by one trigger for each anc-epithet. The Clearer triggers must be above the others.
Firstly, notice that when any of the four epithet traits is given to a character he is also given the GovOfEpithet_Any trait. This marks him as "I have at least one of the governor epithet traits".
GovOfClearer_trigger1: this removes all governor epithet traits from the character, if he has any of them (that is, if he has the GovOfEpithet_Any trait). Removal of these traits is achieved by reducing their points by a large number. 999 is an arbitrary choice, so long as it is more than however many points the character could possibly have. They SHOULD only ever have 1 point in these traits but, just to be sure, we reduce the points by A LOT. Points never go below 0, no matter how much you subtract from them.
At this point he no longer has any governor epithet traits. He does still have the GovOfEpithet_Any trait (if he had it coming into this trigger). Then the next trigger fires...
GovOfClearer_trigger2: This, too, only fires if he has the GovOfEpithet_Any trait. It does two things:
1) Removes the GovOfEpithet_Any trait - because he no longer has any.
2) Gives him the EpithetClearer trait (removing it first in case he already has it). i.e. It removes his current epithet, replacing it with nothing (as explained above).
At this point he no longer has any governor epithet traits, no GovOfEpithet_Any trait and no governor epithet. Then come the triggers to decide which governor epithet trait to give him...
SIDENOTE: The chances are that his ancs have not changed since the last time all of this fired upon him, in which case we're about to give him back the very same trait epithet that we just removed. But it needs to be this way because the triggers don't know whether the ancs have changed or not, especially as the ancs are transferable. At any point he might have a governor epithet for an anc that he no longer owns. So all we can do is wipe the slate entirely clean every time and re-apply the epithets based on what he has now.
GovOf_London_trigger1: Easy. If he has Charm = 1 then that must mean that he has the London anc and no other governor anc. If he did have another governor anc then those Charms would sum up to some other number, so =1 would be false and this trigger won't do anything. So he gets the London trait and therefore its epithet.
The other triggers: These figure out which anc he has and give the associated trait, and this is based purely on how much Charm he has (which the ancs give):
Charm = 1 -> London anc
Charm = 2 -> Nottingham anc
Charm = 4 -> York anc
Charm = 8 -> Caen anc
If he could only have one governor anc at a time then simple "=" checks like that would suffice. But he CAN have more than one at a time. If he has both London and York then his total Charm is 5 which does not match any of our anc Charm values. Hence the need for >= and < checks instead.
This, too, is why the ancs have those unusual Charm values. They're not 1, 2, 3 & 4, they're 1, 2, 4 & 8. Each value is always greater than the sum of all values below it. e.g. If he has London and Nottingham then his Charm = 3, which is less than the next anc (York = 4). If he has London, Nottingham and York then his total Charm is 7, which is less than the next anc (Caen = 8). Therefore, if his total Charm is >= 8 then he MUST have the Caen anc (and possibly others). And if his total Charm is >= 4 and < 8 then he MUST have the York anc (and possibly others) but NOT the Caen anc.
So if he has London and York, which epithet does he get? York. He can only have one epithet at a time anyway and 'highest' wins this contest: if he has more than one anc then whichever of those has the highest Charm is the one whose epithet is given.
How many anc-epithets can this handle?
32. (In theory, 30 in reality? See update at end of this section.) The Charm values would be...
Code:
Anc# Charm
1 1
2 2
3 4
4 8
5 16
6 32
7 64
8 128
9 256
10 512
11 1024
12 2048
13 4096
14 8192
15 16384
16 32768
17 65536
18 131072
19 262144
20 524288
21 1048576
22 2097152
23 4194304
24 8388608
25 16777216
26 33554432
27 67108864
28 134217728
29 268435456
30 536870912
31 1073741824
32 2147483648
Yes, Effect values are allowed to go that high! Turns out the highest allowed value is 4294967295, which is 1 less than 2^32. I don't know if all effects can but I tested this on Charm.
If 32 isn't enough then another bank (up to 32 again) can be used with a different effect type, e.g. NavalCommand. And so on. In that case he might end up with two traits (e.g. a Charm-triggered one and a NavalCommand-triggered one) but that’s okay, he’ll only keep the epithet of one of them.
However, bear in mind that triggers can (always?) CTD if they have more than 10 Affects lines. i.e. GovOfClearer_trigger1 can only have 10 Affects lines so if you need more than 10 ancs/traits then you'll need to create a new trigger like that one to do the next 10 traits, and so on, until all of the traits are catered for. That is why I made GovOfClearer_trigger2 a separate trigger, because it's quite likely that there will be more than one of those GovOfClearer_trigger1 ones, and the GovOfClearer_trigger2 stuff should only be done once, after those others are done.
NOTE: if a fifth anc was added then GovOf_Caen_trigger1 would need an extra condition: "and Attribute Charm < 16". 16 being the Charm level of anc# 5.
Also, notice that GovOf_London_trigger1 doesn't use >= and < conditions, simply an =1 condition. It could have been written as ">= 1 and < 2" instead but that’s just a long way of saying "= 1".
UPDATE: 30 per effect type is the limit I think. I experienced some strange behaviour with the 31st and 32nd values. The 31st's required value checks of [>= 1073741824 and < 2147483648] simply didn't work in giving him the trait. No idea why not. The 32nd I had as simply [>= 2147483648] and the trait was being acquired by pretty much everybody in the faction. Adding the check [and < 4294967295] seemed to fix it. Weird. Not sure that I trust that, and 31st seems like a no-goer, so just stick with 30 I say.
Charm?
Charm is not an effect that named character types normally use. You can use other effect types but not something that will impact their behaviour (like Command would) and not something that other ancs/traits will be giving him because that will screw up the Attribute value checks of these triggers.
Others that spring to mind are NavalCommand, Subterfuge, Magic.
Why CharacterSelected?
I chose this as the event for the triggers for ease of testing: use the console to give/remove ancs and then select the character to see if/how the epithet changed.
I suggest CharacterTurnStart instead. However, it might be an idea also to duplicate all of those triggers and give them a CharacterSelected event. That way if the ancs change during the player's turn (e.g. transferring ancs) then the epithets will update when you next click on the character instead of having to wait for next turn end.
The triggers should go at the end of EDCT, at least after any other triggers that might be giving other trait-epithets in the game. It's not critical to do this, it will just reduce the likelihood that the characters will lose their anc-epithet for something else (e.g. "the Cruel") until next time the anc-epithet triggers fire.
Epithet Removal
As explained above, the EpithetClearer trait is used to replace his current epithet with a space character, which is text that can't be seen, which gives the impression that he now has no epithet.
Even though his epithet appears to have been removed he does still have one (an 'empty' one). Which means that if he originally had a surname then he will not get that surname back. That was always the case with epithets: as soon as he gets one he forever loses his surname. This 'empty' epithet is no different in that regard.
A character will only ever get this trait (and empty epithet) if he currently has any of these anc-traits. If he doesn't then he will keep his surname or other game/mod epithet (e.g. "the Cruel") until such time that he does get one of these ancs and the triggers fire on him. i.e. Using this technique does not mean that everybody will always lose their surnames or other epithets.