Results 1 to 14 of 14

Thread: weird behaviour

Hybrid View

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

    Default weird behaviour

    hmmm. I have something really weird. If you remember, i've added bulgarian faction to my mod. This faction spawning in 1180 and starting to siege two cities: Preslaw and Sofia. They taking this sities, but tey living sities right now
    you can find belowe the screenshoot.
    Sctript looks like this:
    monitor_event FactionTurnStart FactionIsLocal
    and I_TurnNumber = 4 ;105

    spawn_army
    faction normans
    character Ivan Asen, named character, age 18, x 351, y 187
    traits Factionleader 1 , GoodCommander 3 , PublicFaith 1 , BattleDread 2 , ReligionStarter 1 , HaleAndHearty 1
    unit Bulgarian Bodyguard exp 1 armour 0 weapon_lvl 0
    unit Slav Levies exp 1 armour 1 weapon_lvl 0
    unit Slav Levies exp 1 armour 1 weapon_lvl 0
    unit Slav Levies exp 1 armour 1 weapon_lvl 0
    unit Slav Levies exp 1 armour 1 weapon_lvl 0
    unit Slav Levies exp 1 armour 1 weapon_lvl 0
    unit Slav Levies exp 1 armour 1 weapon_lvl 0
    unit Slav Levies exp 1 armour 1 weapon_lvl 0
    unit Slav Levies exp 1 armour 1 weapon_lvl 0
    unit Slav Levies exp 1 armour 1 weapon_lvl 0
    unit Dismounted Bulgarian Cavalry exp 1 armour 0 weapon_lvl 0
    unit Dismounted Bulgarian Cavalry exp 1 armour 0 weapon_lvl 0
    unit Mongol Foot Archers exp 1 armour 0 weapon_lvl 0
    unit Mongol Foot Archers exp 1 armour 0 weapon_lvl 0
    unit Mongol Foot Archers exp 1 armour 0 weapon_lvl 0
    unit Mongol Foot Archers exp 1 armour 0 weapon_lvl 0
    unit Cuman Horse Archers exp 1 armour 0 weapon_lvl 0
    unit Cuman Horse Archers exp 1 armour 0 weapon_lvl 0
    unit Bulgarian Cavalry exp 1 armour 0 weapon_lvl 0
    unit Bulgarian Cavalry exp 1 armour 0 weapon_lvl 0
    end
    siege_settlement Ivan Asen, Preslaw, maintain
    set_counter siege_preslaw 1

    spawn_army
    faction normans
    character Teodor Asen, named character, age 16, x 338, y 184
    traits Factionheir 1 , GoodCommander 2 , BattleDread 3 , ReligionStarter 1 , LoyaltyStarter 1 , Austere 1
    unit Bulgarian Bodyguard exp 1 armour 0 weapon_lvl 0
    unit Slav Levies exp 1 armour 1 weapon_lvl 0
    unit Slav Levies exp 1 armour 1 weapon_lvl 0
    unit Slav Levies exp 1 armour 1 weapon_lvl 0
    unit Slav Levies exp 1 armour 1 weapon_lvl 0
    unit Slav Levies exp 1 armour 1 weapon_lvl 0
    unit Slav Levies exp 1 armour 1 weapon_lvl 0
    unit Slav Levies exp 1 armour 1 weapon_lvl 0
    unit Slav Levies exp 1 armour 1 weapon_lvl 0
    unit Slav Levies exp 1 armour 1 weapon_lvl 0
    unit Dismounted Bulgarian Cavalry exp 1 armour 0 weapon_lvl 0
    unit Dismounted Bulgarian Cavalry exp 1 armour 0 weapon_lvl 0
    unit Mongol Foot Archers exp 1 armour 0 weapon_lvl 0
    unit Mongol Foot Archers exp 1 armour 0 weapon_lvl 0
    unit Mongol Foot Archers exp 1 armour 0 weapon_lvl 0
    unit Mongol Foot Archers exp 1 armour 0 weapon_lvl 0
    unit Cuman Horse Archers exp 1 armour 0 weapon_lvl 0
    unit Cuman Horse Archers exp 1 armour 0 weapon_lvl 0
    unit Bulgarian Cavalry exp 1 armour 0 weapon_lvl 0
    unit Bulgarian Cavalry exp 1 armour 0 weapon_lvl 0
    end

    siege_settlement Teodor Asen, Sofia, maintain
    set_counter siege_sofia 1

    terminate_monitor
    end_monitor
    What should i change/add to make Bulgarian keep taking cities?

  2. #2

    Default Re: weird behaviour

    No ideas how to fix this problem?

  3. #3
    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: weird behaviour

    I have modified your script to the effect that the siege will be maintained for 3 rounds to allow for siege equipment to be build. You have to change the co-ordinates to be directly next to the settlement and adjust the direction according to which way the character has to look.

    Code:
    declare_counter siege_sofia
    monitor_event FactionTurnStart FactionIsLocal
              and I_TurnNumber = 4 ;105
    
        spawn_army
            faction normans
    character    Ivan Asen, named character, age 18, x 351, y 187, label attack1, direction W 
    traits Factionleader 1 , GoodCommander 3 , PublicFaith 1 , BattleDread 2 , ReligionStarter 1 , HaleAndHearty 1 
    unit        Bulgarian Bodyguard            exp 1 armour 0 weapon_lvl 0
    unit        Slav Levies                exp 1 armour 1 weapon_lvl 0
    sieging
    
    siege_settlement attack1, Sofia, maintain
    set_counter siege_sofia 1
    
        if I_CompareCounter siege_sofia < 2
                siege_settlement attack1, Sofia, maintain
        end_if
        if I_CompareCounter siege_sofia = 2
            siege_settlement attack1, Sofia, attack
        terminate_monitor
        end_if
    
        inc_counter siege_sofia 1
    terminate_monitor
    end_monitor










  4. #4

    Default Re: weird behaviour

    Now is worser. They don't attack Sofia and Preslaw and after breaking sieging cities immiediately go in Constantinoples direct.

  5. #5

    Default Re: weird behaviour

    You could set Sofia and Preslaw as horde_targets, perhaps remove the horde_target from Constantinople.

  6. #6
    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: weird behaviour

    Did you change the co-ordinates to be directly next to the city?
    Did enter the correct direction th echaracter has to face (if he is directly to the right of the settlement then the direction he has to face is West (W)

    Reason I am asking: in 9 out of 10 cases the character will attack the city










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

    Default Re: weird behaviour

    The script looks like it would increment the siege_sofia counter to a maximum of 1.
    Last edited by Taiji; May 04, 2011 at 07:17 AM.

  8. #8
    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: weird behaviour

    At least two rounds I think, at least that's what I remember when testing it :

    Code:
        if I_CompareCounter siege_sofia = 2
             siege_settlement attack1, Sofia, attack
         terminate_monitor
         end_if










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

    Default Re: weird behaviour

    But that script will only run once:
    Code:
    and I_TurnNumber = 4
    Which makes sense when considering that it spawns an army.

  10. #10
    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: weird behaviour



    Then the bottom part has to be put into it's own monitor.

    Code:
    monitor_event FactionTurnStart FactionIsLocal
               and I_TurnNumber = 4 ;105
          spawn_army
             faction normans character    Ivan Asen, named character, age 18, x 351, y 187, label attack1, direction W
      traits Factionleader 1 , GoodCommander 3 , PublicFaith 1 , BattleDread 2 , ReligionStarter 1 , HaleAndHearty 1  unit        Bulgarian Bodyguard            exp 1 armour 0 weapon_lvl 0 unit        Slav Levies                exp 1 armour 1 weapon_lvl 0 sieging 
    
     siege_settlement attack1, Sofia, maintain
       terminate_monitor
         end_monitor
    
      monitor_event FactionTurnStart FactionIsLocal
          if I_CompareCounter siege_sofia < 2
                 siege_settlement attack1, Sofia, maintain
         end_if
         if I_CompareCounter siege_sofia = 2
             siege_settlement attack1, Sofia, attack
         terminate_monitor
         end_if
          inc_counter siege_sofia 1
     end_monitor
    That must have been the reason why nothing happened. I made a two part monitor in my script, no idea why I tried to combine here.
    Last edited by Gigantus; May 04, 2011 at 09:11 AM.










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

    Default Re: weird behaviour

    Ok, that's certainly an improvement... But now the second part of the script fires every turn. So aside from the commands at best doing nothing, it will be terminated before the first part of the script can fire. Perhaps get the second part of the script to check if the character is alive, or maybe do it based on turn number again, or perhaps even use the counter.
    Last edited by Taiji; May 05, 2011 at 06:46 AM.

  12. #12
    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: weird behaviour

    Before I try it from memory again, here is the one from my script:

    Code:
    declare_counter siege_Fareyar
    monitor_event FactionTurnStart FactionType spain
        and I_TurnNumber = 1
        and not I_SettlementOwner Fareyar = norway
        and not I_SettlementOwner Fareyar = horda
        and not I_SettlementOwner Fareyar = denmark
    
    
        spawn_army
            faction spain
            character    Bjalfi, general, age 29, x 89, y 193, label v00, direction W
            unit    Huskarl Swordsmen        exp 4 armour 0 weapon_lvl 0
            unit    Leidgangr Spearmen        exp 3 armour 0 weapon_lvl 0
            unit    Leidgangr Spearmen        exp 3 armour 0 weapon_lvl 0
            unit    Herkledi Spearmen        exp 3 armour 0 weapon_lvl 0
            unit    Vikingr Axemen            exp 3 armour 0 weapon_lvl 0
            unit    Vikingr Axemen            exp 3 armour 0 weapon_lvl 0
            unit    Leidgangr Archers        exp 3 armour 0 weapon_lvl 0
        sieging
            siege_settlement v00, Fareyar, maintain
        terminate_monitor
    end_monitor
    
    monitor_event FactionTurnEnd FactionType spain
        and I_CharacterExists v00
        and not I_SettlementOwner Fareyar = norway
        and not I_SettlementOwner Fareyar = horda
        and not I_SettlementOwner Fareyar = denmark
        and I_SettlementUnderSiege Fareyar
    
        if I_CompareCounter siege_Fareyar < 2
                siege_settlement v00, Fareyar, maintain
        end_if
        if I_CompareCounter siege_Fareyar = 2
            siege_settlement v00, Fareyar, attack
        terminate_monitor
        end_if
    
        inc_counter siege_Fareyar 1
    end_monitor










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

    Default Re: weird behaviour

    Looks good to me

  14. #14

    Default Re: weird behaviour

    Resolution of my problem is very simply. I only should add horde_target to entries of Sofia and Preslaw regions in descr_regions as rebelyell2006 told and script works well now.
    Thanks you all for help

Posting Permissions

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