Page 2 of 2 FirstFirst 12
Results 21 to 34 of 34

Thread: needs a living character?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Swagger's Avatar Imperial Coffee-Runner
    Join Date
    Apr 2007
    Location
    Portugal
    Posts
    12,453

    Default Re: needs a living character?

    the problem is that my trick (if it works) will work for all characters except heretics, so spies, assassins, priests, etc, can also get it


    if it works you might want to keep excluding until it works only for X
    Under the Patronage of the Dreadful cedric37!
    Ancs Guide, Emergent Factions , Yes/No Events |L'Outremer for Modders| Swagger's Skymod


  2. #2

    Icon1 Re: needs a living character?

    Swagger: You can also do this with the ‘AgentType’ condition:
    Spoiler Alert, click show to read: 
    Code:
    	monitor_event PostBattle AgentType >= admiral
    		and CharFactionType sicily
    		and GeneralFoughtFaction england
    		if I_CompareCounter sicily_allied_with_milan = 1
    		console_command diplomatic_stance milan england war
    	end_if
    		if I_CompareCounter sicily_allied_with_scotland = 1
    		console_command diplomatic_stance scotland england war
    	end_if
    		if I_CompareCounter sicily_allied_with_moors = 1
    		console_command diplomatic_stance moors england war
    	end_if
    		if I_CompareCounter sicily_allied_with_turks = 1
    		console_command diplomatic_stance turks england war
    	end_if
    		if I_CompareCounter sicily_allied_with_egypt = 1
    		console_command diplomatic_stance egypt england war
    	end_if
    		if I_CompareCounter sicily_allied_with_mongols = 1
    		console_command diplomatic_stance mongols england war
    	end_if
    		if I_CompareCounter england_allied_with_france = 1
    		console_command diplomatic_stance france sicily war
    	end_if
    		if I_CompareCounter england_allied_with_hre = 1
    		console_command diplomatic_stance hre sicily war
    	end_if
    		if I_CompareCounter england_allied_with_spain = 1
    		console_command diplomatic_stance spain sicily war
    	end_if
    		if I_CompareCounter england_allied_with_venice = 1
    		console_command diplomatic_stance venice sicily war
    	end_if
    	end_monitor

    Spoiler Alert, click show to read: 
    Code:
    ---------------------------------------------------
    Identifier:              AgentType
    Trigger requirements:    character_record
    Parameters:              character type (spy, assassin, diplomat, admiral, general, named character, family)
    Sample use:              AgentType = diplomat
    Description:             Test to see if a character is of a particular type (spy, admiral, named character &c.)
    Battle or Strat:         Strat
    Class:                   CHARACTER_TYPE_TEST
    Implemented:             Yes
    Author:                  Lee
    ---------------------------------------------------

    Spoiler Alert, click show to read: 
    Code:
    Trigger Verpflegung
    WhenToTest CharacterTurnStart
        Condition CharacterIsLocal
        and AgentType >= general
        and TimeWithArmy >= 1
        and PercentageUnitAttribute baggage > 0
    
        Affects Verpflegung 1 chance  100

  3. #3
    Swagger's Avatar Imperial Coffee-Runner
    Join Date
    Apr 2007
    Location
    Portugal
    Posts
    12,453

    Default Re: needs a living character?

    yes, but gigantus said it doesn't work

    AgentType = general
    - tests for a captain, needs 'named character'

    the game doesn't recognize whichever agent he wants to get it as general :/
    Under the Patronage of the Dreadful cedric37!
    Ancs Guide, Emergent Factions , Yes/No Events |L'Outremer for Modders| Swagger's Skymod


  4. #4

    Icon1 Re: needs a living character?

    Sorry Swagger, what I was trying to say is this. If you use ‘AgentType = general’ it won't work because that only tests for a captain as Gigantus posted. But if you use ‘AgentType > general’ that test works for a captain or any greater agent type, the greater types being a ‘named character’ or ‘family’. That's how it works in a script anyway.

  5. #5
    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: needs a living character?

    The genral problem here is not the agent type, it is the condition that requires an army attached to that character. Unfortunatley none of the events that I could use export an army.
    Hence my thought that this was originally only for the battle scripts.

    The trigger(s) as described in the first post work to my satisfaction and without side effects - I am just pedantic when it comes to my log. There shouldn't be any errors in it from a normal running, only when there are real problems. The same annoyance I feel when I have a script with Germanicus' AI 'stockade' part in it. It puts out errors, but works perfectly.

    Maybe we just have to live with this: it is already an achievement to have elephants jump through hoops, shouldn't moan when they leave some droppings behind.










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

    Default Re: needs a living character?

    Oh I see, you're saying it works fine and you have no problem... Yes you are being pointlessly fussy

  7. #7
    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: needs a living character?

    Being pedantic and hopelessly fussy comes with age, what was your name again young man?










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

    Default Re: needs a living character?

    If I may contribute some findings - not a solution - regarding exactly when the error message appears.

    For me it only seems to be when two or more named characters (NCs) are in the same army (I'm ignoring those in settlements or at sea).

    Using this in campaign script, playing as Scotland...
    Spoiler Alert, click show to read: 
    Code:
    monitor_event CharacterTurnEnd FactionIsLocal
    	and IsGeneral
    	and not EndedInSettlement
    	and not AtSea
    	and PercentageUnitAttribute custom_attr > 0
    	
    	add_money scotland 100000
    end_monitor
    ...with an army of units with the "custom_attr" custom attribute and experimenting with giving it named character generals:

    1. Army with no NC: money added, no error.
    2. Army with 1 NC: money added, no error.
    3. Army with 2 NCs: no money, error.
    4. Army with no NC + 2nd army consisting of just 1 NC: money added, no error.
    5. Army with 1 NC + 2nd army consisting of just 1 NC: money added, no error.
    6. Army with no NC + 2nd army consisting of just 2 NCs: no money, error.

    When an error occurs that's it: that monitor stops working for the rest of the game.

    ~~~~~~~~~~~~~~~~~

    With trait triggers it was similar: only an error when 2 NCs in an army.

    These triggers toggle a trait on and off based on whether the NC is the commander of an army with custom units in it (or that's the plan):
    Spoiler Alert, click show to read: 
    Code:
    Trigger trigger_1
        WhenToTest CharacterTurnEnd
    
        Condition FactionIsLocal
          and IsGeneral
          and not EndedInSettlement
          and not AtSea
          and PercentageUnitAttribute custom_attr > 0
          and Trait trait_toggle = 0
    
        Affects trait_toggle  1  Chance  100
    
    Trigger trigger_2
        WhenToTest CharacterTurnEnd
    
        Condition FactionIsLocal
          and IsGeneral
          and not EndedInSettlement
          and not AtSea
          and PercentageUnitAttribute custom_attr = 0
          and Trait trait_toggle = 1
    
        Affects trait_toggle  -1  Chance  100

    Mostly it's fine: despite errors in the log the traits come and go as expected. However, it does break in this situation:
    1. Army1 contains custom units.
    2. NC1 is the commander of Army1 (trait=on).
    3. Army2 is commanded by NC2 who outranks NC1.
    4. When NC1 is moved into Army2 he is no longer the commander, so he has "no army"; after end of turn he still has the trait on (error in log) and continues to do so until he is made a commander again. (He shouldn't because he is not the commander. He does because the error broke the code and failed to turn off the trait.)


    Unlike campaign script, errors here don't break the trigger permanently. (Maybe that's common knowledge to most; news to me).

    ~~~~~~~~~~~~~~~~~~

    In summary:
    • IsGeneral just means they can command an army; this includes non named characters (captains).
      • For an army with no NC, IsGeneral will be true for the captain. PercentageUnitAttribute works on that captain.
      • For an army with 1 NC, IsGeneral will be true for that NC. PercentageUnitAttribute works on that NC.
      • For an army with 2+ NCs, IsGeneral will be true for each NC, but PercentageUnitAttribute will only work for the commander.
      • For an army of just 1 NC and no other units: PercentageUnitAttribute works as normal.
    • IsAdmiral does not mean the character "has an army", despite the Docudemons


    Indeed it would be very helpful for some kind of "HasArmy" or "IsCommander" condition.
    Last edited by Withwnar; October 04, 2011 at 11:05 PM.

  9. #9
    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: needs a living character?

    The only solution, to get rid of the message, and possibly to fix the problem, would be to use the HighestAttAdjacentChar condition. You'd need 10(?) versions of the trigger, each one with the conditions:
    Code:
    and Attribute = X
    and HighestAttAdjacentChar command named_character < X
    This way the trigger will only fire if the named_character has the highest command attribute. Note this doesn't work if two generals have the highest command because I don't know how the game breaks the tie.
    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

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

    Default Re: needs a living character?

    Quote Originally Posted by Squid View Post
    ...use the HighestAttAdjacentChar condition... Note this doesn't work if two generals have the highest command because I don't know how the game breaks the tie.
    I considered HighestAttSharedChar...
    Is the highest attribute rating of any character of the same faction sharing the same tile higher than specified?
    ...but dismissed it because of the "tie" situation.

    Still, if it means that 90% of errors are no longer generated (non-ties) then it might be worth pursuing.

    Does command max at 10 internally?
    Last edited by Withwnar; March 02, 2011 at 03:18 AM.

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

    Default Re: needs a living character?

    Does it count characters in the same stack as adjacent? Nice idea if so.

  12. #12
    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: needs a living character?

    I have no idea which is why I said it might fix the problem.
    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

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

    Default Re: needs a living character?

    I checked some traits I know only work with adjacent characters, and that's a condition they use. So unfortunately it looks like that one won't work.
    Last edited by Taiji; March 01, 2011 at 04:28 PM.

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

    Default Re: needs a living character?

    I have written a tool to filter these errors from a log.

    A little tricky because they span four lines but it seems to work.

Page 2 of 2 FirstFirst 12

Posting Permissions

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