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

Thread: I_NumberOfHeirs

  1. #21
    Gigantus's Avatar You should always listen to your inner voice! - Agreed, but which one?
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    50,318
    Blog Entries
    28

    Default Re: I_NumberOfHeirs

    There goes another theory of mine...




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

    Default Re: I_NumberOfHeirs

    That "family" means family? A ridiculous idea, Gigantus. You should be ashamed of yourself.

    I since found this in the wiki...

    Characters Character_Type(s)

    ... The current character types are: spy, assassin, diplomat, admiral, family and all. The current docudemon files show general and named character as additional character types, but I haven't tested these or seen them in an existing trait.

    Note: Recruited generals are considered the family character type and can acquire traits limited to family members.
    ...which kind of alludes to what I found, sort of. This is for RTW; the M2TW page didn't have anything different to say on the matter.

    The Kingdoms demons says this:

    ... The character types that can be used are: all, admiral, assassin, diplomat, general, heretic, imam, inquisitor, merchant, priest, princess, spy, and witch.
    family : missing
    named character : missing - I have no idea whether that is indeed a valid type here (it is for AgentType, according to the demons)
    general : perhaps this represents named character? True generals (captains) cannot get traits so why bother making them a valid type for a trait?
    imam : really? I thought that imams were just islam priests, i.e. "priest" is still their type. I'll try that one out.

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

    Default Re: I_NumberOfHeirs

    I ran some tests...

    • named_character (with underscore) is valid for a trait's Characters type and AgentType. It is identical to family: both types mean "named character, both family members and otherwise".
    • general is a valid AgentType and means a true general type: a "captain", not a named character. It may very well be a valid trait Characters type but as these types can't get traits anyway it is irrelevant. Likewise "AgentType = general" is a pointless trait/ancillary trigger condition but it can be used in campaign script.
    • imam is not a valid type for either Characters or AgentType. Use "priest" for imams.


    Using an invalid type for Characters does not generate an error; it just silently fails. Using an invalid type for AgentType does generate an error and breaks the condition (making it evaluate to true).
    Last edited by Withwnar; August 19, 2013 at 04:32 AM.

  4. #24

    Default Re: I_NumberOfHeirs

    hello just got faction crusaders distroyed,as both heir and factionleader where in same settlement that was under siege and taken by ayyubids army,can factiontunrnstart be changed by factionfactionturnend too prevent this happening,and give the crusaders one family memeber too make them still alive?

  5. #25
    Gigantus's Avatar You should always listen to your inner voice! - Agreed, but which one?
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    50,318
    Blog Entries
    28

    Default Re: I_NumberOfHeirs

    .
    .



    Question: will this condition be suitable to test if a faction is dead? Because if the value returns zero the faction surely has to be dead?
    Code:
    monitor_event FactionTurnStart FactionType slave
        if I_NumberOfHeirs [faction1] < 1   ; no named characters = faction is dead
            do your stuff, like resetting diplomatic stances
        end_if
        if I_NumberOfHeirs [faction2] < 1
            do your stuff
        end_if
    end_monitor
    Last edited by Gigantus; May 31, 2021 at 10:45 PM.




  6. #26

    Default Re: I_NumberOfHeirs

    This should work for every case except factions with "no" family tree. The only way to kill such factions, that I'm aware of, is with kill_faction, so you could address such factions with an alive/dead counter in script.

  7. #27
    Gigantus's Avatar You should always listen to your inner voice! - Agreed, but which one?
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    50,318
    Blog Entries
    28

    Default Re: I_NumberOfHeirs

    Well, the 'no_tree' setting in descr_strat keeps a faction alive only where diplomacy is concerned, eg no 'defeat' message will ever appear. A 'teutonic' faction is the same as a regular faction were being 'dead' is concerned.
    As one has to specify the faction with the condition this however becomes mute as I cannot see why anyone would test if the slave or papal faction is dead. In the papal case one could actually use the query to spawn a named character who will then become faction leader and pope. I think Mak experimented with that while having priests disabled.

    Which would seem to mean that 'yes' the condition can be used to check if a faction is alive. 'Alive\dead' is misleading I presume: rather 'present in game' as respawning can be done for any faction, never mind factions like mongols that haven't existed yet or the aforementioned 'no tree' factions.




  8. #28

    Default Re: I_NumberOfHeirs

    I'm referring to setting has_family_tree to "no" in descr_sm_factions. Any such faction (not necessarily the slave_faction or papal_faction) will survive with no heirs, so this condition obviously won't work to test if the faction is alive/dead. However, since the only known way to kill such a faction is with kill_faction, and since this is predictable in script (you could even use I_NumberOfHeirs < 1 as a criterion for killing the faction), we always know when such a faction is alive/dead anyway.

    My only question now is how I_NumberOfHeirs is superior to using 'I_FactionLeaderAttribute faction_name Command < 999'. Is there a scenario where a faction can have heirs but no leader, perhaps right after a battle?

  9. #29
    Gigantus's Avatar You should always listen to your inner voice! - Agreed, but which one?
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    50,318
    Blog Entries
    28

    Default Re: I_NumberOfHeirs

    I am fairly sure it's possible to have only a leader, eg one family member.

    It's superior in that it will not require any trait\trigger set up at all. Plus it's an 'I_xyz' condition which can be used at all times in a monitor.

    This whole issue actually stems from an EBII discussion, the goal being to reset an absent faction's diplomatic stance to neutral with all factions. The reason for that being that it is that alive factions will not be able to have diplomatic relations with an ally of the dead faction if they were at war with the absent faction.
    It also avoids any connection with the crash prone BecomesFactionLeader event, eg when giving attributes\traits.

    Edit: on second thought I am not sure how the I_FactionLeaderAttribute condition test actually works. If there is no leader then the result is zero which will return true, as will any other value above zero with a live leader. If you use 'not' then it will return false in all cases, either alive or dead.
    Last edited by Gigantus; June 01, 2021 at 09:34 PM.




  10. #30

    Default Re: I_NumberOfHeirs

    So, we do have to ensure that the chosen attribute can never exceed 999, but that hardly constitutes setup. The I_FactionLeaderAttribute condition is also independent and can be used anywhere in script.

    I've actually been using I_FactionLeaderAttribute for exactly the same script purpose for a while now and had no issues (aside from the aforementioned issue with "no" family tree factions, which is hardly a problem). Maybe these conditions are equivalent for this purpose, but I get the feeling we're forgetting something...

    Hopefully Withwnar will weigh in on this.

  11. #31
    Gigantus's Avatar You should always listen to your inner voice! - Agreed, but which one?
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    50,318
    Blog Entries
    28

    Default Re: I_NumberOfHeirs

    I edited this part in without seeing your response:

    on second thought I am not sure how the I_FactionLeaderAttribute condition test actually works. If there is no leader then the result is zero which will return true, as will any other value above zero with a live leader. If you use 'not' then it will return false in all cases, either alive or dead.




  12. #32

    Default Re: I_NumberOfHeirs

    'I_FactionLeaderAttribute faction_name Magic < 999' will return true if any leader exists (even off-map ones). No leader does not result in 0, but in "nothing", aka the condition is false. So it does pretty much what we want for testing if a faction is alive or dead.

    I_NumberOfHeirs is very convenient indeed, but has the potential drawback that it only counts characters that are currently present on the map. So an off-map character that exists in the nether realm on purpose would not be covered by that condition. That is probably a very niche case though.

    I suppose for regular non-horde factions with family trees (either one) I_NumberOfSettlements should cover most script applications.

  13. #33

    Default Re: I_NumberOfHeirs

    Quote Originally Posted by Serious Potato View Post
    I_NumberOfHeirs is very convenient indeed, but has the potential drawback that it only counts characters that are currently present on the map. So an off-map character that exists in the nether realm on purpose would not be covered by that condition. That is probably a very niche case though.
    This is true, but I'm almost 100% sure that factions cannot survive if their only named characters are off map. Horde and non-horde factions must have at least 1 named character on the map at the start of their turn to survive their turn (non-horde factions have the additional requirement of owning at least 1 settlement). This named character doesn't need to be the faction leader or heir, they can both be off map. I don't think he even needs to be a family member. But he does need to be on the map at the start of his faction's turn or the faction will die. So, you could still safely use I_NumberOfHeirs < 1 to test if the faction is dead since only the on-map characters matter for aliveness.

  14. #34

    Default Re: I_NumberOfHeirs

    That depends on how the faction gets finished off. If an off-map family member exists, the faction does not get destroyed by killing all its on-map characters (excluding the teutonic regicide). It will, however, be destroyed by taking all its settlements.

    An example: You got a faction with a leader, an heir and another family member that got sent off the map. Now you kill the leader & heir via script and the faction will survive because the aforementioned family member is now the leader, even while not on the map. If the faction is player-controlled, it will just be immortal, you won't have any characters but won't lose the campaign either. Now here is where it gets really spicy! If the faction is AI-controlled the off-map character returns to the capital automatically (meaning without any additional scripting) at the start of the next turn of said AI faction.
    Last edited by Serious Potato; June 02, 2021 at 05:03 PM.

  15. #35

    Default Re: I_NumberOfHeirs

    I tested exactly what you said: non-horde, "yes" family tree faction with 3 family members and no other named characters. I send the family member off the map and then kill the leader and heir. This results in the faction immediately dying. If it's human-controlled, I get kicked to the menu. If it's AI, I get the faction destroyed message. I also tested adding one additional non-family member named character to this faction and got the same results. The faction must have at least 1 family member on the map to be alive, non-family named characters won't suffice.

    Interestingly, the game is crashing if I send the character off the map while he's visible on the screen. I've never seen that before and there's nothing in the log.

  16. #36

    Default Re: I_NumberOfHeirs

    I am sorry, wasn't looking at my files when writing that. What I actually did was sending the heir off the map and then kill the leader and the regular family member. Guess an off-map family member does not suffice, but an off-map heir/leader does.

  17. #37

    Default Re: I_NumberOfHeirs

    OK, this I can confirm - a non-horde "yes" family tree faction will survive with either leader or heir off map and no named characters on the map. In this scenario, I_NumberOfHeirs < 1 will return true since it only tests on-map characters.

    In my mind, this result completely invalidates the use of I_NumberOfHeirs for testing faction aliveness. Sure, you could use counters to track when leaders and heirs are sent off map and returned, but in doing so you're adding a lot of additional, character-specific conditions to every aliveness check. That's a lot of 'hard coding' which leaves plenty of room for error. Conversely, I_FactionLeaderAttribute still gives the correct answer for aliveness with a single line and no hard coding.

    I tested the above with the faction under human and AI control. In the latter case, the off map leader did not return to the map on the AI's next turn. I tried taking control of the faction in hotseat and no named characters were sent back to the map or spawned.

  18. #38
    Gigantus's Avatar You should always listen to your inner voice! - Agreed, but which one?
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    50,318
    Blog Entries
    28

    Default Re: I_NumberOfHeirs

    Agreed - that scenario makes it unsuitable for 'alive' testing.

    However: off map characters will only return via script. Which means the faction will eventually die when the FL does (off map characters age normally). Which kinda makes the heirnumber test valid again --> the faction is dead until the off map character gets spawned. And if it's not a horde set up then he's toast anyhow upon spawning.
    Last edited by Gigantus; June 04, 2021 at 11:37 PM.




  19. #39

    Default Re: I_NumberOfHeirs

    I had a very weird setup that made it hard to find the reason why it was happening. The problem was that I didn't kill him when I thought I did. Just wanted to prevent this thread from spreading a myth

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
  •