Results 1 to 2 of 2

Thread: Help with trigger to debuff AI generals Command Stars

  1. #1

    Default Help with trigger to debuff AI generals Command Stars

    Could someone please help me to write a trigger that would debuff the AI generals by about 5 Command Stars just before the battle starts? Or if it would work better, just to debuff them permanently somehow.

    I am using BGRIV and V and in both of these mods the AI generals always have eight or more Command Stars.

    Below is my sorry attempt to do so, which I added to the export_descr_character traits file, but of course it did not work.


    Trigger Kilgore's AI -5 Stars Command
    WhenToTest PreBattle

    Condition IsGeneral
    and not CharacterIsLocal

    Effect Command -5
    Pleasant it is, when over a great sea the winds trouble the waters, to gaze from shore upon another's tribulation: not because any man's troubles are a delectable joy, but because to perceive from what ills you are free yourself is pleasant - Lucretius

  2. #2

    Default Re: Help with trigger to debuff AI generals Command Stars

    First of all, it sounds like you just want a global debuff for AI generals' command attribute values. I would suggest investigating the traits/ancillaries and triggers of these mods and seeing if you can't just reduce attribute effects or trigger probabilities to see if that resolves the issue to your satisfaction. If every AI general has high command values, my guess would be the modders added special AI-only traits/ancillaries that increase their command and simply removing these (and/or their triggers) will fix the issue. If you're really determined to do something with individual characters just before they go into battle, read on...

    Monitoring PreBattle in scripts doesn't work - it's never triggered. I would guess it doesn't work in EDCT triggers either. Hopefully someone can offer a better suggestion or evidence that PreBattle works for triggers, but I believe trying to do stuff with individual characters just before they go into a battle is one of the great unsolved problems of M2 scripting on account of the fact that the only event function that fires at that time and exports the individual character, PreBattle, doesn't work.

    2) EDCT triggers act on traits, not attributes directly, so unless you have a trait called "Command", this trigger isn't going to do anything even if the PreBattle event fires when it should. Instead of "Effect", triggers use the command syntax "Affects" as in:

    Trigger V0190_Withdraw_Before_Battle_Even_Odds_VnV_Trigger
        WhenToTest PreBattleWithdrawal
        Condition IsGeneral
              and I_WithdrawsBeforeBattle
              and BattleOdds > 0.8
              and BattleOdds < 1.5
        Affects IndecisiveAttacker  1  Chance  50
    where IndecisiveAttacker is the name of a trait.

    3) The 'local' conditions such as CharacterIsLocal are unsafe to use in hotseat. If you're exclusively scripting for single-player, you can ignore this.

    You need to first somehow check if PreBattle is a working event function in EDCT triggers. For example, you could use it to simply give characters a trait they can't get any other way and then check if anyone gets that trait after a battle. If they get the trait, then PreBattle works in EDCT and all you need to do is change your 'Effect Command -5' line to something like 'Affects CommandTrait -1' were CommandTrait is a trait with the effect of subtracting 5 from the command attribute. If PreBattle doesn't work in EDCT, then you need to get more creative, pick a different event function. You may need to resort to global effects on all characters of the AI faction and then use PostBattle to revert the effect. At this point though, I would just forgo trying to do stuff pre-battle and go with my original suggestion to just remove whatever traits/ancillaries are causing AI generals to have high command.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts