Results 1 to 30 of 72

Thread: AntiTraits : now what the heck is happening here ?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Village special needs person Member Kobal2fr's Avatar
    Join Date
    Nov 2006
    Location
    Paris, France
    Posts
    914

    Default AntiTraits : now what the heck is happening here ?

    Buggy as hell, or I don't get how things should work ?

    My understanding was that when a character had a given trait, and gained one point in it's anti-trait, then said trait gets -1, anti-trait 0, and that's it.

    But I'm beginning to believe that when you gain 1 point in an anti-trait, the trait simply disappears altogether ! Which would explain why Assassins failing their missions go from "Experienced Assassin" to "Simpleton".

    Case in point : start a campaign as Scotland. The prince has 2 StrategyDread, 2 BattleDread. I use him to capture York. Win, choose Occupy City, which gives 1 StrategyChivalry : all StrategyDread vanishes, instead of being reduced to 1.

    So, are antitraits really meant to be "remove all levels of opposing traits when you gain this" ?
    Because if that's the case... maaaan does there need to be a LOT more triggers and fixes to the traits files :/

    And if they aren't, CA needs to be told FAST.

    How were they used in RTW, does anyone know ?
    Last edited by Kobal2fr; 12-21-2006 at 19:40.
    Anything wrong ? Blame it on me. I'm the French.

  2. #2
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: AntiTraits : now what the heck is happening here ?

    Yes I suspect that, too.
    In RTW they worked differently (1 point in AntiTrait resulted in -1 in the Trait), but maybe they changed that behaviour deliberately in MTW2, because you can use negative affects values to make traits go lower.
    However, I don't think that is the case and it is indeed a bug.

  3. #3
    Ricardus Insanusaum Member Bob the Insane's Avatar
    Join Date
    Sep 2002
    Location
    London, UK
    Posts
    1,911

    Default Re: AntiTraits : now what the heck is happening here ?

    In Vices & Virtues FIXES v1.0 -

    See:

    https://forums.totalwar.org/vb/showthread.php?t=75661

    and:

    https://forums.totalwar.org/vb/local....php?catid=135


    The author stats:

    "Assasssins / Princesses / Diplomats losing all Good- traits instead of one point on unsuccessful mission: Now working as intended, failed missions now only reduce trait by one point."

    Could this be related?

  4. #4

    Default Re: AntiTraits : now what the heck is happening here ?

    Was it not working ok in 1.0? I seem to remember my assassins kept missing but didn't lose all their skills..

  5. #5
    Masticator of Oreos Member Foz's Avatar
    Join Date
    Dec 2006
    Posts
    968

    Default Re: AntiTraits : now what the heck is happening here ?

    LOL! You're always a step ahead of me, Kobal. I was thinking yesterday that I would come on today and start up a thread about antitraits since I wasn't sure how exactly they were working or were supposed to be working. I show up, and voila, you already have one up. Good stuff.

    As for the potential bug where agents commonly lose massive amounts of skill by failing, I'm fairly certain the antitraits code is at fault as you've suggested. We can presumably see all the pertinent triggers in the traits file for various agents failing missions. None of them give more than 1 point to any of the bad traits, nor do I see any particular failure situation that should result in 3 or more triggers (they could gang up to produce the effect we're all noticing - I use 3, because I know I've witnessed an agent lose at least that much skill from 1 failure before)... yet I too have noticed whole trait lines just vanish. So what is going on? If nothing we can see in the traits file can cause it to happen, it must be something we can't see, and antitraits code is about the only thing we can't see that would be A. associated with traits in any way and B. also designed to affect them. So in the presence of a very likely theory and the absence of any other reasonable explanation, I think we should operate under this assumption until we have reason not to.

    Next topic: is the effect of antitraits as intended? I say no. It creates a ridiculous back-and-forth effect in traits, as a powerful line can just immediately vanish, and the character starts down the opposite road. The fact that RTW used them as the 3 of us intuitively think it should be is another indicator that it hasn't ended up doing what they intended. Why would the devs intentionally change a mechanic that is liked well enough and functions properly? I would also suggest that we ought to change it, even if it is as intended - a majority of people seem to not like the harsh punishment for agent failures, and agree that it is suspicious and unbalanced at best. I'm open to hear views though, if anyone isn't as sure that we should find a workaround.

    So... if we are to make it work as we think it was intended, then what must be done? My idea is to avoid the antitrait mechanic by just giving -1 point to the appropriate trait in any situation where its opposite would normally receive an antitrait point. As far as I can see, the workaround goes like this:

    - Remove all antitrait references from the trait entries. This is because we will have to set them up without using the antitrait mechanic to avoid the problematic code that we can't get at. Note that this is the last thing to do, so you don't lose track of what traits are opposites!

    - Duplicate each trigger that contains an antitrait (not the word, but a trait that has one or more opposite) so you end up with a pair of triggers per antitrait it can give a point (or more) to: i.e. 3 possible antitraits makes 2(3) = 6 triggers necessary. This is because we will use "Affects OppositeTrait -1 Chance n" to work around the antitrait code. Since you want to still allow bad traits to happen, the extra triggers will be necessary to determine when a trait already has point(s) and should be decremented instead of the opposite trait being incremented.

    - Setup the triggers for each event in pairs (one is for the antitrait being > 0, the other for not > 0), and change the Affects lines accordingly.

    So if the original trigger could give BadAdministrator and BadTaxman, each pair of new triggers now corresponds to one of the two traits' anti-traits: The first pair will check for GoodAdministrator > 0, while the second checks for GoodTaxman > 0. If either one is true, we'll subtract from the Good trait instead of adding to the Bad one (which would cause the anti-trait code we're working around). So a trigger like this:

    Trigger trigger1
    When ToTest CharacterTurnEnd

    Condition Original_Conditions

    Affects BadAdministrator 1 Chance 3
    Affects BadTaxman 1 Chance 3

    Becomes something like this:

    Trigger trigger1
    WhenToTest CharacterTurnEnd

    Condition Original_Conditions
    and not GoodAdministrator > 0

    Affects BadAdministrator 1 Chance 3

    Trigger trigger2
    WhenToTest CharacterTurnEnd

    Condition Original_Conditions
    and GoodAdministrator > 0

    Affects GoodAdministrator -1 Chance 3

    Trigger trigger3
    WhenToTest CharacterTurnEnd

    Condition Original_Conditions
    and not GoodTaxman > 0

    Affects BadTaxman 1 Chance 3

    Trigger trigger4
    WhenToTest CharacterTurnEnd

    Condition Original_Conditions
    and GoodTaxman > 0
    Affects GoodTaxman -1 Chance 3

    If I'm wrong on any of this, just let me know.

    Also as a side note... each trigger with n different possible anti-trait effects now will require 2n separate triggers. IIRC some triggers have as many as 5 traits, so this might be a lot of additions...


    See my Sig+ below! (Don't see it? Get info here)

  6. #6
    Guardian of the Fleet Senior Member Shahed's Avatar
    Join Date
    Oct 2002
    Location
    Leading the formation!
    Posts
    7,918

    Default Re: AntiTraits : now what the heck is happening here ?

    Something I wanted to add.

    No going back levels are not working either. It happens that you've reached the no going back level for a trait, but if you pop an anti-trait it can completely remove your trait line, even though your character is supposed to have passed the threshold for possible loss of this trait.
    If you remember me from M:TW days add me on Steam, do mention your org name.

    http://www.steamcommunity.com/id/__shak

  7. #7

    Default Re: AntiTraits : now what the heck is happening here ?

    Quote Originally Posted by Bob the Insane
    In Vices & Virtues FIXES v1.0 -

    See:

    https://forums.totalwar.org/vb/showthread.php?t=75661

    and:

    https://forums.totalwar.org/vb/local....php?catid=135


    The author stats:

    "Assasssins / Princesses / Diplomats losing all Good- traits instead of one point on unsuccessful mission: Now working as intended, failed missions now only reduce trait by one point."

    Could this be related?
    Hey folks, found this problem when I first started modding M2 traits (I authored the Vices & Virtues FIXES mod, different username on this forum :) ), and managed to hotfix it, but there does seem to be a hardcode problem.

    Just like to say hi to Kobal quickly, and thank you for your mod, you found a lot of stuff that I missed out first time round, was most helpful being able to see someone else's mod along the same lines, so thanks!

    I think, but haven't tested thoroughly, that a part of the anti-trait hardcode is broken. In RTW, anti-traits had two functions. One, having X trait would disallow any of its anti-traits. Two, 1 point in that trait would = -1 point in the anti-traits. This meant that the RTW triggers operated a scale between trait & anti-trait like thus:

    EXAMPLE

    BadCommander 4 3 2 1 NEUTRAL 0 NEUTRAL 1 2 3 4 5 6 GoodCommander

    So the triggers which give 1 point in BadCommander for losing a battle would simply take 1 point off GoodCommander if that character had points in GoodCommander. NoGoingBackLevels would simply mean that once the character was advanced enough in a trait, he wouldn't lose it past that level.

    In Medieval 2, it seems that code is broken. So if you gain 1 point in BadCommander, that trait will appear, and since GoodCommander is the anti-trait, it will dissapear. The new trait overrides the old anti-trait. The result was that if there isn't a NoGoingBackLevel, then as soon as you gain 1 point in the Bad- trait, you will lose all points in any GoodTrait. If there is a NoGoingBackLevel, as soon as you gain 1 point in the Bad- trait, you will go straight to the NoGoingBackLevel of the Good- trait.

    This is a little annoying. However, -1 Trait as a trigger value still works, so my fix (example for diplomats) is this:

    ;------------------------------------------
    Trigger agents27
    WhenToTest DiplomacyMission

    Condition MissionSucceeded

    Affects GoodDiplomat 1 Chance 100

    ;------------------------------------------
    Trigger agents28
    WhenToTest DiplomacyMission

    Condition not MissionSucceeded

    Affects GoodDiplomat -1 Chance 50

    ;------------------------------------------
    Trigger agents28_baddiplomat
    WhenToTest DiplomacyMission

    Condition not MissionSucceeded
    and AgentType = diplomat
    and Trait GoodDiplomat < 1

    Affects BadDiplomat 1 Chance 50

    Tested that thoroughly with various agents, and it works going up and down the scale, so effectively it should work like RTW again. However, it does required a lot more triggers and thinking when writing new traits.

    As for broken NoGoingBackLevels, I haven't noticed that myself, but it could well be related to the above.

    I don't know exactly what is going on in the code, but at a guess I would say it is either: the latest gained trait over-rides existing traits more than it should, or the code for anti-traits has been changed so that they no longer = -1 point in corresponding traits.

    Hope that is some use.

    PS The longer I work on the traits, the more it looks to me like whoever did them for M2 was a) not the same person who developed it for RTW, b) doesn't quite understand how they work, c) had to rush the job. The good news is that there are now many more conditions which seem to work within the traits & strat functions, so there seems to be a lot of opportunity for modding.
    Last edited by Sarastro; 12-24-2006 at 19:36.

  8. #8
    Masticator of Oreos Member Foz's Avatar
    Join Date
    Dec 2006
    Posts
    968

    Default Re: AntiTraits : now what the heck is happening here ?

    I agree with everything you've said, Sarastro. I had surmised the exact same thing about the antitrait hardcode, since nothing in the trait file could be causing the issue. As for your solution, it works for agents, but can't be applied directly to other situations. The primary reason is that the agent-affecting traits never gain more than 1 point at once for their success or failures. This allows the simple +1/-1 trigger pairs that you implemented, which admittedly IS the easiest way to fix the agents. However, as Kobal pointed out in the coming-of-age triggers, the marriage triggers, and others, sometimes traits like sobriety have a chance of gaining huge amounts of points, like 8 or more. There's no easy way to setup a similar trigger pair to fix that, as the points are typically split across removing antitrait and adding trait. So 8 points of sobriety at 60% chance doesn't equal -3 pts drink at 60% and 5 pts of sobriety at 60%, because there's no way to make sure the 2nd triggers if and only if the first does, short of actually testing to see, which makes yet another trigger and is messy to boot. See #1 from my last post for how this would work, though I don't recommend trying to do this to the file.

    I would also point out that the code you displayed is not quite right yet: you've allowed an agent with 0 GoodDiplomat pts to still have 1 removed half the time, and then have a chance to gain a BadDiplomat point as well. This means a failed mission could cause a 2-point swing in any diplo with 1 or less GoodDiplomat points, since both triggers will go off - and he could also get a negative GoodDiplomat stat, which is something undefined in game terms as far as I know. The fix is to make the triggers mutually exclusive by testing the first trigger as well. You check for GoodDiplomat > 0 (or >= 1 if you prefer), which then prevents GoodDiplomat from becoming negative ever, and keeps the Affects line from firing if there aren't points to lose in GoodDiplomat.


    Update: As per my #2 from last post, I'm in the middle of working out a program to sift through the file, pull out all the traits and their corresponding list of antitraits, find all the WhenToTest conditions, and generate comprehensive antitrait-like triggers for all WhenToTest times. It shouldn't be too difficult to get it wrapped up - hopefully inside of a few days. It will probably be several thousand more triggers though. I anticipate it will make the traits txt file very much bigger than it currently is, but don't anticipate a lot of extra overhead in-game, though it's hard to tell exactly how much time is currently spent trigger-checking. I know this is a source of much concern, so I'll keep everyone posted on the results, whenever I get to that point.


    See my Sig+ below! (Don't see it? Get info here)

  9. #9

    Default Re: AntiTraits : now what the heck is happening here ?

    Quote Originally Posted by the_foz_4
    I would also point out that the code you displayed is not quite right yet: you've allowed an agent with 0 GoodDiplomat pts to still have 1 removed half the time, and then have a chance to gain a BadDiplomat point as well. This means a failed mission could cause a 2-point swing in any diplo with 1 or less GoodDiplomat points, since both triggers will go off - and he could also get a negative GoodDiplomat stat, which is something undefined in game terms as far as I know. The fix is to make the triggers mutually exclusive by testing the first trigger as well. You check for GoodDiplomat > 0 (or >= 1 if you prefer), which then prevents GoodDiplomat from becoming negative ever, and keeps the Affects line from firing if there aren't points to lose in GoodDiplomat.
    Yep, the failed / successful mission which should switch the trait from Good- 1 or Bad- 1 to neutral will instead immediately go to the opposite trait. I actually tried the way you suggested above, and several similar triggers which were meant to be safeguards to ensure that the standard mission failed / suceeded script didn't fall foul of the anti-trait bug, and the character correctly returned to neutral. For some reason, however, it didn't work, and the agent didn't start picking up points again on the next successful / failed mission. Since I was a little pressed for time, I simply went for the hotfix of skipping the neutral level, which doesn't make a huge difference to the game imo. Also, it is stable and works, which is a big plus

    You are right about the -1 thing though, I'll stick in

    Condition not Trait BadDiplomat >= 1

    to be safe, but I think that is in effect what it assumes anyway, as I haven't seen anything that would indicate a buildup of negative GoodDiplomat trait points which would have to be worked off to gain GoodDiplomat 1 from the next successful mission. In fact, I'm not sure the game even recognises a trait with negative points, they only seem to work when the trait has points above zero.

    Always looking for improvements though, so if you have a working code to get the neutral level working, I'd like to know the solution!

  10. #10

    Default Re: AntiTraits : now what the heck is happening here ?

    @foz: I already have a script that can do what you are trying to do. Its not well written but its more or less human understandable. If you want it let me know.

    Speaking of which, I turned my script to generate the traits file already. Sorry Foz that I didn't get on here sooner to save you some work.


    I will be able to test my script tomorrow evening. But until then I have an modified character traits file for anyone who wants to give it a try.

    export_descr_character_traits.txt

    My solution was to generate a series of eight triggers for each trait/antitrait pair. Each trigger checks to see if both the trait and the antitrait are > 0, and then adds -1 to each. So if you have Trait 4 and gain AntiTrait 1, the first trigger will set Trait 3 AntiTrait 0. There are eight of them incase you gain many points of an antitrait. They fire on turn end right now, so weird things may happen in character generation that wont get fixed until the next turn. I'll play with it more later to fix that, however.

    Please let me know where the bugs are. I havn't test this at all yet and am unsure if it will even load.

    Enjoy.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO