Results 1 to 13 of 13

Thread: Little problem modding

  1. #1
    FoggyFogFiggy's Avatar Modding Staff
    Join Date
    Feb 2017
    Location
    Québec
    Posts
    272

    Default Little problem modding

    Hello!

    I'm trying to increase the amount of men in general units and I'm succeeding with cavalry. Since the multiplier is 2.5 with huge armies, when I put the number 20 I get 50 units plus the officers for the cavalry. But when I do the exact same thing with infantry general, like Yu Jin for exemple, the multiplier is kinda 1 or so. If I put 72, I get 80 men exactly. If I put 100, I get 103 men exactly. Not sure what cause that. :/ Can someone help me?

    Thanks!

  2. #2
    FoggyFogFiggy's Avatar Modding Staff
    Join Date
    Feb 2017
    Location
    Québec
    Posts
    272

    Default Re: Little problem modding

    And what's weird is I tested with Peasant units, I've put 100 on the soldier line and I get 250 men. So... I really don't get what I'm doing wrong. x)

  3. #3
    Gigantus's Avatar The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it
    Patrician Moderator Emeritus Administrator Emeritus Modding Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    46,608
    Blog Entries
    24

    Default Re: Little problem modding

    I vaguely remember having read somewhere that the unit type (cav, inf etc) plays a role in the multiplier. Additionally it also appears that the base number needs to be within a certain numerical sequence. Anything over 100 at a 2.5 multiplier would exceed the maximum anyhow, which is 250 (excluding officers) if memory serves. Including an officer will crash I think as it exceeds 250.

    A simple test putting the peasants on horseback should confirm the type issue. Bodyguard units are weird animals anyhow, see replenishment and varying battle sizes for the same model (heir has less then leader if rumours are to be believed).

    Edit: nope, not correct. I took the following units and made sure they had 60 as unit size:
    Spear Militia
    Peasants (because of the two peasant entries in the attribute line)
    Peasant Archers
    Hobilars
    NE Bodyguard

    The unit size at normal and huge were 75 and 150 consistently with all units. I can only assume a mix up with 'recommended' unit sizes that led to my previous assumption. Those are actually numbers that result in 'round' figures at all unit sizes (eg 16, 48, 60) and have not been 'upgraded' after the release of kingdoms (increased max number from 150 to 250).

    Yu Jin (J-0108-YuJin) uses the JiangJun_ZhongYuan_Aa_0108-YuJin unit as bodyguard. It has 25 as base unit size plus three officers which at huge results in 65 (including the 3 officers plus Yu Jin). 25*2.5=62.5 - so that's pretty close. Increasing the number to 72 returns 80 as you say. Setting it to 50 and 60 returned 80 as well (I was starting to think I edited the wrong unit).
    Disabling the general_unit attribute of the unit changed the BG to yuzhau lancers (don't blame for messing up the name) and the Yu Jin buqu unit appeared separately with 128 men. Technically that shouldn't happen because the first unit in the descr_strat IS the bodyguard unit I do however remember that a cavalry unit in descr_strat will be automatically chosen regardless which unit is listed first. Something the general_unit appears to prevent. As it prevents the unit size increase.
    Removing the cav unit in descr_strat (and the general_unit attribute of the buqu) resulted in 128 yu jin buqu from a base of 50 at huge setting. (50*2.5=125+3) Looks like the general is not included in the unit size number.

    Summary - if you have a infantry body guard you need to have the attribute if you also have cav. If you want a larger body guard both have to go. A workaround for the cavalry issue would be to only create\spawn the character with his body guard first and then add the rest of the army via script and add_unit command. A 'wait' between spawn_army and add_unit should suffice to avoid the underlying problem in case of a scripted spawn.
    Last edited by Gigantus; May 21, 2019 at 06:11 AM.



  4. #4
    FoggyFogFiggy's Avatar Modding Staff
    Join Date
    Feb 2017
    Location
    Québec
    Posts
    272

    Default Re: Little problem modding

    I keep reading you, but I don't understand I think. xD I usually am pretty good at reading english. So what you are saying is I can't have Yu Jin have a unit of 180 men without removing the character from the game, is that it?

  5. #5
    Gigantus's Avatar The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it
    Patrician Moderator Emeritus Administrator Emeritus Modding Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    46,608
    Blog Entries
    24

    Default Re: Little problem modding

    I went pretty in depth for a general approach. For your issue this part will fix it:
    Removing the cav unit in descr_strat (and the general_unit attribute of the buqu) resulted in 128 yu jin buqu from a base of 50 at huge setting. (50*2.5=125+3) Looks like the general is not included in the unit size number.
    You will now have no cavalry in your starting stack which you can solve by adding a small script to the campaign script:
    Code:
    monitor_event PreFactionTurnStart TrueCondition
        create_unit J-0108-YuJin, [unit name], num [desired number], exp 0, arm 0, wep 0
        terminate_monitor
    end_monitor



  6. #6
    FoggyFogFiggy's Avatar Modding Staff
    Join Date
    Feb 2017
    Location
    Québec
    Posts
    272

    Default Re: Little problem modding

    Ok so what I think I don't get is why is there a cav unit in desc_strat for a unit that has infantry? And if I remove the general_unit attribute, does that mean that I will only have the buqu of Yu Jin without having him in the game?

    And you wrote : "You will now have no cavalry in your starting stack", but Yu Jin already don't have any cav in his unit, so what do you mean by that? That make me question what is the use of the script then.

  7. #7
    Gigantus's Avatar The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it
    Patrician Moderator Emeritus Administrator Emeritus Modding Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    46,608
    Blog Entries
    24

    Default Re: Little problem modding

    descr_strat entry for Yu Jin (J-0108-YuJin):
    Code:
    character	J-0108-YuJin, named character, male,  age 31, x 134, y 130, portrait A097, label YuJin1
    traits JbAAAA0100 1 , Lz-0108-0 1 , Jn1001 1 , Jn2000 4 , Jn3000 7 , Jn4000 7 , Jn5000 8 , JnA1000 2 , JnA2000 3 , JnA3000 2 , JnA4000 2 , JnA5000 3 , JnA6000 3 , JnA7000 6 , JnA8000 5 , JnA9000 2 , Jnxg6000 2 , G1210JnWei-A 1 , YuJin1100 1 , A1100JnTB-A 1 , B2070JnZA-A 2 , C3070JnBJ-A 1 , Jn-pagan 3
    army
    unit		JiangJun_ZhongYuan_Aa_0108-YuJin		exp 2 armour 0 weapon_lvl 0  ; body guard unit - Gig
    unit		ZYhan_light_cav					exp 0 armour 0 weapon_lvl 0
    unit		ZYhan_light_spear				exp 1 armour 0 weapon_lvl 0
    unit		ZYhan_light_sword				exp 0 armour 0 weapon_lvl 0
    unit		ZYhan_light_cross				exp 0 armour 0 weapon_lvl 0
    unit		ZYhan_light_bow					exp 1 armour 0 weapon_lvl 0
    Problems
    - increase in BG unit size somehow does not take hold if the 'general_unit' attribute is present in EDU (infantry units only apparently)
    - removing the 'general_unit' attribute results in the cavalry unit becoming BG automatically (doesn't matter where it is listed in the unit list) as the ZhongYuan unit is infantry. The ZhongYuan unit becomes the first 'regular' unit in the stack with the increased unit size

    Solution
    - remove 'general_unit' attribute
    - remove cavalry unit
    - add cavalry unit back through the script I posted earlier. Optional, but I would suggest to do so as without cavalry an army is pretty screwed if it encounters missile troops and cavalry.



  8. #8
    FoggyFogFiggy's Avatar Modding Staff
    Join Date
    Feb 2017
    Location
    Québec
    Posts
    272

    Default Re: Little problem modding

    So if I understand correctly, instead of Yu Jin having a Bu Qu unit, he would have a light spear unit? Unless I put in this list the Bu Qu unit?

  9. #9
    Gigantus's Avatar The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it
    Patrician Moderator Emeritus Administrator Emeritus Modding Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    46,608
    Blog Entries
    24

    Default Re: Little problem modding

    Correct, normally the first unit in the list will be the body guard. The exception, like here, is when it is an infantry unit (without general_unit attribute) and a cavalry unit is present. In that case the cavalry unit will become the BG.

    If you remove the Buqu unit and the cavalry unit then the first spear unit will become the body guard (infantry as well) as there is no more cavalry present.



  10. #10
    FoggyFogFiggy's Avatar Modding Staff
    Join Date
    Feb 2017
    Location
    Québec
    Posts
    272

    Default Re: Little problem modding

    Ok but if I keep the infantry bu qu and only remove the cav, will my general keeps its bu qu unit or will they convert nonetheless to the next unit in the list (which would be the ZYhan_light_spear if I remove ZYhan_light_cav)?

  11. #11
    Gigantus's Avatar The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it
    Patrician Moderator Emeritus Administrator Emeritus Modding Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    46,608
    Blog Entries
    24

    Default Re: Little problem modding

    If you remove the cavalry then the buqu will remain the body guard. You can then remove the general_unit attribute (EDU) from the buqu - that will then enable you to increase the number of soldiers the buqu unit has.

    Solution
    - remove 'general_unit' attribute
    - remove cavalry unit



  12. #12
    FoggyFogFiggy's Avatar Modding Staff
    Join Date
    Feb 2017
    Location
    Québec
    Posts
    272

    Default Re: Little problem modding

    It works, but now I'm wondering, removing 'general_unit' attribute does what exactly? What is the use of this attribute in the game? I just want to know if the unit/character lose something after removing the 'general_unit' attribute.

  13. #13
    Gigantus's Avatar The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it
    Patrician Moderator Emeritus Administrator Emeritus Modding Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    46,608
    Blog Entries
    24

    Default Re: Little problem modding

    The attribute (general_unit) was added because otherwise the cavalry would have become the bodyguard by default.

    In game terms it designates a unit as the default body guard for a faction (only the first unit in the EDU with that attribute will be used by a faction). It is automatically used by coming of age, man of the hour and adopting general events, whose characters will die instantly if the faction does not have a unit like that - also referred to as 'harakiri' or 'suicide' bug.
    Last edited by Gigantus; June 02, 2019 at 07:21 AM.



Posting Permissions

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