Results 1 to 12 of 12

Thread: test if admiral has particular ship in his fleet?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Kiliç Alì's Avatar Domesticus
    Artifex

    Join Date
    Feb 2011
    Location
    Italy
    Posts
    2,114

    Default test if admiral has particular ship in his fleet?

    I want to test if an admiral has at least a "cog" ship into his fleet. Is there any condition that could help me? found nothing in docudemos, but who know, maybe some of you can help me...

    Member of the Imperial House of Hader, proud client of The only and sole Ferrit

  2. #2
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Re: test if admiral has particular ship in his fleet?

    Can't see a straightforward way to do it.

    Percentage unit attribute, then give each ship a unique attribute, maybe.

  3. #3
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: test if admiral has particular ship in his fleet?

    There is a solution, but it will generate false error messages:

    The description
    Identifier: PercentageUnitAttribute
    Trigger requirements: character_record
    Parameters: unit attribute
    Sample use: PercentageUnitAttribute navy_coq > 25.5 (test for all units with the attribute 'navy_coq')
    Description: Test to see what percentage of the army have a particular attribute

    The error message
    : PercentageUnitAttribute needs a living character with an army.

    The use
    You require a custom attribute in the EDU entry if you wish to test for a particular unit. The entry should come at the end of the 'attributes' line of the unit - example:

    Code:
    attributes       sea_faring, can_withdraw, navy_coq
    The Drawback
    This works with named characters as it requires a character record. Not if it will work with admirals (it should, they can get traits which is part of a character record).










  4. #4
    Kiliç Alì's Avatar Domesticus
    Artifex

    Join Date
    Feb 2011
    Location
    Italy
    Posts
    2,114

    Default Re: test if admiral has particular ship in his fleet?

    Men, thanks you got my day

    Member of the Imperial House of Hader, proud client of The only and sole Ferrit

  5. #5
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Re: test if admiral has particular ship in his fleet?

    Give them the 'cog' attribute and this would work:

    PercentageUnitAttribute cog > 1

    The error message should be returned when the character does not have an army, but there's no way to test if he has one or not before using the condition.

    It's only really a problem to have error messages in your log when some noob notices a different problem and assumes the error message has something to do with it. So as long as you find that kind of thing amusing you'll be fine

  6. #6
    Kiliç Alì's Avatar Domesticus
    Artifex

    Join Date
    Feb 2011
    Location
    Italy
    Posts
    2,114

    Default Re: test if admiral has particular ship in his fleet?

    ok. the idea is to give him a different strat_model depending on his fleet, presuming the strongest ship would be the "admiral" one. so if he has, let's say, only cogs, he will use a low tier model, while if he has more powerful vessels he will use a bigger baddasser looking model(hardcoded limit is 10). thanks anyway

    The PercentageUnitAttribute condition should work in EDCT, right?

    Member of the Imperial House of Hader, proud client of The only and sole Ferrit

  7. #7
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Re: test if admiral has particular ship in his fleet?

    Quote Originally Posted by Kiliç Alì View Post
    ok. the idea is to give him a different strat_model depending on his fleet, presuming the strongest ship would be the "admiral" one. so if he has, let's say, only cogs, he will use a low tier model, while if he has more powerful vessels he will use a bigger baddasser looking model(hardcoded limit is 10). thanks anyway
    Cool idea

  8. #8
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: test if admiral has particular ship in his fleet?

    It does (from 1648):

    Code:
    Trigger Verpflegung
    WhenToTest CharacterTurnStart
        Condition IsGeneral
        and CharacterIsLocal
        and not EndedInSettlement
        and PercentageUnitAttribute baggage > 0
    
        Affects Verpflegung 1 chance  100










  9. #9
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default Re: test if admiral has particular ship in his fleet?

    Yeah, great idea Kiliç.

    I have a tool for filtering out those error messages. The page has a link to post that has some findings on when it does and doesn't happen but it didn't test admirals.

    Hmm, having a quick read through that post the error only happens when there are two named characters in the same army. You might be safe there because a fleet can only have one admiral (?).

  10. #10
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: test if admiral has particular ship in his fleet?

    The error message happens every time the trigger fires, at least in my mod.

    The tool fails to rectify this entry:

    16:03:37.939 [game.script] [error] Trigger processing error in <devastation_cav_living_on_land>
    : PercentageUnitCategory needs a living character with an army.

    when testing <PercentageUnitCategory> condition
    Last edited by Gigantus; January 06, 2012 at 04:39 AM.










  11. #11
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default Re: test if admiral has particular ship in his fleet?

    Quote Originally Posted by Gigantus View Post
    The error message happens every time the trigger fires, at least in my mod.
    Those tests I ran did not include named characters in settlements. From memory the error always happens for those guys because they don't have an army.

    There were certainly cases when the errors didn't appear for me. I used it in a submod to give the commander a trait if his army had a particular unit. If the error happened (e.g. he is now the 2nd named character in that army) then the trait would not be removed like it should, due to the the trigger failing with that error. Which suggests that if the error always happened then the trait would never work at all.

  12. #12
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: test if admiral has particular ship in his fleet?

    In my mod a few characters are placed outside settlements with a unit that has the required attribute. The number of errors I am getting in the first round is pretty much equivalent to them. To avoid excessive amounts of messages I added 'not EndedInSettlement' to the conditions of the trigger. It also made more sense for what I wanted to achieve with the trigger.










Posting Permissions

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