Page 4 of 9 FirstFirst 123456789 LastLast
Results 61 to 80 of 177

Thread: Lesson 1

  1. #61

    Default Re: Lesson 1

    Quote Originally Posted by Fereveldir
    and LosingMoney > 1000
    The LosingMoney condition can't have a figure after it, I think it was mentioned earlier that all it does is check the balance sheet at the end of a turn to see if you are losing money, not by how much. You have two monitors with this in it, and I don't think either of them would then work properly.

    Also I'm not sure if this matters but I think the event, in this case FactionTurnEnd and the first condition, in this case FactionType were meant to be put on the same line as the monitor_event part. It might not matter, but the examples given showed it as that.
    Last edited by Bucket of Lithium; June 21, 2009 at 06:07 AM.


  2. #62
    Augustus Lucifer's Avatar Life = Like a beanstalk
    Patrician Citizen

    Join Date
    Aug 2006
    Location
    Mote of Dust
    Posts
    10,725

    Default Re: Lesson 1

    Quote Originally Posted by Astaroth View Post
    Here's my script.

    Spoiler Alert, click show to read: 
    Code:
    ;
    ; Campaign script
    ;
    script
    
    monitor_event FactionTurnEnd FactionType england
       and not FactionIsLocal 
       console_command add_money england, 5000
    end_monitor
    
    monitor_event BuildingCompleted SettlementName London
       and FactionType england
       and FactionIsLocal
       and SettlementBuildingFinished = market
       console_command add_money england, -1000
    end_monitor
    
    monitor_event FactionTurnEnd FactionType england
       and Treasury < 500
       console_command add_money england, 10000
    end_monitor
    
    monitor_event FactionTurnEnd FactionType england
       and FactionIsLocal
       and FactionIncome > 50000
       console_command add_money england, -10000
    end_monitor
    
    monitor_event FactionTurnEnd FactionType england
       and not FactionIsLocal
       and LosingMoney
       console_command add_money england, 2000
    end_monitor
            
            
            ; keep script unfinised until last monitor termination
        wait_monitors
    
    end_script
    Looks fine. It works in-game I assume?

    Quote Originally Posted by aduellist View Post
    BTW, has anyone played around with the SupportCostsPercentage condition?
    Nope, but I don't see why it wouldn't work as specified. You will need to tailor an easily observable situation and do something like fire an event to see if it works as intended. For instance load a faction, check their expenditures in Turn 1. Recruit some units and see how much goes to it. Then do the math and use a number a bit lower than that as the condition parameter. Have it fire a historic event as the command so you know it worked.

    Quote Originally Posted by Theodotos I View Post
    Okay, I got this script in, real simple one—thought I would see if everything fired before expanding upon it. It fires, but Med2 crashes on the second endturn. I’m using the Barebones folder and I modified the .cfg file as suggested, but nothing is showing up. So, I tried aduellist’s script, exactly as posted. Crashes, second turn. Any idea what is going wrong?
    Spoiler Alert, click show to read: 
    Code:
    ;
    ; Campaign script
    ;
    script
           
    monitor_event FactionTurnEnd FactionIsLocal
     console_command add_money sicily, 15000
    end_monitor
              
            ; keep script unfinished until last monitor termination
     wait_monitors
    end_script
    I don't see a problem with the script itself. Are you saying that the script fires and you get the money but then the next turn when you hit end turn it crashes?

    Quote Originally Posted by Fereveldir View Post
    Here's my very first try on scripting

    Spoiler Alert, click show to read: 
    Code:
    ;
    ;campaign script
    ;
    script
    
    ;Money auxiliary
    monitor_event FactionTurnEnd FactionType england
        and FactionIsLocal
        and Treasury < 0    
        and LosingMoney
        console_command add_money england, 2500 
    end_monitor
    
    
    ;economic boom
    monitor_event 
    FactionTurnEnd FactionType england
        and FactionIsLocal
        and treasury > 10000
        and and FactionIncome > 2000
        console_command add_money england, 1000
    end_monitor
    
    
    ;Useless...
    monitor_event 
    FactionTurnEnd FactionType england
        and FactionIsLocal
        and faction income = 1000
        console commmand add_money england, 100000
    end_monitor
    
    
    ;Money auxiliary 2
    monitor_event 
    FactionTurnEnd FactionType england
        and FactionIsLocal
        and LosingMoney
        console_command add_money england, 2000
    end_monitor
    
    end_script
    As Bucket of Lithium said, the event and first condition need to be on the same line as the monitor. In the economic boom monitor you need to capitalize Treasury and should only have one and before FactionIncome. In the useless monitor you should have FactionIncome instead of faction income and console_command instead of console command.

    Quote Originally Posted by Dewy View Post
    Sorry I'm studding for exams that start tomorrow and just signed on with The Last Kingdom as the expert scripter and have just copied and pasted my work done for that. This is above and beyond this lesson in some of the parts but it close enough. I have only put in 4

    Spoiler Alert, click show to read: 
    ;############################################################################
    ;########################### MONEY DEPT SCRIPT ##############################
    ;############################################################################

    monitor_event FactionTurnStart FactionType england
    and IsFactionAIControlled
    and Treasury < 0
    add_money england 5000

    end_monitor

    monitor_event FactionTurnEnd FactionType england
    and IsFactionAIControlled
    and Treasury < -1000
    add_money england 7000

    end_monitor

    ;##############################################################################
    ;###########################STOP THE CHEATER###################################
    ;##############################################################################

    monitor_event FactionTurnStart FactionType england
    and FactionIsLocal
    and I_TurnNumber <= 10
    and Treasury > 30000
    add_money england, -20000
    end_monitor


    monitor_event FactionTurnStart FactionType england
    and FactionIsLocal
    and I_TurnNumber <= 20
    and Treasury > 50000
    add_money england, -40000
    end_monitor
    Relatively. add_money is a Kingdoms command so it should be said that anyone running M2 needs to use the console_command variety. I'm not sure if that's an actual script intended to be in TLK, if it is I'd recommend you look into the possibility of locking the console as I seem to recall a command for that, as opposed to that method which could hurt a player not cheating(keep in mind it also won't stop cheating, since the player can keep adding money and spend it that turn or just out-add the subtraction). I don't frown at cheating though, but that's up to the people making the mod.
    Last edited by Augustus Lucifer; June 21, 2009 at 07:41 AM.

  3. #63
    Citizen
    Join Date
    Sep 2008
    Location
    Germany
    Posts
    2,300

    Default Re: Lesson 1

    Ok, here's the new one.

    Spoiler Alert, click show to read: 
    Code:
    ;
    ;campaign script
    ;
    script
    
    ;Money auxiliary 
    monitor_event FactionTurnEnd FactionType england 
        and FactionIsLocal
        and Treasury < 0    
        and LosingMoney
        console_command add_money england, 2500 
    end_monitor
    
    
    ;economic boom
    monitor_event FactionTurnEnd FactionType england 
        and FactionIsLocal
        and Treasury > 10000
        and FactionIncome > 2000
        console_command add_money england, 1000
    end_monitor
    
    
    ;Useless...
    monitor_event FactionTurnEnd FactionType england 
        and FactionIsLocal
            and factionIncome = 1000
            console_commmand add_money england, 100000
    end_monitor
    
    
    ;Money auxiliary 2
    monitor_event FactionTurnEnd FactionType england
         and FactionIsLocal
             and LosingMoney
             console_command add_money england, 2000
    end_monitor
    
    end_script

  4. #64
    Augustus Lucifer's Avatar Life = Like a beanstalk
    Patrician Citizen

    Join Date
    Aug 2006
    Location
    Mote of Dust
    Posts
    10,725

    Default Re: Lesson 1

    Quote Originally Posted by Fereveldir View Post
    Ok, here's the new one.

    Spoiler Alert, click show to read: 
    Code:
    ;
    ;campaign script
    ;
    script
    
    ;Money auxiliary 
    monitor_event FactionTurnEnd FactionType england 
        and FactionIsLocal
        and Treasury < 0    
        and LosingMoney
        console_command add_money england, 2500 
    end_monitor
    
    
    ;economic boom
    monitor_event FactionTurnEnd FactionType england 
        and FactionIsLocal
        and Treasury > 10000
        and FactionIncome > 2000
        console_command add_money england, 1000
    end_monitor
    
    
    ;Useless...
    monitor_event FactionTurnEnd FactionType england 
        and FactionIsLocal
            and factionIncome = 1000
            console_commmand add_money england, 100000
    end_monitor
    
    
    ;Money auxiliary 2
    monitor_event FactionTurnEnd FactionType england
         and FactionIsLocal
             and LosingMoney
             console_command add_money england, 2000
    end_monitor
    
    end_script
    Still missing a capital in the Useless... monitor, factionIncome should be FactionIncome. Also, you should add wait_monitors above end_script. After you fix that make sure it runs as intended in-game.

  5. #65
    Augustus Lucifer's Avatar Life = Like a beanstalk
    Patrician Citizen

    Join Date
    Aug 2006
    Location
    Mote of Dust
    Posts
    10,725

    Default Re: Lesson 1

    Quote Originally Posted by Hesus de bodemloze View Post
    Oke i tried some thing else.

    Spoiler Alert, click show to read: 
    Code:
    ;Campaign script
    ;money script
    
    monitor_event FactionTurnEnd FactionType england
    and FactionIsLocal
    console_command add_money england 30000
    end_monitor
    
    monitor_event FactionTurnEnd FactionType england
    and FactionIsLocal
    and Treasury > 60000
    console_command add_money england -20000
    end_monitor
    
    monitor_event FactionNewCapital FactionType england
    and TargetSettlementIsLocal = settlement
    and LosingMoney
    console_command add_money england - 2000
    end_monitor
    
    monitor_event FactionTurnEnd FactionType england
    and FactionIsLocal
    and Treasury < -500
    console_command add_money england 20000
    end_monitor
    
    ;keep script unfinished until last monitor termination
    wait_monitors
    
    end_script
    Sorry missed this one. It looks good except for the third one. The FactionNewCapital monitor only exports the faction, so it won't work with the TargetSettlementIsLocal condition. It is, to put it lightly, a useless event. It could be a wonderful event that lets you base things off what a faction's capital is, but no, it is very closed in terms of what you can use it for.

  6. #66

    Default Re: Lesson 1

    Quote Originally Posted by Dewy View Post
    try putting in the names of the vanilla version that you replaced
    What are you talking about? its all working fine now, it was as GED said, i type wait_monitor instead of wait_monitors. the factions are not vanilla but entirely new, you should know as former member of our team.
    Contribuitor IBIICB-WOTN-Modeler-Scripter


  7. #67
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,844
    Blog Entries
    10

    Default Re: Lesson 1

    Things are looking good and I see a bunch of you trying new things. A few points:

    Whenever you are trying a new event, always check and see what it exports. If the exported parameters do not match the trigger requirements of the condition, it will not fire. This is probably the hardest part for people to grasp. I will use the example posted by Hesus to explain.



    He used the FactionNewCapital event to trigger his monitor and tried to use the TargetSettlementIsLocal condition. If you look in the docudemons it says this:
    Code:
    Identifier: FactionNewCapital
    Event: A Faction has changed its capital
    Exports: faction
    Class:ET_FACTION_NEW_CAPITAL

    Code:
    Identifier: TargetSettlementIsLocal
    Trigger requirements: settlement
    Parameters: None
    Sample use: TargetSettlementIsLocal
    Description: Does the target settlement belong to the local faction?
    Battle or Strat: Either
    Class: TARGET_SETTLEMENT_IS_LOCAL
    Here you can see that he is checking an event that exports faction with a condition that requires settlement. This script will never run because the export and the requirement do not match. A better choice would be FactionIsLocal.

    We havent talked about the Target conditions yet, but a brief explanation is in order. A Target is the recipient of the action that the current event fires true for. For example if we checked the FactionWarDeclared event by using something like this to start our monitor we would detect when a non player controlled faction declares war:

    Code:
    monitor_event FactionWarDeclared not FactionIsLocal
    The event exports faction, target_faction, and target_religion. Faction is the faction that declared war, target_faction/religion is the name of the faction they declared war on.

  8. #68

    Default Re: Lesson 1

    Where do I ask any questions depending to these lessons? Am I rhight here?
    Developer of Rising Sumer
    Beta-tester for ChC; Mapper of Colonialism-TW;

  9. #69
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,844
    Blog Entries
    10

    Default Re: Lesson 1

    This is the place

  10. #70

    Default Re: Lesson 1

    I have an "mod-collector-folder" within exist some mods in their folders. Is it ok, if I put my scripts into it? Because of some much work, MTW2 is not installed yet. My machine will be to slow then...
    Greetings!
    Developer of Rising Sumer
    Beta-tester for ChC; Mapper of Colonialism-TW;

  11. #71
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,844
    Blog Entries
    10

    Default Re: Lesson 1

    Quote Originally Posted by Odoaker View Post
    I have an "mod-collector-folder" within exist some mods in their folders. Is it ok, if I put my scripts into it? Because of some much work, MTW2 is not installed yet. My machine will be to slow then...
    Greetings!
    We will be taking screen shots for when historic_events fire. You really need a working mod folder.

  12. #72
    Citizen
    Join Date
    Sep 2008
    Location
    Germany
    Posts
    2,300

    Default Re: Lesson 1

    I can't seem to bring my mod folder to work either. Barbones.bat for example doesn't work.

  13. #73
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,844
    Blog Entries
    10

    Default Re: Lesson 1

    whats in the system log?

  14. #74
    Legio's Avatar EMPRESS OF ALL THINGS
    Content Emeritus

    Join Date
    Mar 2008
    Location
    Chlοėtopia
    Posts
    43,774

    Default Re: Lesson 1

    Here is mine, this is the first time I am touching a text file in M2 so it might be.....um
    It's a little small but I hope it's good.
    Code:
    ;
    ;campaign script
    ;script
    
    monitor_event FactionTurnEnd FactionType france
     and FactionIsLocal
     and Treasury >1000
     console_command add_money england 10000
    end_monitor
    
    monitor_event FactionTurnEnd Faction Type poland
     and not FactionIsLocal
     and Treasury >100
     console_command add_money hre 2500
    end_monitor
    
    monitor-event FactionTurnStart FactionType hre
     and FactionIsLocal
     console_command add_money venice 900
    
    end_script

  15. #75
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,844
    Blog Entries
    10

    Default Re: Lesson 1

    Quote Originally Posted by Legio Caesar View Post
    Here is mine, this is the first time I am touching a text file in M2 so it might be.....um
    It's a little small but I hope it's good.
    Code:
    ;
    ;campaign script
    ;script
     
    monitor_event FactionTurnEnd FactionType france
     and FactionIsLocal
     and Treasury >1000
     console_command add_money england 10000
    end_monitor
     
    monitor_event FactionTurnEnd Faction Type poland
     and not FactionIsLocal
     and Treasury >100
     console_command add_money hre 2500
    end_monitor
     
    monitor-event FactionTurnStart FactionType hre
     and FactionIsLocal
     console_command add_money venice 900
     
    end_script
    The part in red...

    It should be monitor_event not monitor-event

    Why are you giving money to venice on hre's turn?

  16. #76
    Legio's Avatar EMPRESS OF ALL THINGS
    Content Emeritus

    Join Date
    Mar 2008
    Location
    Chlοėtopia
    Posts
    43,774

    Default Re: Lesson 1

    I was thinking to make the game harder I would inject factions around another faction with cash.

  17. #77
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,844
    Blog Entries
    10

    Default Re: Lesson 1

    Thats fine, I was just wondering. You can actually use that as a base for more complex ideas. Like HRE takes X province who happens to be at war with Venice, and they share loot.

  18. #78
    Legio's Avatar EMPRESS OF ALL THINGS
    Content Emeritus

    Join Date
    Mar 2008
    Location
    Chlοėtopia
    Posts
    43,774

    Default Re: Lesson 1

    Yes, what I hope to be able to do is recreate the sacking of Constantinople in 1204.....France takes it and Venice gets loads.
    And thanks for being patient with me!

  19. #79
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,844
    Blog Entries
    10

    Default Re: Lesson 1

    Just remember, baby steps. My best scripts all started with an idea and 3 lines of code. The banking script wasnt even my idea, and it turned into a monster 7400 lines of code.

  20. #80
    Hesus de bodemloze's Avatar The Gaul
    Civitate Patrician Content Emeritus

    Join Date
    Aug 2006
    Location
    Belgium
    Posts
    12,313

    Default Re: Lesson 1

    Hmm oke i changed mine to FactionIsLocal.
    Horum omnium fortissimi sunt Belgae :
    Hesus 's Photo Gallery
    The Writers Study|Ex-Global Moderator|Moderation Mentor| Ex - Librarian of the Scriptorium|PoTW|MAARC|ToTW
    SPQR Forum Moderator

Posting Permissions

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