Results 1 to 10 of 10

Thread: Trigger Error

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Trigger Error

    I’ve been having trouble with a trigger the last couple days. Here’s the trigger:

    Code:
     
    ;------------------------------------------
    Trigger S_general_joins_army
        WhenToTest CharacterTurnEnd
     
        Condition IsGeneral
                            and CharacterIsLocal
                            and not EndedInSettlement
                            and PercentageUnitAttribute general_unit < 100
                            and Trait SWithArmy < 1
     
        Affects SWithArmy  2  Chance  100

    And here’s the error log entry referencing it.

    Code:
     
    06:16:33.609 [game.script] [error] Trigger processing error in <S_general_joins_army> 
    : PercentageUnitAttribute needs a living character with an army.
     
    when testing <PercentageUnitAttribute> condition

    I’m having a problem making sense of this, because the requirements for the PUA condition are that the event exports character_record, which CharacterTurnEnd does. Also, one of the preceding conditions is IsGeneral, so that should supply the “living character with an army”. Any idea what’s going wrong here?
    Son of PW

  2. #2
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,751
    Blog Entries
    3

    Default Re: Trigger Error

    Well IsGeneral does not detect if the character is dead, it only tests if the character can command a land army, you'd think the two would be the same but apparently not.
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

  3. #3
    konny's Avatar Artifex
    Join Date
    Jul 2007
    Location
    Germania Inferior
    Posts
    3,631

    Default Re: Trigger Error

    Does this trigger fire for no general at all?


    Code:
     
    ;------------------------------------------
    Trigger S_general_joins_army
        WhenToTest CharacterTurnEnd
     
        Condition IsGeneral
                            and CharacterIsLocal
                            and not EndedInSettlement
                            and PercentageUnitAttribute general_unit < 100
                            and Trait SWithArmy < 1
     
        Affects SWithArmy  2  Chance  100


    I also don't realy understand what do you want to achieve with that trigger. That is, what does the trait SWithArmy do? May be there is a better way to get there?

    Team member of: Das Heilige Römische Reich, Europa Barbarorum, Europa Barbarorum II, East of Rome
    Modding help by Konny: Excel Traitgenerator, Setting Heirs to your preference
    dHRR 0.8 beta released! get it here
    New: Native America! A mini-mod for Kingdoms America

  4. #4

    Default Re: Trigger Error

    Quote Originally Posted by konny View Post
    Does this trigger fire for no general at all?


    Code:
     
    ;------------------------------------------
    Trigger S_general_joins_army
        WhenToTest CharacterTurnEnd
     
        Condition IsGeneral
                            and CharacterIsLocal
                            and not EndedInSettlement
                            and PercentageUnitAttribute general_unit < 100
                            and Trait SWithArmy < 1
     
        Affects SWithArmy  2  Chance  100
    I also don't realy understand what do you want to achieve with that trigger. That is, what does the trait SWithArmy do? May be there is a better way to get there?
    Basically it has to do with supplies--a general by himself does't need a supply train--a general with an army does. Is there any other way to detect that?
    Son of PW

  5. #5
    konny's Avatar Artifex
    Join Date
    Jul 2007
    Location
    Germania Inferior
    Posts
    3,631

    Default Re: Trigger Error

    hmm.... nothing I that comes instantly to my mind.

    Back to the other question: Is this trigger not working at all, or is it just throwing out this message for dead generals?

    Team member of: Das Heilige Römische Reich, Europa Barbarorum, Europa Barbarorum II, East of Rome
    Modding help by Konny: Excel Traitgenerator, Setting Heirs to your preference
    dHRR 0.8 beta released! get it here
    New: Native America! A mini-mod for Kingdoms America

  6. #6

    Default Re: Trigger Error

    Quote Originally Posted by konny View Post
    hmm.... nothing I that comes instantly to my mind.

    Back to the other question: Is this trigger not working at all, or is it just throwing out this message for dead generals?
    It seems to be causing a crash. At least, the game is crashing steadily, and this is always in the error log. As for the other, there's a TimeWithArmy condition in the docudemons, but I don't know whether that is designed for generals or other types of agents. Have you played with that at all?
    Son of PW

  7. #7
    konny's Avatar Artifex
    Join Date
    Jul 2007
    Location
    Germania Inferior
    Posts
    3,631

    Team member of: Das Heilige Römische Reich, Europa Barbarorum, Europa Barbarorum II, East of Rome
    Modding help by Konny: Excel Traitgenerator, Setting Heirs to your preference
    dHRR 0.8 beta released! get it here
    New: Native America! A mini-mod for Kingdoms America

  8. #8
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: Trigger Error

    Quote Originally Posted by Theodotos I View Post
    It seems to be causing a crash. At least, the game is crashing steadily, and this is always in the error log. As for the other, there's a TimeWithArmy condition in the docudemons, but I don't know whether that is designed for generals or other types of agents. Have you played with that at all?
    I can tell you why its crashing at least. Its not because of the generals with an army, its because of the generals that have no army.

    You are testing this on ALL generals whether they have an army or not. As you loop through the conditions everything is fine until it hits an "army" that is composed only of the general. I think that "< 100" part is screwing it up as it was never designed to check the character, but the units that are with the character. Anytime you use conditions that are 0 or 100 you are opening yourself up to problems, the engine doesnt always handle absolute values that well. Also I am not sure how you are assigning that SWithArmy trait, but you are checking it in the wrong order.

    I would build multiple triggers to detect this, one for each unit_type in the game EXCEPT general_unit, and use that to assign the SWithArmy trait. I would also use the SWithArmy trait as a true/false flag and not have multiple levels.

    CharacterTurnEnd
    not EndedInSettlement
    not AtSea
    and Trait SWithArmy < 1
    PercentageUnitAttribute unit_type > 4

    That will assign the trait to any general that has any units other than himself. The reason we use a percentage of 4 is easy. You can have a max of 20 units, which means each unit is 5% of the army. Anything over 4% will mean at least 1 unit in the army. It might work by using > 0, in fact now that I think of it it probably would, but I seriously doubt checking the other end (100%) would.

    Then once the general has the trait you can check it in the campaign script and do all kinds of things, or just assign different bonuses/penalties to the trait itself.

    For generals that do not have an army you do the reverse, but again one trigger for each unit type.


    CharacterTurnEnd
    not EndedInSettlement
    not AtSea
    and Trait SWithArmy = 1
    PercentageUnitAttribute unit_type < 5

Posting Permissions

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