Page 6 of 9 FirstFirst 123456789 LastLast
Results 101 to 120 of 177

Thread: Lesson 1

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Hector Barbossa's Avatar Avast Ye Lubbers
    Join Date
    Apr 2008
    Location
    England
    Posts
    20,888

    Default Re: Lesson 1

    Corrected now i noticed the mistake in my log file when i tested it out any way here is the corrected version.


    Spoiler Alert, click show to read: 
    script

    monitor_event FactionTurnEnd FactionType hre
    and not FactionIsLocal
    and Treasury < 1000
    console_command add_money hre, 1500
    end_monitor

    monitor_event FactionTurnEnd FactionType russia
    console_command add_money russia, -2000
    end_monitor

    monitor_event FactionTurnEnd FactionType england
    and not FactionIsLocal
    console_command add_money england, 2000
    end_monitor

    monitor_event FactionTurnEnd FactionType spain
    and not FactionIsLocal
    console_command add_money spain, -2500
    end_monitor

    wait_monitors

    end_script

  2. #2

    Default Re: Lesson 1

    That's one hell of a script , Stephan

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

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

    Default Re: Lesson 1

    A few points:

    I completely agree with HL about making sure they work in game. In fact in Lesson 2 I will be asking for screen shots of certain things. It is in your best interest to test them before you post. If you have problems getting them to work we will certainly guide you in debugging them, but you should make the effort first. The idea behind this class is not to copy and paste, but to get you to think about how the functions work so you can try new combinations on your own, and you cannot do that if we fix all of your mistakes for you.


    Stephan:
    Great idea on the blockaded port, but there is an event you can use to test that instead of using x,y locations. You can use the Transgression event with the list of transgressions in this thread and do a lot of cool stuff.

    Your script will run once you include x,y but it will fire even if the two factions are allied. You should put a FactionStanding condition in there. + rep for the idea


    Skandranon, Glen:
    Looks good.

  4. #4

    Default Re: Lesson 1

    Done.
    Spoiler Alert, click show to read: 
    Code:
    ;
    ; Campaign script
    ;
    script
    monitor_event FactionTurnEnd FactionType england
       and FactionIsLocal
       and OnAWarFooting    
       console_command add_money england, 10000
    end_monitor
    monitor_event FactionTurnEnd FactionType england
     and FactionIsLocal
     and LosingMoney
     console_command add_money england, 15000
    end_monitor
    monitor_event BuildingCompleted SettlementName Nottingham
       and SettlementBuildingFinished = small_chapel
       console_command add_money england, 5000
    end_monitor
    monitor_event BuildingDestroyed SettlementName London
     and SettlementBuildingDestroyed = corn_exchange
     console_command add_money england, -5000
    end_monitor
    ; keep script unfinished until last monitor termination
    wait_monitors
    end_script
    Son of PW

  5. #5
    ★Bandiera Rossa☭'s Avatar The Red Menace
    Join Date
    Feb 2007
    Location
    California, USA
    Posts
    6,237

    Default Re: Lesson 1

    ;Campaign Script
    ;Slurricane-for class (money scripts)
    script

    ;add money to timurids if under 10k
    monitor_event FactionTurnEnd FactionType timurids
    and not FactionIsLocal
    and Treasury < 10000
    console_command add_money timurids, 10000
    end_monitor

    ;event money base for hre conflict
    monitor_event FactionTurnEnd FactionType hre
    and not FactionIsLocal
    and Treasury < 100000
    console_command add_money hre, -10000
    console_command add_money hre, -10000
    console_command add_money hre, -15000
    end_monitor

    ;Add money england
    monitor_event FactionTurnEnd FactionType england
    and not FactionIsLocal
    and Treasury < 2000
    console_command add_money england, 10000
    console_command add_money england, 10000
    console_command add_money england, 10000
    console_command add_money england, 10000
    console_command add_money england, 10000
    end_monitor

    ;mongol reduction
    monitor_event FactionTurnEnd FactionType mongols
    and not FactionIsLocal
    and Treasury < 3000000
    console_command add_money mongols, -100000
    console_command add_money mongols, -100000
    console_command add_money mongols, -100000
    console_command add_money mongols, -100000
    console_command add_money mongols, -100000
    end_monitor

    ;mongol optimization
    monitor_event FactionTurnEnd FactionType mongols
    and not FactionIsLocal
    and Treasury < 30000
    console_command add_money mongols, 100000
    console_command add_money mongols, 100000
    console_command add_money mongols, 100000
    console_command add_money mongols, 100000
    console_command add_money mongols, 100000
    end_monitor

    wait_monitors

    end_script

    is this what you guys meant?


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

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

    Default Re: Lesson 1

    I think everyone is getting the idea here.


    Theodotos, did you find the conditions SettlementBuildingFinished and SettlementBuildingDestroyed in the official docudemons?? They arent in my list. It should probably be:

    Code:
    monitor_event BuildingCompleted SettlementName Nottingham
            and BuildingName = small_chapel
            console_command add_money england, 5000
    end_monitor

  7. #7
    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 GrnEyedDvl View Post
    I think everyone is getting the idea here.


    Theodotos, did you find the conditions SettlementBuildingFinished and SettlementBuildingDestroyed in the official docudemons?? They arent in my list. It should probably be:

    Code:
    monitor_event BuildingCompleted SettlementName Nottingham
            and BuildingName = small_chapel
            console_command add_money england, 5000
    end_monitor
    SettlementBuildingFinished and SettlementBuildingExists are conditions, SettlementBuildingDestroyed doesn't seem to be.

    For destroyed buildings you will need to use the event BuildingDestroyed and then the condition BuildingName.

    The difference is SettlementBuildingFinished requires prior_build, which is exported by BuildingCompleted but not exported by BuildingDestroyed. On the other side, BuildingName requires resource_description which is exported by BuildingDestroyed but not by BuildingCompleted.
    Last edited by Augustus Lucifer; June 24, 2009 at 06:23 AM.

  8. #8

    Default Re: Lesson 1

    Quote Originally Posted by Augustus Lucifer View Post
    SettlementBuildingFinished and SettlementBuildingExists are conditions, SettlementBuildingDestroyed doesn't seem to be.

    For destroyed buildings you will need to use the event BuildingDestroyed and then the condition BuildingName.

    The difference is SettlementBuildingFinished requires prior_build, which is exported by BuildingCompleted but not exported by BuildingDestroyed. On the other side, BuildingName requires resource_description which is exported by BuildingDestroyed but not by BuildingCompleted.
    I could not find it in the official list, but it does work. The minute you destroy the building, your treasury is wiped out. That said, do I need to redo the work?
    Son of PW

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

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

    Default Re: Lesson 1

    Quote Originally Posted by Theodotos I View Post
    I could not find it in the official list, but it does work. The minute you destroy the building, your treasury is wiped out. That said, do I need to redo the work?
    That shouldnt work. I would bet that if you check the logs its running that command no matter what conditions you throw in there. If you mix events/conditions on the first line like that things are often unpredictable. FactionTurnEnd and SettlementName are not designed to go together.

  10. #10

    Default Re: Lesson 1

    Quote Originally Posted by GrnEyedDvl View Post
    That shouldnt work. I would bet that if you check the logs its running that command no matter what conditions you throw in there. If you mix events/conditions on the first line like that things are often unpredictable. FactionTurnEnd and SettlementName are not designed to go together.
    I don't have them together, unless I've gone blind. Let me repost my script. . .

    Here:
    Spoiler Alert, click show to read: 
    Code:
    ;
    ; Campaign script
    ;
    script
    monitor_event FactionTurnEnd FactionType england
       and FactionIsLocal
       and OnAWarFooting    
       console_command add_money england, 10000
    end_monitor
    monitor_event FactionTurnEnd FactionType england
     and FactionIsLocal
     and LosingMoney
     console_command add_money england, 15000
    end_monitor
    monitor_event BuildingCompleted SettlementName Nottingham
       and SettlementBuildingFinished = small_chapel
       console_command add_money england, 5000
    end_monitor
    monitor_event BuildingDestroyed SettlementName London
     and SettlementBuildingDestroyed = corn_exchange
     console_command add_money england, -5000
    end_monitor
    ; keep script unfinished until last monitor termination
    wait_monitors
    end_script
    Son of PW

  11. #11

    Default Re: Lesson 1

    Spoiler Alert, click show to read: 

    script

    restrict_strat_radar false



    monitor_event FactionTurnEnd FactionType scotland
    and not FactionIsLocal
    and Treasury < 500
    console_command add_money scotland, 1700
    end_monitor

    monitor_event FactionTurnEnd FactionType portugal
    console_command add_money russia, 3000
    end_monitor

    monitor_event FactionTurnEnd FactionType sicily
    and not FactionIsLocal
    console_command add_money sicily, 3000
    end_monitor

    monitor_event FactionTurnEnd FactionType poland
    and not FactionIsLocal
    console_command add_money poland, -2500
    end_monitor

    wait_monitors

    end_script
    Last edited by Celsius; June 24, 2009 at 01:35 PM.

  12. #12

    Default Re: Lesson 1

    heres mine its for EoR so last oen if Ostrogoths build a port its bad for Eastern Roman Empire as they now have trade partners and so loose money

    Code:
    ;;;;;;;;;;fortheuni;;;;;;;;;;;;;;;;
    
    monitor_event FactionTurnEnd FactionType hungary
     and FactionIsLocal
     and LosingMoney
     and CampaignDifficulty = very_hard
     and Treasury < 100
     console_command add_money hungary, 2000
    end_monitor
    
    monitor_event FactionTurnEnd FactionType hre
     and FactionIsLocal
     and LosingMoney
     and Treasury < 100
     console_command add_money hre, 2000
    end_monitor
    
    monitor_event FactionTurnEnd FactionType mongols
     and FactionIsLocal
     and LosingMoney
     and Treasury < 100
     console_command add_money mongols, 5000
    end_monitor
    
    ;;;;;;;Why are you such a good player?;;;;;;;;;;;;;;;;;
    
    monitor_event FactionTurnEnd FactionType england
     and FactionIsLocal
     and Treasury < 40000
     and I_TurnNumber <=5
     console_command add_money england, -25000
    end_monitor
    
    ;;;;;;;;;;;;;;;;;;;;;;;;
    
    monitor_event FactionTurnEnd SettlementName Rome FactionType hre 
     and FactionIsLocal
     and LosingMoney
     and SettlementBuildingFinished = port
     and console_command add_money milan -5000

  13. #13
    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

    Both look fine.

    A couple things in Nak's script. For the "Why are you such a good player?" are you trying to show a mock cheating-prevention script? If so that script would work but it wouldn't do what you want it to do, since it says and Treasury < 40000 that means players will be penalized for having less then 40,000 gold, as opposed to more than. Just flip the logical operator around.

    The last one won't work for a few reasons. FactionTurnEnd only exports faction, and two of the conditions SettlementBuildingFinished and SettlementName need the event they run off to export settlement. You also have two conditions on the first line, and an "and" before the command add_money(missing end_monitor also but I'll assume you just didn't paste that part).

  14. #14
    Dewy's Avatar Something Witty
    Join Date
    Jun 2008
    Location
    Australia
    Posts
    4,697

    Default Re: Lesson 1

    Quote Originally Posted by Nakharar View Post
    heres mine its for EoR so last oen if Ostrogoths build a port its bad for Eastern Roman Empire as they now have trade partners and so loose money

    Code:
    ;;;;;;;;;;fortheuni;;;;;;;;;;;;;;;;
    
    monitor_event FactionTurnEnd FactionType hungary
     and FactionIsLocal
     and LosingMoney
     and CampaignDifficulty = very_hard
     and Treasury < 100
     console_command add_money hungary, 2000
    end_monitor
    
    monitor_event FactionTurnEnd FactionType hre
     and FactionIsLocal
     and LosingMoney
     and Treasury < 100
     console_command add_money hre, 2000
    end_monitor
    
    monitor_event FactionTurnEnd FactionType mongols
     and FactionIsLocal
     and LosingMoney
     and Treasury < 100
     console_command add_money mongols, 5000
    end_monitor
    
    ;;;;;;;Why are you such a good player?;;;;;;;;;;;;;;;;;
    
    monitor_event FactionTurnEnd FactionType england
     and FactionIsLocal
     and Treasury < 40000
     and I_TurnNumber <=5
     console_command add_money england, -25000
    end_monitor
    
    ;;;;;;;;;;;;;;;;;;;;;;;;
    
    monitor_event FactionTurnEnd SettlementName Rome FactionType hre 
     and FactionIsLocal
     and LosingMoney
     and SettlementBuildingFinished = port
     and console_command add_money milan -5000
    That looks alot like my code
    Oh no the picture of my dog disappeared!

  15. #15

    Default Re: Lesson 1

    ok thanks for the why you such a good player it wasnt cheating provention, but could be was more of if a players just generally to good

  16. #16

    Default Re: Lesson 1

    Here is my try.
    It's to help Scotland for their war against the English

    Code:
    ;
    ; Campaign script
    ;
    script
     
    monitor_event FactionTurnEnd FactionType scotland
       and not FactionIsLocal 
       console_command add_money scotland, 5000
    end_monitor
     
    monitor_event FactionTurnEnd FactionType scotland
       and not FactionIsLocal   
       and Treasury < 500
       console_command add_money scotland, 5000
    end_monitor
     
    monitor_event FactionTurnEnd FactionType scotland
       and not FactionIsLocal
       and FactionIncome < 0
       console_command add_money scotland, 10000
    end_monitor
     
    monitor_event FactionTurnEnd FactionType england
       and not FactionIsLocal
       and Treasury > 50000
       console_command add_money england, -25000
    end_monitor
     
    monitor_event FactionTurnEnd FactionType england
       and not FactionIsLocal
       and FactionIncome > 10000
       console_command add_money england, -2500
    end_monitor
     
     
    wait_monitors
     
    end_script
    Last edited by Ratbag; June 25, 2009 at 08:36 AM.
    | "I don't suffer from insanity, I enjoy every minute of it." |

    My Workshop |The Graphics Workshop| Critic's Quill |Imperium Graecorum

  17. #17

    Default Re: Lesson 1

    Good job Ratbag One note :

    you forgot a 'wait_monitors' before the 'end_script

    Quote Originally Posted by Dewy View Post
    That looks alot like my code
    If you ask me , they all look the same ...

  18. #18

    Default Re: Lesson 1

    Quote Originally Posted by KingTheoden1 View Post
    Good job Ratbag One note :

    you forgot a 'wait_monitors' before the 'end_script
    Corrected it, thanks for pointing it out!
    | "I don't suffer from insanity, I enjoy every minute of it." |

    My Workshop |The Graphics Workshop| Critic's Quill |Imperium Graecorum

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

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

    Default Re: Lesson 1

    Looking good. I am making some last minute changes to Lesson 2 and will post it later tonight.

  20. #20
    B. Ward's Avatar ★★★★ RockNRolla ★★★★
    Join Date
    Feb 2007
    Location
    East Coast, United States
    Posts
    4,376

    Default Re: Lesson 1

    Ta-Da!!!

    Spoiler Alert, click show to read: 
    ; TWC University Campaign Script for Scripting 101
    ;
    script

    ; I don't like you so I'll give Sicily more money unless you're playing them.
    monitor_event FactionTurnEnd FactionType sicily
    and not FactionIsLocal
    and Treasury < 50000
    console_command add_money sicily, 12500
    end_monitor

    ; Since I really don't like you and you happen to be playing as Sicily, you'll never be able to understand where all you money is going. Loser.
    monitor_event FactionTurnEnd FactionType sicily
    and FactionIsLocal
    and Treasury > 50000
    console_command add_money sicily, -25000
    end_monitor

    ; Yes, I know what more can I do to you? How about this?
    monitor_event FactionTurnEnd FactionType sicily
    and not FactionIsLocal
    and FactionIncome <= 5000
    console_command add_money sicily, 1250
    end_monitor

    ; Oh but it gets better. Bet you'll find another faction to play next time huh?
    monitor_event FactionTurnEnd FactionType sicily
    and FactionIsLocal
    and FactionIncome >= 5000
    console_command add_money sicily, -2500
    end_monitor

    ; Yes, this script is designed for you to lose. Nothing about making the game harder, only to see you fail since the AI sucks just that much. Besides, I got this kick ass losing video for you. You should check it out.
    wait_monitors

    end_script

Posting Permissions

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