Results 1 to 13 of 13

Thread: "Wounded" Faction Leader, need advice

  1. #1

    Default "Wounded" Faction Leader, need advice

    So I want to emulate a feature of NTW, this feature is the "Wounded General" where Napoleon, when defeated in battle and "killed", instead of permanently dying just respawns a few turns later in Paris after recovering from his wounds.
    I came up with this:

    Code:
    monitor_event  BecomesFactionLeader FactionType france
        and not I_CharacterExists Napoleon Bonaparte
        if I_SettlementOwner Paris_c = france
    	historic_event nap_wounded
        spawn_army 
        faction france
        character	Napoleon Bonaparte, named character, age 38, x 167, y 107, family, portrait napoleon, direction E 
        traits FrenchTraits 1 
        
        units...
        
        end_if
    end_monitor
    Then I went and changed the event for the Faction Leader appointed so that it actually reflects a change in the chain of command of the army on the field while the Emperor is recovering in Paris. Now, this is fine and all, but... first, there's no way to make Napoleon instantly a leader again. And secondly, to my understanding, he will remain the best heir (due to Authority via traits) until the current Leader dies, right? So he will remain a simple general which is not what I want.

    Is this solution all I can get from MTW2's scripting? Is there a better way to do this and if so can I forcibly remove the old Leader out of the picture?
    My Mods and Projects

    - Realism Core v5 for La Monteé de L'Empire 4.2 (NTW)
    - Battle Chaos, give life to your fights! (NTW)
    - Battleterrain Mod, larger, better campaign battle maps (NTW)
    - Developer for 1800 (ETW) battle mechanics, unit stats
    - Developer for Victoria Total War (ETW) unit modeller \ texturer
    - Developer of Rise of the Eagles (MTW2 - HOSTED), creator \ db \ models \ textures
    - Risorgimento 1859 The Franco-Austrian War (NTW), creator \ developer

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

    Default Re: "Wounded" Faction Leader, need advice

    he will remain the best heir (due to Authority via traits) until the current Leader dies, right?
    The best next heir: when the leader dies then the current heir becomes leader (always) and the guy with highest Authority becomes the new heir*.

    * This behaviour only applies when the leader dies. If it was the heir who died then the game does not use Authority to decide who becomes the new heir. Mentioned here.

    So, your script: when Napolean dies the current heir becomes leader, the best next heir becomes the new heir, and your scripted 2nd Napolean becomes the best next heir. So you'd need to then kill both that new leader and new heir for Naoplean2 to be leader. Which you can't do because you won't know for sure the names of those two guys, which the kill_character command needs.

    (All of the above is for family tree factions only, not teutonic.)

    What you could do is make Napolean2 the heir in descr_strat and send him off map. Then bring him back when Napolean1 dies. However, he will eventually die of old age while off map, in which case your bring-him-back (a spawn) will in fact be spawning yet another guy named Naploean who is not leader.

    An alternative is to make france teutonic. There, the guy with highest Command becomes leader, the heir does not regardless of his Command. So you could make some other guy heir in descr_strat, add Napolean2 to descr_strat as well with massive Command (so next leader), send them both off map so they can't be killed, then when Napolean1 dies bring back Napoean2, and you may as well bring back that heir and kill him as his job is done now (which was filling the heir slot so Napolean2 will never be in it so not prevented from becoming leader).

  3. #3

    Default Re: "Wounded" Faction Leader, need advice

    There is a command to make a general invulnerable in battle:
    Code:
    Identifier: invulnerable_general
    Parameters: character_name
    Description: invulnerable_general <character_name> : makes that named general invulnerable in battle
    Sample use: Invulnerable_general <rufus>
    Class:BATTLE_INVULNERABLE_GENERAL
    Depending on the result of the battle, you could then use "reposition_character" and "move" to make Napoléon rejoin Paris.

  4. #4

    Default Re: "Wounded" Faction Leader, need advice

    Quote Originally Posted by Withwnar View Post
    The best next heir: when the leader dies then the current heir becomes leader (always) and the guy with highest Authority becomes the new heir*.

    * This behaviour only applies when the leader dies. If it was the heir who died then the game does not use Authority to decide who becomes the new heir. Mentioned here.

    So, your script: when Napolean dies the current heir becomes leader, the best next heir becomes the new heir, and your scripted 2nd Napolean becomes the best next heir. So you'd need to then kill both that new leader and new heir for Naoplean2 to be leader. Which you can't do because you won't know for sure the names of those two guys, which the kill_character command needs.

    (All of the above is for family tree factions only, not teutonic.)

    What you could do is make Napolean2 the heir in descr_strat and send him off map. Then bring him back when Napolean1 dies. However, he will eventually die of old age while off map, in which case your bring-him-back (a spawn) will in fact be spawning yet another guy named Naploean who is not leader.

    An alternative is to make france teutonic. There, the guy with highest Command becomes leader, the heir does not regardless of his Command. So you could make some other guy heir in descr_strat, add Napolean2 to descr_strat as well with massive Command (so next leader), send them both off map so they can't be killed, then when Napolean1 dies bring back Napoean2, and you may as well bring back that heir and kill him as his job is done now (which was filling the heir slot so Napolean2 will never be in it so not prevented from becoming leader).

    Okay, so, lets see if I did things correctly. I'm taking into consideration your first method, since the aging is not an issue - I use a 12 TPY scrpit.

    First, I created the new characters in the descr_strats, with convenient labels, like so

    Code:
    character	Napoleon Bonaparte, named character, male, heir, age 37, x 167, y 107, portrait napoleon, label napoleon2 
    traits FrenchTraits 1 
    army
    
    units
    
    
    character	Napoleon Bonaparte, named character, male, heir, age 37, x 167, y 107, portrait napoleon, label napoleon3 
    traits FrenchTraits 1 
    army
    
    
    units
        
    character	Napoleon Bonaparte, named character, male, heir, age 37, x 167, y 107, portrait napoleon, label napoleon4 
    traits FrenchTraits 1 
    army
    
    
    units
        
    character	Napoleon Bonaparte, named character, male, heir, age 37, x 167, y 107, portrait napoleon, label napoleon5 
    traits FrenchTraits 1 
    army
    
    units
    
    
    character	Napoleon Bonaparte, named character, male, heir, age 37, x 167, y 107, portrait napoleon, label napoleon6 
    traits FrenchTraits 1 
    army
    
    
    units
    
    ..etc...
    napoleon1 is, of course, the label of the very first and original that will spawn on the map. I creted 10 labels up to napoleon11.
    Then I went and changed the monitor like so:

    Code:
    monitor_event FactionTurnStart FactionType france
    and I_TurnNumber = 0
    	send_character_off_map napoleon2
    	send_character_off_map napoleon3
    	send_character_off_map napoleon4
    	send_character_off_map napoleon5
    	send_character_off_map napoleon6
    	send_character_off_map napoleon7
    	send_character_off_map napoleon8
    	send_character_off_map napoleon9
    	send_character_off_map napoleon10
    	send_character_off_map napoleon11
    end_monitor
    
    
    monitor_event  FactionTurnStart FactionType france
        if not I_CharacterExists napoleon1
        and I_SettlementOwner Paris_c = france
    	historic_event nap_wounded
        
        spawn_army
        faction france
        character	Napoleon Bonaparte, named character, male, heir, age 37, x 167, y 107, portrait napoleon, label napoleon2 
        traits FrenchTraits 1 
        army
    
        units
    
    	end
    end_if
        if not I_CharacterExists napoleon1
        and not I_CharacterExists napoleon2
        and I_SettlementOwner Paris_c = france
    	historic_event nap_wounded
        
        spawn_army
        faction france
        character	Napoleon Bonaparte, named character, male, heir, age 37, x 167, y 107, portrait napoleon, label napoleon3 
        army
    
        units
    
    	end
    end_if
    
    
        if not I_CharacterExists napoleon1
        and not I_CharacterExists napoleon2
        and not I_CharacterExists napoleon3
        and I_SettlementOwner Paris_c = france
    	historic_event nap_wounded
    
        ...etc...
    So if I understood this correctly I just simply increse the numbers of napoleonXX where XX is the number until I reach 10 in the condition and everything should work fine, right?

    Quote Originally Posted by Erken View Post
    There is a command to make a general invulnerable in battle:
    Code:
    Identifier: invulnerable_general
    Parameters: character_name
    Description: invulnerable_general <character_name> : makes that named general invulnerable in battle
    Sample use: Invulnerable_general <rufus>
    Class:BATTLE_INVULNERABLE_GENERAL
    Depending on the result of the battle, you could then use "reposition_character" and "move" to make Napoléon rejoin Paris.
    I was reluctant to use this command because having a single unit that is invincible during a battle can effectively break the game. What's stopping a player from using only the Napoleon unit to massacre everyone on the field? That's a bit too overpowered.
    My Mods and Projects

    - Realism Core v5 for La Monteé de L'Empire 4.2 (NTW)
    - Battle Chaos, give life to your fights! (NTW)
    - Battleterrain Mod, larger, better campaign battle maps (NTW)
    - Developer for 1800 (ETW) battle mechanics, unit stats
    - Developer for Victoria Total War (ETW) unit modeller \ texturer
    - Developer of Rise of the Eagles (MTW2 - HOSTED), creator \ db \ models \ textures
    - Risorgimento 1859 The Franco-Austrian War (NTW), creator \ developer

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

    Default Re: "Wounded" Faction Leader, need advice

    So if I understood this correctly I just simply increse the numbers of napoleonXX where XX is the number until I reach 10 in the condition and everything should work fine, right?
    In theory. I don't know if descr_strat will complain about the same name being used more than once. Try it.

    It would be better to send those guys off map right at the start of the campaign, not waiting until france's turn (which won't be first if they're AI). It should be terminated, in which case you don't need the turn number check either...

    Code:
    monitor_event FactionTurnStart FactionType france
    and I_TurnNumber = 0
    	send_character_off_map napoleon2
    	send_character_off_map napoleon3
    	send_character_off_map napoleon4
    	send_character_off_map napoleon5
    	send_character_off_map napoleon6
    	send_character_off_map napoleon7
    	send_character_off_map napoleon8
    	send_character_off_map napoleon9
    	send_character_off_map napoleon10
    	send_character_off_map napoleon11
    terminate_monitor
    end_monitor
    You can also send guys off map in descr_strat. I don't remember the syntax.
    Last edited by Withwnar; November 23, 2019 at 07:20 PM.

  6. #6

    Default Re: "Wounded" Faction Leader, need advice

    Quote Originally Posted by Sirlion View Post
    I was reluctant to use this command because having a single unit that is invincible during a battle can effectively break the game. What's stopping a player from using only the Napoleon unit to massacre everyone on the field? That's a bit too overpowered.
    A little script could easily provoke the rout of the bodyguard beyond a certain percentage of the unit killed (+ of the army in the case of the AI). But nevermind, it would have not worked for AI vs AI battles, so it was indeed not a good idea.

  7. #7

    Default Re: "Wounded" Faction Leader, need advice

    Ok the campaign doesnt even start and, as expected, descr_strat complains about the armies, altho I have no idea why it does complain in such a manner.
    Here is what the game says:

    Code:
    18:31:01.296 [script.err] [error] Script Error in mods/RotE/data/world/maps/campaign/imperial_campaign/descr_strat.txt, at line 1527, column 1
    Cannot attach 2 armies together, army of General Napoleon (france) to the army of General Napoleon (france)
    18:31:01.296 [script.err] [error] Script Error in mods/RotE/data/world/maps/campaign/imperial_campaign/descr_strat.txt, at line 1527, column 1
    I have no idea why does the game think that the armies are "attached together" since one is the heir and the other the leader. Also it doesnt seem to complain about the names but rather the armies themselves and I dont know why. Any thoughts?

    EDIT: OK I figured it out, I forgot to change the location of the armies, so they spawned in the same tile.
    Now it works, but it seems my campaign_script is not read as they are not transported off map. It is fascinating tho, that descr_strat doesnt complain about names being identical at all. This is good.
    It seems that theres some syntax error in my script. I'll have to figure it out step by step

    EDIT2 : OK, the script to send them off map now works, however their army remains on the field... which is bad. And I cannot create another general without an army. So... this option sadly must be put aside.
    Last edited by Sirlion; November 24, 2019 at 11:52 AM.
    My Mods and Projects

    - Realism Core v5 for La Monteé de L'Empire 4.2 (NTW)
    - Battle Chaos, give life to your fights! (NTW)
    - Battleterrain Mod, larger, better campaign battle maps (NTW)
    - Developer for 1800 (ETW) battle mechanics, unit stats
    - Developer for Victoria Total War (ETW) unit modeller \ texturer
    - Developer of Rise of the Eagles (MTW2 - HOSTED), creator \ db \ models \ textures
    - Risorgimento 1859 The Franco-Austrian War (NTW), creator \ developer

  8. #8

    Default Re: "Wounded" Faction Leader, need advice

    On a not-so-separate note, half my monitors dont work and I have no idea why. What can I do to check \ see syntax errors and why my code doesnt work?
    My Mods and Projects

    - Realism Core v5 for La Monteé de L'Empire 4.2 (NTW)
    - Battle Chaos, give life to your fights! (NTW)
    - Battleterrain Mod, larger, better campaign battle maps (NTW)
    - Developer for 1800 (ETW) battle mechanics, unit stats
    - Developer for Victoria Total War (ETW) unit modeller \ texturer
    - Developer of Rise of the Eagles (MTW2 - HOSTED), creator \ db \ models \ textures
    - Risorgimento 1859 The Franco-Austrian War (NTW), creator \ developer

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

    Default Re: "Wounded" Faction Leader, need advice

    Quote Originally Posted by Erken View Post
    A little script could easily provoke the rout of the bodyguard beyond a certain percentage of the unit killed (+ of the army in the case of the AI). But nevermind, it would have not worked for AI vs AI battles, so it was indeed not a good idea.
    If it could work then it would be ideal because he'd keep his place in the family tree. With a scripted replacement the tree will be lost and he'll 'lose' his wife and children.

    Quote Originally Posted by Sirlion View Post
    OK, the script to send them off map now works, however their army remains on the field... which is bad. And I cannot create another general without an army. So... this option sadly must be put aside.
    They don't need armies, just one unit each for their bodyguards which will disappear when the Napoleans go off map.

    What you might find is that when brought back from off-map the Napolean has a dead portrait. If so then give them all a second unit which is not present in the faction at campaign start* and after the send-off-map lines destroy them to be rid of them. e.g. Peasants, destroyed with "destroy_units france Peasants".

    * If Peasants, to use that example, were also present in france's starting garrisons or armies then destroy_units will kill them too.

    Quote Originally Posted by Sirlion View Post
    On a not-so-separate note, half my monitors dont work and I have no idea why. What can I do to check \ see syntax errors and why my code doesnt work?
    Syntax errors should be appearing in the log. Not necessarily in a helpful message.

  10. #10

    Default Re: "Wounded" Faction Leader, need advice

    Ok I tried this again. The send_off_map command works but as soon as I add the other part of the script, the whole campaign_script doesnt work anymore.

    Here's what I added

    Code:
    monitor_event FactionTurnStart
    	and not I_CharacterExists napoleon1
                    spawn_army
                        faction france
                        character	Napoleon Bonaparte, named character, age 37, x 167, y 107, portrait napoleon, label napoleon2 
                        traits FrenchTraits 1 
                        army
                        ...units...
                    end
    end_monitor
    I have no clue as to why this doesnt work... its so simple, I took away any potential condition\syntax breaking stuff and left just the bare minimum. But it still wont work.
    My Mods and Projects

    - Realism Core v5 for La Monteé de L'Empire 4.2 (NTW)
    - Battle Chaos, give life to your fights! (NTW)
    - Battleterrain Mod, larger, better campaign battle maps (NTW)
    - Developer for 1800 (ETW) battle mechanics, unit stats
    - Developer for Victoria Total War (ETW) unit modeller \ texturer
    - Developer of Rise of the Eagles (MTW2 - HOSTED), creator \ db \ models \ textures
    - Risorgimento 1859 The Franco-Austrian War (NTW), creator \ developer

  11. #11

    Default Re: "Wounded" Faction Leader, need advice

    Code:
    monitor_event FactionTurnStart [Primary Condition]
        and not I_CharacterExists napoleon1
                    spawn_army
                        faction france
                        character    Napoleon Bonaparte, named character, age 37, x 167, y 107, portrait napoleon, label napoleon2 
                        traits FrenchTraits 1 
                        army
                        ...units...
                    end
    end_monitor
    You have a "and" but no primary condition like "FactionType france". The "army" just before "...units..." seems also out of place, but i guess that was in the sense "and here the army and his units".

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

    Default Re: "Wounded" Faction Leader, need advice

    Which surely the log would have mentioned in one way or another. Are you checking the log?

  13. #13

    Default Re: "Wounded" Faction Leader, need advice

    Indeed I am checking the log. There is absolutely nothing beside the usual warnings. But I think I figured out this mystery on my own. See, any time I try to spawn an army in a wrong tile, the campaign_script simply refuses to execute, as a whole. And there are no warnings. Once I set the coordinates back to a suitable tile, then everything works correctly. So this appears to have been the problem all along. I was probably trying to spawn the new army inside the same tile as the other Napoleons.
    My Mods and Projects

    - Realism Core v5 for La Monteé de L'Empire 4.2 (NTW)
    - Battle Chaos, give life to your fights! (NTW)
    - Battleterrain Mod, larger, better campaign battle maps (NTW)
    - Developer for 1800 (ETW) battle mechanics, unit stats
    - Developer for Victoria Total War (ETW) unit modeller \ texturer
    - Developer of Rise of the Eagles (MTW2 - HOSTED), creator \ db \ models \ textures
    - Risorgimento 1859 The Franco-Austrian War (NTW), creator \ developer

Posting Permissions

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