Page 2 of 2 FirstFirst 12
Results 21 to 27 of 27

Thread: add_money not working

  1. #21
    Alondite's Avatar Semisalis
    Join Date
    Sep 2018
    Location
    Taiwan
    Posts
    423

    Default Re: add_money not working

    Hey man, you've asked me exactly the same question through PM one week ago, and I replied it immediately. You didn't reply my message, that's fine. But the obvious syntax error is still there, it seems that you've never taken any look of my reply nor the log. Do you really want to solve the problem or not?

    I apologize for making a mistake typing "if IsFactionAIControlled russia" in my message, it should be "if I_IsFactionAIControlled russia". Here I post my PM again and fix the mistake, I believe I've explained things clear.
    Quote Originally Posted by Alondite
    Hey,

    First of all I have to say your script has a syntax error. Have you ever taken a look of the log after you start a new campaign? The compiler would say your script has errors in line xxx, so would turn to use the vanilla campaign_script. That's why everything you've done didn't work. Besides, there are no "console_command add_money russia, 20000", you should try either "add_money russia 20000" or "console_command add_money 20000". The command "add_money russia 20000" will add money to the faction russia, whether it's controlled by AI doesn't matter; while the command "console_command add_money 20000" add money to the local factions, i.e. player's faction.(It should be OK)

    Your script (inside the monitor):
    Code:
    if I_CompareCounter month == 1 ;January
        if not I_IsFactionAIControlled russia
            console_command add_money russia, 20000
        end_if
        and I_CompareCounter winter_severity == 1 ; normal winter
        console_command season winter
        historic_event month_1
    end_if
    should be changed to:
    Code:
    if I_CompareCounter month == 1 ;January
        if not I_IsFactionAIControlled russia
            add_money russia 20000
        end_if
       if I_CompareCounter winter_severity == 1 ; normal winter
           console_command season winter
       end_if
        historic_event month_1
    end_if
    About your question, a monitor is only a trigger. In your script, when the players turn start, the game will run the commands inside it. The conditions of the monitor doesn't effect how the commands work, but only when to be triggered.

    However, the condition you wrote to give russia money does't work for AI russia because the if condition "not I_IsFactionAIControlled russia" means "russia is not controlled by AI", i.e. "the player is controlling russia". In this case if the player plays russia he'll get money; if he does not, the AI russia won't get it since the condition is not satisfied.

    For your purpose, to give AI money every year, I'd like to use the following script:
    Code:
    monitor_event PreFactionTurnStart FactionIsLocal
        if I_CompareCounter month == 1 ;January
            if I_IsFactionAIControlled russia
                add_money russia 20000
            end_if
            (...duplicate the three lines above for all factions...)
    
            if I_CompareCounter winter_severity == 1 ; normal winter
                console_command season winter
            end_if
            historic_event month_1
        end_if
    end_monitor
    And one reminder here, the change in campaign_script is not savegame-compatible. You have to restart a campaign every time you change the campaign script to see it works.

    Cheers
    Please try it, and tell me whether it works. If it doesn't, could you please upload the log?
    Last edited by Alondite; November 02, 2019 at 10:36 PM.

  2. #22
    Danya82's Avatar Tiro
    Join Date
    Oct 2010
    Location
    Saint-Petersburg, Russia
    Posts
    227

    Default Re: add_money not working

    You mistaked, i read your message many times, but the question is if i give money in ageing script - it's ok and no syntax error. But there are monitor with LocalFaction, will it work if i want to give money AI factions? And why counter month not work not in the ageing script GrnEyedDevil? Why I_TurnNumber command not work?

    Code:
    ;; Campaign script
    ;    Written by GrnEyedDvl
    ;
    ;    Table of Contents
    ;    1. 12 turns per year, characters age in December
    ;    80% chance of a normal winter, 10% chance of severe winter, 10% chance of mild winter
    ;
    ;
    ;
    
    
    
    
    script
    
    
        ;show the whole map
        restrict_strat_radar false
    
    
    ;    1. 12 Turns per year.
    declare_counter month
    declare_counter winter_severity
    set_counter winter_severity 1 ;normal winter, 2 = severe winter, 3 = mild winter
    set_counter month 1 ;set to January 
    
    
    monitor_event PreFactionTurnStart FactionIsLocal ; set the season for each month
        if I_CompareCounter month == 1 ;January
            and I_CompareCounter winter_severity == 1 ; normal winter
            console_command season winter
        end_if
        
        if I_CompareCounter month == 1 ;January
            and I_CompareCounter winter_severity == 2; severe winter
            console_command season winter
        end_if
        
        if I_CompareCounter month == 1 ;January
            and I_CompareCounter winter_severity == 3; mild winter
            console_command season summer
        end_if
        
        if I_CompareCounter month == 2 ;February
            and I_CompareCounter winter_severity == 1; normal winter
            console_command season winter
            set_event_counter summer_winter 1; next turn will be summer
        end_if
        
        if I_CompareCounter month == 2 ;February
            and I_CompareCounter winter_severity == 2; severe winter
            console_command season winter
        end_if
        
        if I_CompareCounter month == 2 ;February
            and I_CompareCounter winter_severity == 3; mild winter
            console_command season summer
        end_if
        
        if I_CompareCounter month == 3 ;March
            and I_CompareCounter winter_severity == 1; normal winter
            console_command season summer
        end_if
        
        if I_CompareCounter month == 3 ;March
            and I_CompareCounter winter_severity == 2;severe winter
            console_command season winter
        end_if
        
        if I_CompareCounter month == 3 ;March
            and I_CompareCounter winter_severity == 3; mild winter
            console_command season summer
        end_if
        
        if I_CompareCounter month == 4 ;April
            and I_CompareCounter winter_severity == 1; normal winter
            console_command season summer
        end_if
        
        if I_CompareCounter month == 4 ;April
            and I_CompareCounter winter_severity == 2; severe winter
            console_command season winter
            set_event_counter summer_winter 1; next turn will be summer
        end_if
        
        if I_CompareCounter month == 4 ;April
            and I_CompareCounter winter_severity == 3; mild winter
            console_command season summer
        end_if
    
    
        if I_CompareCounter month == 5 ;May
            console_command season summer
        end_if
        
        if I_CompareCounter month == 6 ;June
            console_command season summer
        end_if
        
        if I_CompareCounter month == 7 ;July
            console_command season summer
        end_if
        
        if I_CompareCounter month == 8 ;August
            console_command season summer
        end_if
        if I_CompareCounter month == 8 ;August
            and I_CompareCounter winter_severity == 2 ; severe winter
            set_event_counter summer_winter 2;next turn will be winter
        end_if
        
        if I_CompareCounter month == 9 ;September
            and I_CompareCounter winter_severity == 1; normal winter
            console_command season summer
            set_event_counter summer_winter 2;next turn will be winter
        end_if
        
        if I_CompareCounter month == 9 ;September
            and I_CompareCounter winter_severity == 2; severe winter
            console_command season winter
            historic_event severe_winter
        end_if
        
        if I_CompareCounter month == 9 ;September
            and I_CompareCounter winter_severity == 3; mild winter
            console_command season summer
        end_if
        
        if I_CompareCounter month == 10 ;October
            and I_CompareCounter winter_severity == 1; normal winter
            console_command season winter
        end_if
        
        if I_CompareCounter month == 10 ;October
            and I_CompareCounter winter_severity == 2; severe winter
            console_command season winter
        end_if
        
        if I_CompareCounter month == 10 ;October
            and I_CompareCounter winter_severity == 3; mild winter
            console_command season summer
            historic_event mild_winter
        end_if
        
        if I_CompareCounter month == 11 ;November
            and I_CompareCounter winter_severity == 1; normal winter
            console_command season winter
        end_if
        
        if I_CompareCounter month == 11; November
            and I_CompareCounter winter_severity == 2; severe winter
            console_command season winter
        end_if
        
        if I_CompareCounter month == 11 ;November
            and I_CompareCounter winter_severity == 3; mild winter
            console_command season summer
            set_event_counter summer_winter 2;next turn will be winter
        end_if
        
        if I_CompareCounter month == 12 ;December
            console_command season winter
        end_if
        
        if I_CompareCounter month == 12 ;December
            and I_CompareCounter winter_severity == 3; mild winter
            set_event_counter summer_winter 1; next turn will be summer
        end_if
        
        inc_counter month 1 ;advance the month
        if I_CompareCounter month == 13 ;start a new year
            set_counter month 1
        end_if
    end_monitor
    
    
    monitor_event FactionTurnEnd FactionType slave ;allows game to advance age
        and I_CompareCounter month < 12
        console_command season summer
    end_monitor
    
    
    monitor_event FactionTurnEnd FactionType slave ; randomized winter
        and I_CompareCounter month == 6
        generate_random_counter random_winter 1 10
            if I_EventCounter random_winter >= 1
                and I_EventCounter random_winter <= 8
                set_counter winter_severity 1 ;80 percent chance of severe winter
            end_if
    
    
            if I_EventCounter random_winter == 9
                set_counter winter_severity 2 ;10 percent chance of severe winter
            end_if
            
            if I_EventCounter random_winter == 10
                set_counter winter_severity 3 ;10 percent chance of mild winter
            end_if        
    end_monitor
    
    
    wait_monitors
    end_script
    Here the full script from site

    And any case no errors in log
    Last edited by Leonardo; November 08, 2019 at 04:54 AM. Reason: Posts merged.

  3. #23
    Alondite's Avatar Semisalis
    Join Date
    Sep 2018
    Location
    Taiwan
    Posts
    423

    Default Re: add_money not working

    Quote Originally Posted by Danya82 View Post
    But there are monitor with LocalFaction, will it work if i want to give money AI factions?
    I've answered this question both in PM and in #21. If it was my poor English causing you couldn't understand it, I apologize. Here I tell you again:

    A monitor is only a trigger. The conditions of the monitor doesn't effect how the commands work, but only decides when these command should be triggered.

    Your monitor along with conditions:
    Code:
    monitor_event PreFactionTurnStart FactionIsLocal
    only means that this event is triggered when the player's turn is about to start. Then the game execute the commands inside it, i.e.
    Spoiler Alert, click show to read: 
    Code:
        if I_CompareCounter month == 1 ;January
            and I_CompareCounter winter_severity == 1 ; normal winter
            console_command season winter
        end_if
        
        if I_CompareCounter month == 1 ;January
            and I_CompareCounter winter_severity == 2; severe winter
            console_command season winter
        end_if
    
        (...)
        
        if I_CompareCounter month == 12 ;December
            and I_CompareCounter winter_severity == 3; mild winter
            set_event_counter summer_winter 1; next turn will be summer
        end_if
        
        inc_counter month 1 ;advance the month
        if I_CompareCounter month == 13 ;start a new year
            set_counter month 1
        end_if
    What these commands do is completely independent of the trigger and conditions. So the answer is, if your commands are correct, they will give money to AI.


    Quote Originally Posted by Danya82 View Post
    And why counter month not work not in the ageing script GrnEyedDevil?
    I can't get what you mean about "not work". I can't say anything until you give a more detailed statement about what problem you met.


    Quote Originally Posted by Danya82 View Post
    Why I_TurnNumber command not work?
    First of all that's a condition, not command. Please read it carefully: https://www.twcenter.net/forums/show...70658-Lesson-1 GrnEyedDvl has explained the concept of triggers, conditions and commands there. I'd say no one can march forward without understanding these basic concepts.

    Another thing to mention is that the condition "I_TurnNumber = 0" means turn 1, i.e. the first turn when the game starts, and "I_TurnNumber = 1" means turn 2, and so on. If you didn't know it and put the "I_TurnNumber = 1" there, it would return a FALSE in the first turn absolutely.

  4. #24
    Danya82's Avatar Tiro
    Join Date
    Oct 2010
    Location
    Saint-Petersburg, Russia
    Posts
    227

    Default Re: add_money not working

    "First of all that's a condition, not command. Please read it carefully: https://www.twcenter.net/forums/show...70658-Lesson-1 GrnEyedDvl has explained the concept of triggers, conditions and commands there. I'd say no one can march forward without understanding these basic concepts.

    Another thing to mention is that the condition "I_TurnNumber = 0" means turn 1, i.e. the first turn when the game starts, and "I_TurnNumber = 1" means turn 2, and so on. If you didn't know it and put the "I_TurnNumber = 1" there, it would return a FALSE in the first turn absolutely."

    I know that

    "I can't get what you mean about "not work" I mean that inside ageing script it work, but in any other part of the campaign_script file it not work.

    "only means that this event is triggered when the player's turn is about to start" In Titanium that i'm modding there are counter turn_fid, so if my faction turn about to start having turn_fid = 10, so event will triggered only for AI factions with turn_fid = 11, 12 etc.?
    Last edited by Leonardo; November 08, 2019 at 04:53 AM. Reason: Posts merged.

  5. #25
    Alondite's Avatar Semisalis
    Join Date
    Sep 2018
    Location
    Taiwan
    Posts
    423

    Default Re: add_money not working

    Quote Originally Posted by Danya82 View Post
    "I can't get what you mean about "not work" I mean that inside ageing script it work, but in any other part of the campaign_script file it not work.
    They should work all around the campaign script. Can you post your overall script?

    Quote Originally Posted by Danya82 View Post
    "only means that this event is triggered when the player's turn is about to start" In Titanium that i'm modding there are counter turn_fid, so if my faction turn about to start having turn_fid = 10, so event will triggered only for AI factions with turn_fid = 11, 12 etc.?
    I can't get what you're saying. You didn't pose any of your scripts so I can't get any clue about the situation.

    Do you have a basic concept about how a processor work? Do you really know how a monitor event work? A simple example is here.
    Spoiler Alert, click show to read: 
    Code:
    monitor_event FactionTurnStart FactionIsLocal
        and I_CompareCounter turn_fid = 10
            add_money russia 20000
    end_monitor
    - trigger:
    step 1. FactionTurnStart: When a faction's turn start (england, france, etc), start to check the conditions

    - condition:
    step 2. FactionIsLocal: If this turn is the player's turn, keep going. If not, stop and halt the execution of the monitor.
    step 3. I_CompareCounter turn_fid = 10: Check whether the value of the counter "turn_fid" is equal to 10. If it is, keep going. If not, stop and halt the execution of the monitor.

    - commands:
    step 4. add_money russia 20000: Add 20000 gold to the faction russia. Whether it's the player's faction doesn't matter.

    - end_monitor
    step 5. end_monitor: halt the execution of the monitor.
    I've done my best explaining this. Hope you can get how things work, then every time you write a new monitor, please think and simulate how it works in your brain.

  6. #26
    Danya82's Avatar Tiro
    Join Date
    Oct 2010
    Location
    Saint-Petersburg, Russia
    Posts
    227

    Default Re: add_money not working

    For add money AI what command have to be: add_money turks 10000 or add_money turks, 10000 (with comma)?

  7. #27
    Danya82's Avatar Tiro
    Join Date
    Oct 2010
    Location
    Saint-Petersburg, Russia
    Posts
    227

    Default Re: add_money not working

    For add money AI what command have to be: add_money turks 10000 or add_money turks, 10000 (with comma)?
    Last edited by Danya82; December 27, 2019 at 06:18 AM. Reason: not need anymore

Page 2 of 2 FirstFirst 12

Posting Permissions

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