Page 1 of 2 12 LastLast
Results 1 to 20 of 23

Thread: Request for help

Hybrid View

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

    Default Request for help

    Hello again
    Yes, I don't have other interests

    I made small script whose aim is to destabilize the diplomatic relations between Byzantium and Turkey. It should work on two levels:
    1. declare a war
    2. convene a militia forces

    1. War is triggering by a randomly selected event.
    2. Militia forces should be convened in on of specified provinces.
    3. When there is a clear weakening of one of the warring parties, the script forces the conclusion of peace.

    Unfortunately, script doesn't work and i suppose i found the place of stopping it.
    This is a script:

    PHP Code:
    ;<<<<<<<<<<<<<<<<<Bizancjum Turcja>>>>>>>>>>>>>>>>>>
    declare_counter turcy_wojna
    declare_counter turcy_pomoc_dana
    declare_counter byzantium_pomoc_dana
    declare_counter turcy_pomoc
    declare_counter byzantium_pomoc

    monitor_event FactionTurnStart FactionIsLocal
        
    and I_TurnNumber 3
        
    and I_NumberOfSettlements byzantium 0
           
    and I_NumberOfSettlements turks 0
        
    and not DiplomaticStanceFromFaction turks AtWar
            generate_random_counter turcy_wojna 1 100
            set_counter turcy_pomoc_dana 0
            set_counter byzantium_pomoc_dana 0
    end_monitor

    monitor_event FactionTurnStart FactionIsLocal
        
    and I_EventCounter turcy_wojna 10
        historic_event ola true
        console_command diplomatic_stance turks byzantium war
        set_faction_standing turks byzantium 0.3
        historic_event turcy_wojna true factions 
    turks byzantium , }
    end_monitor

    monitor_event FactionTurnStart FactionType turks
        historic_event ola true factions 
    turks byzantium , }
        and 
    IsFactionAIControlled turks
        generate_random_counter turcy_pomoc 1 3

        
    if I_EventCounter turcy_pomoc 3
            
    if I_SettlementOwner Iconium turks 
                
    and I_EventCounter turcy_pomoc_dana 0
                    spawn_army 
    (...)
            
    end
                set_counter turcy_pomoc_dana 1
            end_if
            
    if I_SettlementOwner Caesarea turks 
                
    and I_EventCounter turcy_pomoc_dana 0
                
    and not I_SettlementOwner Iconium turks 
                    spawn_army 
    (...)
            
    end
                set_counter turks_pomoc_dana 1
            end_if
            
    if I_SettlementOwner Malazgirt turks 
                
    and I_EventCounter turcy_pomoc_dana 0
                
    and not I_SettlementOwner Iconium turks 
                
    and not I_SettlementOwner Caesarea turks 
                    spawn_army 
    (...)
            
    end
                set_counter turcy_pomoc_dana 1
            end_if
        end_if
        
    if I_EventCounter turcy_pomoc 3
        end_if
    end_monitor

    monitor_event FactionTurnStart FactionType byzantium
        
    and IsFactionAIControlled byzantium
        generate_random_counter byzantium_pomoc 1 3    
        
        
    if I_EventCounter byzantium_pomoc 3
            
    if I_SettlementOwner Nicaea byzantium 
                
    and I_EventCounter byzantium_pomoc_dana 0
                    spawn_army 
    (...)
            
    end
                set_counter byzantium_pomoc_dana 1
            end_if
            
    if I_SettlementOwner Smyrna byzantium 
                
    and I_EventCounter byzantium_pomoc_dana 0
                
    and not I_SettlementOwner Nicaea byzantium 
                                spawn_army 
    (...)
            
    end
                set_counter byzantium_pomoc_dana 1
            end_if
            
    if I_SettlementOwner Heraclea byzantium 
                
    and I_EventCounter byzantium_pomoc_dana 0
                
    and not I_SettlementOwner Nicaea byzantium 
                
    and not I_SettlementOwner Smyrna byzantium 
                    spawn_army 
    (...)
            
    end
            set_counter byzantium_pomoc_dana 1
            end_if
        end_if
        
    if I_EventCounter byzantium_pomoc 3
        end_if
    end_monitor

    declare_counter bizancjum_turcy_pokoj

    monitor_event FactionTurnStart FactionType turks
        
    and I_NumberOfSettlements byzantium 0
        
    and I_NumberOfSettlements byzantium 4
           
    and I_NumberOfSettlements turks 0
        
    and DiplomaticStanceFromFaction byzantium AtWar
        
    if IsFactionAIControlled byzantium
            generate_random_counter turcy_tak_nie 1 2
                
    if I_EventCounter turcy_tak_nie 1
                    set_counter bizancjum_turcy_pokoj_tak 1
                end_if
                
    if I_CompareCounter turcy_tak_nie 2
                    set_counter bizancjum_turcy_pokoj_nie 1
                end_if
        end_if
        
    if not IsFactionAIControlled byzantium
            historic_event bizancjum_turcy_pokoj true
        end_if
    end_monitor

    monitor_conditions I_EventCounter bizancjum_turcy_pokoj_tak 
    1
        console_command diplomatic_stance turks byzantium peace
        set_faction_standing turks byzantium 0.6
        set_event_counter bizancjum_turcy_pokoj_tak 0
        historic_event pokoj_zawarty true factions 
    turks byzantium , }
    end_monitor

    monitor_conditions I_EventCounter bizancjum_turcy_pokoj_nie 
    1
        set_event_counter bizancjum_turcy_pokoj_nie 0
        historic_event pokoj_odrzucony true factions 
    turks byzantium , }
    end_monitor

    declare_counter turcy_bizancjum_pokoj

    monitor_event FactionTurnStart FactionType byzantium
        
    and I_NumberOfSettlements turks 0
        
    and I_NumberOfSettlements turks 3
           
    and I_NumberOfSettlements byzantium 0
        
    and DiplomaticStanceFromFaction turks AtWar
        
    if IsFactionAIControlled turks
            generate_random_counter bizancjum_tak_nie 1 2
                
    if I_CompareCounter bizancjum_tak_nie 1
                    set_counter turcy_bizancjum_pokoj_tak 1
                end_if
                
    if I_CompareCounter bizancjum_tak_nie 2
                    set_counter turcy_bizancjum_pokoj_nie 1
                end_if
        end_if
        
    if not IsFactionAIControlled byzantium
            historic_event turcy_bizancjum_pokoj true
        end_if
    end_monitor

    monitor_conditions I_EventCounter turcy_bizancjum_pokoj_tak 
    1
        console_command diplomatic_stance turks byzantium peace
        set_faction_standing turks byzantium 0.6
        set_event_counter turcy_bizancjum_pokoj_tak 0
        historic_event pokoj_zawarty true factions 
    turks byzantium , }
    end_monitor

    monitor_conditions I_EventCounter turcy_bizancjum_pokoj_nie 
    1
        set_event_counter turcy_bizancjum_pokoj_nie 0
        historic_event pokoj_odrzucony true factions 
    turks byzantium , }
    end_monitor 
    The script stopping on line:
    PHP Code:
        historic_event ola true factions turks byzantium , } 
    This line of code was introduced specifically in order to localize the site of any trouble.
    I don't understand the first line of monitor, so i suppose this is the place where i've screwed up.

    Log of course says nothing
    Last edited by attyla; December 14, 2011 at 08:03 AM.

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

    Default Re: Request for help

    Is that a command I see before a condition? ...

  3. #3

    Default Re: Request for help

    You mean
    PHP Code:
        historic_event ola true factions turks byzantium , } 
    ?
    Yes it is. But it's not "normal" command. It's checking point only.

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

    Default Re: Request for help

    You can't put a command before a condition and expect the script to work.

    Also this is strange:

    if I_EventCounter turcy_pomoc < 3
    end_if

    It won't do anything if you have no command in it.
    Last edited by Taiji; December 14, 2011 at 10:23 AM.

  5. #5
    Kiliç Alì's Avatar Domesticus
    Artifex

    Join Date
    Feb 2011
    Location
    Italy
    Posts
    2,114

    Default Re: Request for help

    Indeed. If you want a chackpoint, you should put the ";" before the condition you don't want to test, and then delete them when you see it works.
    and the


    if I_EventCounter turcy_pomoc < 3
    end_if

    needs to be filled with a command, or deleted

    Member of the Imperial House of Hader, proud client of The only and sole Ferrit

  6. #6

    Default Re: Request for help

    It's not this... I've erased historic_event and an empty loop. No changes. Script still makes a call to war, but it doesn't cause the commands...

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

    Default Re: Request for help

    Try posting just the parts of the script you know do not work, along with a description of what you expect these parts of the script to do.
    Last edited by Taiji; December 14, 2011 at 02:08 PM.

  8. #8

    Default Re: Request for help

    this part of script doesn't work:
    PHP Code:
    monitor_event FactionTurnStart FactionType turks
        
    and IsFactionAIControlled turks
        generate_random_counter turcy_pomoc 1 3

        
    if I_EventCounter turcy_pomoc 3
            
    if I_SettlementOwner Iconium turks 
                
    and I_EventCounter turcy_pomoc_dana 0
                    spawn_army 
    (...)
            
    end
                set_counter turcy_pomoc_dana 1
            end_if
            
    if I_SettlementOwner Caesarea turks 
                
    and I_EventCounter turcy_pomoc_dana 0
                
    and not I_SettlementOwner Iconium turks 
                    spawn_army 
    (...)
            
    end
                set_counter turks_pomoc_dana 1
            end_if
            
    if I_SettlementOwner Malazgirt turks 
                
    and I_EventCounter turcy_pomoc_dana 0
                
    and not I_SettlementOwner Iconium turks 
                
    and not I_SettlementOwner Caesarea turks 
                    spawn_army 
    (...)
            
    end
                set_counter turcy_pomoc_dana 1
            end_if
        end_if
        
    if I_EventCounter turcy_pomoc 3
        end_if
    end_monitor 
    If turks are AI controlled script should give them military reinforcements if give_random_counter between 1 and 3 give value 3. Those reinforcements should appear in Iconium province. If Iconium province doesn't belong to Turks, reinforcements should appear in Caesarea province. If Iconium and Caesarea doesn't belong to Turks, reinforcements should appear in Malargirt province.
    Last edited by attyla; December 14, 2011 at 02:24 PM.

  9. #9
    Emperor of Hell's Avatar SPA-NED 1-5
    Join Date
    Jul 2011
    Location
    Netherlands
    Posts
    5,747

    Default Re: Request for help

    set_counter turcy_pomoc_dana 1
    should be set_event_counter
    if I_EventCounter turcy_pomoc < 3
    end_if
    This doesn't do anything because it has no commands

  10. #10

    Default Re: Request for help

    No changes

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

    Default Re: Request for help

    Assuming turcy_pomoc_dana is at 0, your AI turkish faction has a 33.3% chance of spawning a set of brackets, and some full stops. Is that what you want?
    Last edited by Taiji; December 14, 2011 at 03:51 PM.

  12. #12

    Default Re: Request for help

    yes it is.

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

    Default Re: Request for help

    (...)

    That^ has to be a unit name, but you know this already, right?

    And you know turcy_pomoc_dana is set to 0 because it says so in your log, yes?

  14. #14

    Default Re: Request for help

    i'm giving brackets instead the list of army (it's shorter and i'm quite sure it's OK).

    turcy_pomoc_dana is set to 0. I need something that will verify that reinforcements has arrived or not.

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

    Default Re: Request for help

    Quote Originally Posted by attyla View Post
    i'm giving brackets instead the list of army (it's shorter and i'm quite sure it's OK).
    Not sure what you mean.

    Quote Originally Posted by attyla View Post
    turcy_pomoc_dana is set to 0. I need something that will verify that reinforcements has arrived or not.
    Aside from the obvious looking to see if they spawn, you'll know that the script works because it says in your log that turcy_pomoc_dana was set from 0 to 1.

  16. #16

    Default Re: Request for help

    OK if you want to this - here you are:
    (...)
    means
    PHP Code:
                faction turks
                character    random_name
    named characterage 16x 398y 138 
                traits LoyaltyStarter 1 
    GoodCommander 1 ReligionStarter 1 
                unit         ME Bodyguard                exp 0 armour 0 weapon_lvl 0
                unit        Azabs                    exp 0 armour 0 weapon_lvl 0
                unit        Azabs                    exp 0 armour 0 weapon_lvl 0
                unit        Azabs                    exp 0 armour 0 weapon_lvl 0
                unit        Azabs                    exp 0 armour 0 weapon_lvl 0
                unit        Azabs                    exp 0 armour 0 weapon_lvl 0
                unit        Akinjis                    exp 0 armour 0 weapon_lvl 0
                unit        Akinjis                    exp 0 armour 0 weapon_lvl 0
                unit        Turkish Archers                exp 0 armour 0 weapon_lvl 0
                unit        Turkish Archers                exp 0 armour 0 weapon_lvl 0
                unit        Turkish Horse Archers            exp 0 armour 0 weapon_lvl 0
                unit        Turkish Horse Archers            exp 0 armour 0 weapon_lvl 0
                unit        Turkish Horse Archers            exp 0 armour 0 weapon_lvl 0
                unit        Turkish Horse Archers            exp 0 armour 0 weapon_lvl 0 
    And i think it's not a matter of wrong value of turcy_pomoc_dana. Anyway i checked it and i just as I expected - another miss

  17. #17

    Default Re: Request for help

    Hmm, odd...

    I the only thing I can come up with is that the
    "and I_EventCounter turcy_pomoc_dana = 0" isn't met because the event counter doesn't exist yet. I believe it was Gigantus that mentioned it somewhere that an event_counter only comes to existence the first time you give it a value.

    So try adding "set_event_counter byzantium_pomoc_dana 0" Actually as far as I can see your script only uses event_counters not counters so just change the following lines and try again ( event_counters aren't declared like normal counters)

    Code:
     
    declare_counter turcy_wojna
    declare_counter turcy_pomoc_dana
    declare_counter byzantium_pomoc_dana
    declare_counter turcy_pomoc
    declare_counter byzantium_pomoc
    
    set_event_counter turcy_wojna 0
    set_event_counter turcy_pomoc_dana 0
    set_event_counter byzantium_pomoc_dana 0
    set_event_counter turcy_pomoc 0
    set_event_counter byzantium_pomoc 0
    
    Last edited by ilmrik; December 16, 2011 at 01:58 AM.

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

    Default Re: Request for help

    Yep, if it isn't set to 0 then the script shouldn't work.

  19. #19

    Default Re: Request for help

    Look at it:
    PHP Code:
    monitor_event FactionTurnStart FactionIsLocal
        
    and I_TurnNumber 3
        
    and I_NumberOfSettlements byzantium 0
           
    and I_NumberOfSettlements turks 0
        
    and not DiplomaticStanceFromFaction turks AtWar
            generate_random_counter turcy_wojna 1 100
            set_event_counter turcy_pomoc_dana 0
            set_event_counter byzantium_pomoc_dana 0
    end_monitor 
    line number 7 and 8
    Those two events have got own value set in first part of script (all script you can find below). I checked it many times before I asked for help. i couldn't find the case of disfunction - therefore i asked for help.

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

    Default Re: Request for help

    You know for certain that bit is working OK, do you? (log would tell you if it was so I assume it's so)

    Suggest you show the whole script as it is now that you've fixed the problems mentioned so far.
    Last edited by Taiji; December 16, 2011 at 10:47 AM.

Page 1 of 2 12 LastLast

Posting Permissions

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