Results 1 to 13 of 13

Thread: Idea to fix elven mortality "bug"

Hybrid View

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

    Default Idea to fix elven mortality "bug"

    Hi everybody!

    I do not know anything about Third Age TW but I have not found a similar discussion anywhere

    I have an idea that could help us modding characters' age.

    Apparently, the only way we do have to set the age is to set it for every faction from descr_campaign_db.xml :

    <family_tree>
    <max_age uint="150"/>
    <max_age_for_marriage_for_male uint="80"/>
    <max_age_for_marriage_for_female uint="50"/>
    <max_age_before_death uint="165"/>
    <max_age_of_child uint="10"/>
    <old_age uint="120"/>

    now, if we modify this in order to have everybody immortal, is it possible to create traits that could end up with the death of the character?

    For example,

    ________________________________________
    Trigger FateOfMan
    WhenToTest CharacterTurnEnd


    Condition IsGeneral
    FactionType Gondor
    FactionType Rohan
    ...


    Affects FateOfMan 1 Chance 2
    ________________________________________


    Trait FateOfMan
    Characters All


    Level FateOfMan1
    Description FateOfMan1_desc
    EffectsDescription FateOfMan1_effects_desc
    Threshold 2


    Effect HitPoints -8


    Level FateOfMan2
    Description FateOfMan2_desc
    EffectsDescription FateOfMan2_effects_desc
    Threshold 4


    Effect HitPoints -16


    Level FateOfMan3
    Description FateOfMan3_desc
    EffectsDescription FateOfMan3_desc
    Threshold 8


    Effect HitPoints -32
    ________________________________________

    Something like this might work if MTW kills the generals when theirs HP go below zero.

    Otherwise, is it possible to add to the script the "kill_character" code?

    Let me know what do you think about this

  2. #2

    Default Re: Idea to fix elven mortality "bug"

    It's a good idea. I don't know if subtracting hitpoints would automatically kill them, but you could make another script that checks characters for the trait and then removes them from the game if they have it.

  3. #3

    Default Re: Idea to fix elven mortality "bug"

    Quote Originally Posted by DrDragun View Post
    It's a good idea. I don't know if subtracting hitpoints would automatically kill them, but you could make another script that checks characters for the trait and then removes them from the game if they have it.
    Mh do you have any idea on how to make this script? As far as I understood, in order to remove characters from the game we need to know their names (and we dont, since generals/agents names are randomly generated)

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

    Default Re: Idea to fix elven mortality "bug"

    Quote Originally Posted by Asthariot View Post
    As far as I understood, in order to remove characters from the game we need to know their names (and we dont, since generals/agents names are randomly generated)
    That's right. Names or labels, but labels don't help with randomly generated characters either. Even if you had a script that knew every name in the faction, and somehow could determine the age of the character with that name (there is no CharacterName condition), there's no way to guarantee that the script is killing the right person when you have two people with the same name (not necessarily in the same faction).

    e.g. Say you have two characters named Aragorn on the map. Maybe in the same faction, maybe not. And script to find out if a character named Aragorn is of killable age. To kill Aragorn is easy...

    kill_character Aragorn

    ...but which of those two Aragorns did it just kill? The one who is of killable age, or the other one who is not? We can't tell script which Aragorn to kill.

    If we knew that that there could only ever be one Aragorn - because he's spawned via the Unique Names method for example - then fine. But to make an entire race (faction) mortal, via kill_character, then all of its characters would need to be a Unique Names one, which is not possible unless you somehow shut down all game-generated generals/family (children, adoptions, man of the hour) and use script to spawn them instead (with unique names).

    Have you tried that Hitpoints thing to see if it kills him? It would be easy to test on one character. If it does work then you're onto something.

  5. #5

    Default Re: Idea to fix elven mortality "bug"

    Quote Originally Posted by Withwnar View Post
    That's right. Names or labels, but labels don't help with randomly generated characters either. Even if you had a script that knew every name in the faction, and somehow could determine the age of the character with that name (there is no CharacterName condition), there's no way to guarantee that the script is killing the right person when you have two people with the same name (not necessarily in the same faction).

    e.g. Say you have two characters named Aragorn on the map. Maybe in the same faction, maybe not. And script to find out if a character named Aragorn is of killable age. To kill Aragorn is easy...

    kill_character Aragorn

    ...but which of those two Aragorns did it just kill? The one who is of killable age, or the other one who is not? We can't tell script which Aragorn to kill.

    If we knew that that there could only ever be one Aragorn - because he's spawned via the Unique Names method for example - then fine. But to make an entire race (faction) mortal, via kill_character, then all of its characters would need to be a Unique Names one, which is not possible unless you somehow shut down all game-generated generals/family (children, adoptions, man of the hour) and use script to spawn them instead (with unique names).

    Have you tried that Hitpoints thing to see if it kills him? It would be easy to test on one character. If it does work then you're onto something.
    I tried with -20, -40, and -600 hp and it does not work I guess the developers have not implemented a script that check their hp and removes the generals that have less than 0 HP. However, how can a general participate into a battle with -5xx hp??

  6. #6

    Default Re: Idea to fix elven mortality "bug"

    Quote Originally Posted by Withwnar View Post
    That's right. Names or labels, but labels don't help with randomly generated characters either. Even if you had a script that knew every name in the faction, and somehow could determine the age of the character with that name (there is no CharacterName condition), there's no way to guarantee that the script is killing the right person when you have two people with the same name (not necessarily in the same faction).

    e.g. Say you have two characters named Aragorn on the map. Maybe in the same faction, maybe not. And script to find out if a character named Aragorn is of killable age. To kill Aragorn is easy...

    kill_character Aragorn

    ...but which of those two Aragorns did it just kill? The one who is of killable age, or the other one who is not? We can't tell script which Aragorn to kill.

    If we knew that that there could only ever be one Aragorn - because he's spawned via the Unique Names method for example - then fine. But to make an entire race (faction) mortal, via kill_character, then all of its characters would need to be a Unique Names one, which is not possible unless you somehow shut down all game-generated generals/family (children, adoptions, man of the hour) and use script to spawn them instead (with unique names).

    Have you tried that Hitpoints thing to see if it kills him? It would be easy to test on one character. If it does work then you're onto something.
    Is it possible to put a label on every general when they spawn?

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

    Default Re: Idea to fix elven mortality "bug"

    Maybe hitpoints simply can't go below 0, or 1, or whatever the value is that characters start out with. And even if they could it would be a miracle if the developers anticipated that someone might wish to use that to kill characters on the strat map. Dying from too few hitpoints on the battle map, sure, but on the strat map nobody is hitting you so hitpoints aren't relevant.

  8. #8

    Default Re: Idea to fix elven mortality "bug"

    You can make a script that checks each character when you select them, like so;

    Spoiler Alert, click show to read: 
    Code:
    ;full rations
    monitor_event CharacterSelected CharacterIsLocal
        and ! IsFactionAIControlled (probably not needed)
        and ! FactionReligion heretic
        and AgentType = named character
        and ! HasAncType supply
        and ! HasAncType supply2
        and ! HasAncType supply3
        and ! HasAncType supply4
        
        console_command remove_ancillary this supply
        console_command remove_ancillary this supply2
        console_command remove_ancillary this supply3
        console_command remove_ancillary this supply4
        console_command give_ancillary this supply
        console_command remove_trait this Supply 1
        console_command remove_trait this Supply2 1
        console_command remove_trait this Supply3 1
        console_command remove_trait this Supply4 1
        console_command give_trait this Supply 1
    
    
    end_monitor


    This will kick in for any character and only when they are selected and can give them whatever trait or ancillary you want. Then you can make the trait kill them when the turn ends or the next turn begins, or a random chance. A script like this will only work for player controlled factions since you have to select the character. This is the best type of script to use as it will not slow down your end turn times constantly checking each character every turn (if that is even possible for those with randomly named characters, I don't think it is). I never tried to make one that works for the AI, and I cannot think of any way to do it off the top of my head. I believe the CharacterSelected only works if the character is player owned (local). I don't mod this game much though so I am no authority on the subject. I can't even remember the last time I looked in the docu-whatevers they released which say what conditions, etc. can be used.

    I think in PCP I just extended the max age to like 250 years. The campaign never last long enough for most of the humans to die of old age anyway, and Dwarves, Elves, and Orcs/Goblins (half the factions in the game, even in PCP) lived much longer or didn't die of old age. The few that should die (Theoden and a few others) are scripted to randomly die after so many turns. Not sure if that is exactly what I did, I can't remember. I might end up doing something like this idea though since it would be a very small and simple script (assuming it works).



    Edit;

    monitor_event CharacterSelected CharacterIsLocal
    and ! IsFactionAIControlled
    and ! FactionReligion (elves)
    and ! FactionReligion (dwarves)
    and ! FactionReligion (orcs)
    and AgentType = named character

    console_command give_trait this FateOfMan 1

    end_monitor


    I just typed this up here so it isn't actual code.


    The trait code will have to be different though, pretty sure removing hitpoints doesn't do anything on the strat map, and there is no guarantee they will die in battle with 0 either. A random chance would be better in my opinion as it will will seem more natural and less scripted. The random chance will kill anyone with an "oldage" trait after a random number of turns so you will not need to know their name.


    Edit; I probably could have made the script and traits, and tested it by now instead of posting this .
    Last edited by alreadyded; December 28, 2014 at 09:34 PM.

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

    Default Re: Idea to fix elven mortality "bug"

    If by "spawn" you mean spawned by script then yes. Those in descr_strat too. But any that are generated by the game (children, adoptions, man of the hour) ... no.

    @alreadyded
    There is still the problem of it killing the wrong character when two or more have the same name.
    Last edited by Withwnar; December 28, 2014 at 09:09 PM.

  10. #10

    Default Re: Idea to fix elven mortality "bug"

    Quote Originally Posted by Withwnar View Post
    If by "spawn" you mean spawned by script then yes. Those in descr_strat too. But any that are generated by the game (children, adoptions, man of the hour) ... no.

    @alreadyded
    There is still the problem of it killing the wrong character when two or more have the same name.
    Ya I am still thinking on it, just brainstorm typing right now. Was still editing my above post when you replied. Should be able to use a "oldage" trait to tell them apart and know which random character to kill instead of all of them. Real Aragorn would never get this trait (with proper scripting) so it shouldn't be a problem. I will have to do some research though, I haven't done any scripting for this game in a year at least so... ya.
    Last edited by alreadyded; December 28, 2014 at 09:50 PM.

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

    Default Re: Idea to fix elven mortality "bug"

    Post #4 explains the issue. There is no way to tell the script "kill the Aragorn with the trait, not the Aragorn without it". All you can say is "kill Aragorn" and the game chooses one to kill 'at random'.

    It isn't random but from the player's point of view it might appear so. When deciding who to kill (or any other script command using names) the selection rules seem to be:
    If he exists in the local faction then use him; if more than one then use the one that has been on the map the longest (does not necessarily imply "oldest" age-wise).
    If not found then do likewise for AI factions.

    So you could have an Aragorn belonging to AI Eriador, and one in player Gondor. The Gondor one will be killed even if the Eriador one was in the game earlier, purely because Gondor is the local faction.

    It's fraught with problems. You can find out if a character is of killable age - and mark him as such with a trait or whatever - but at the end of the day you're only telling script to "kill somebody named Aragorn", not the specific Aragorn you actually wish to kill.

    Sending characters off map and back again also disrupts this "how long has been on the map" measure.

  12. #12

    Default Re: Idea to fix elven mortality "bug"

    Is it possible to simply make the starting characters mortal, (except elves) and let all new comers live indefinitely? It would sometimes be strange if you adopt old guys, but a player can adjust that at least himself by selecting younger ones (which I do already). If the trigger only starts in round 1 on the characters already on the map, the name thing shouldn't be a problem. The question is if it's possible to add a timer to all of them so that after X turns the random chance to die is checked. There are already random chances for traits, so maybe it could work the same way.

    My modding experience is low though, so not sure.

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

    Default Re: Idea to fix elven mortality "bug"

    No, everybody dies eventually in M2TW. Immortality isn't possible. Although it can be 'effectively' possible by having a high turns-per-year count, such that people age so slowly they outlive the campaign. But that also means that it takes ages for children to come of age, largely reducing the point of family trees.

Posting Permissions

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