Page 7 of 9 FirstFirst 123456789 LastLast
Results 121 to 140 of 177

Thread: Lesson 1

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    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

    Worst script ever.

    so that's where all my money was going...


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

    Default Re: Lesson 1

    lulz...I told you...the mod is designed for you to lose...period.

  3. #3

    Default Re: Lesson 1

    Hehe , there's an error in it (well at least it looks so) There's 1 comment that's not behind a ";" .. Although this might change when you copy paste it in notepad

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

    Default Re: Lesson 1

    Which comment? They all look right to me. What's your screen size?

  5. #5

    Default Re: Lesson 1

    This one at the end :

    ; 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.
    But as i said , this may be resolved when you put it in notepad or something ..

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

    Default Re: Lesson 1

    You posted right behind me before I edited. It might be your screen's resolution. All that's on one line on my screen.

  7. #7

    Default Re: Lesson 1

    Ah , excuse me in that case

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

    Default Re: Lesson 1

    No issue. Thanks for that nonetheless.

  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

    You tease us with a video, then dont display it?? Epic fail...

  10. #10
    Benz282's Avatar Vicarius
    Join Date
    May 2008
    Location
    East Coast, US
    Posts
    2,955

    Default Re: Lesson 1

    Here's my first script. Are we supposed to test these when we are done? And if so, how are we to do so?

    Spoiler Alert, click show to read: 
    ;#########################################
    ;##_____________________________________##
    ;##_____________+-LESSON 1-+____________##
    ;##_____________________________________##
    ;#########################################

    ;
    ;Start Lesson 1
    ;
    ;Objective:
    ; - 4 Monitors for one faction
    ; - Add or subtract money based on situation
    ;

    script

    ;Let's start out with something simple
    monitor_event FactionTurnEnd FactionType england
    and not FactionIsLocal
    console_command add_money england, -10000
    end_monitor

    ;Now, to rectify the situation
    monitor_event FactionTurnEnd FactionType england
    and not FactionIsLocal
    and not Treasury > 0
    console_command add_money england, 15000
    end_monitor

    ;Let's go to war, shall we?
    monitor_event FactionTurnEnd FactionType england
    and not SupportCostsPercentage > 50.4
    and not OnAWarFooting
    and not I_FactionBesieging england
    console_command add_money england, 5000
    end_monitor

    ;Got a bit over your head there? Here's some help
    monitor_event FactionTurnEnd FactionType england
    and OnAWarFooting
    and not I_NumberOfSettlements england > 4
    and not Treasury > 7500
    and I_LosingMoney england
    console_command add_money england, 100000
    end_monitor

    wait_monitors

    end_script

    ;
    ;End Lesson 1
    ;
    Last edited by Benz282; June 29, 2009 at 01:38 AM.

  11. #11

    Default Re: Lesson 1

    In order to test your script, you need a working mod folder to begin with (see here). Then you have to put the script into (your mod's) data/world/maps/campaign/imperial_campaign/campaign_script. Afterwards, start your mod and test your script in-game. If your script increases England's treasury by 10,000 at the end of the turn for example, simply check whether this actually happens.
    Curious Curialist curing the Curia of all things Curial.

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

    Looks fine Benz. Like I suggested in another thread, you don't need to use "and not" with conditions that use logic tokens(<, <=, >, >=, ==). It makes more sense to people reading the script to use for instance:

    and Treasury <= 0

    As opposed to:

    and not Treasury > 0

    They mean the same thing.

  13. #13
    Subuatai de Bodemloze's Avatar No rest for the wicked
    Join Date
    Mar 2008
    Location
    50 degrees, 26.2 minutes North, 119 degrees, 12.4 minutes West
    Posts
    2,436

    Default Re: Lesson 1

    I just got kingdoms installed tonight, again.... will try and write the code up tomorrow at work and test it tomorrow night.

  14. #14
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,751
    Blog Entries
    3

    Default Re: Lesson 1

    Sorry for being late, but here's mine:

    Spoiler Alert, click show to read: 
    ;**********Scripting 101 Lesson 1 - Money Script**********
    ;|Author| Squid
    ;|Purpose| Add/Remove money to/from specific factions
    ;|Changelog|
    ; - Script Created 20/06/2009

    script

    monitor_event FactionTurnStart FactionType england
    and OnAWarFooting
    console_command add_money england, -1000
    end_monitor

    monitor_event FactionTurnStart FactionType england
    and LosingMoney
    and Treasury < 1000
    console_command add_money england, 5000
    end_monitor

    monitor_event FactionTurnStart FactionType england
    and Treasury >= 10000
    console_command add_money england, -1000
    end_monitor

    monitor_event SettlementTurnEnd FactionType england
    and BuildingQueueIdleDespiteCash
    console_command add_money england, 2000
    end_monitor

    wait_monitors

    end_script


    Just an interesting tidbit, since most mods keep all factions at war with the slave faction, the OnAWarFooting condition will always return true.
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

  15. #15
    Benz282's Avatar Vicarius
    Join Date
    May 2008
    Location
    East Coast, US
    Posts
    2,955

    Default Re: Lesson 1

    Quote Originally Posted by Sqυιd View Post
    Just an interesting tidbit, since most mods keep all factions at war with the slave faction, the OnAWarFooting condition will always return true.
    Hm...never thought of that

  16. #16
    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 Sqυιd View Post
    Sorry for being late, but here's mine:

    Spoiler Alert, click show to read: 
    ;**********Scripting 101 Lesson 1 - Money Script**********
    ;|Author| Squid
    ;|Purpose| Add/Remove money to/from specific factions
    ;|Changelog|
    ; - Script Created 20/06/2009

    script

    monitor_event FactionTurnStart FactionType england
    and OnAWarFooting
    console_command add_money england, -1000
    end_monitor

    monitor_event FactionTurnStart FactionType england
    and LosingMoney
    and Treasury < 1000
    console_command add_money england, 5000
    end_monitor

    monitor_event FactionTurnStart FactionType england
    and Treasury >= 10000
    console_command add_money england, -1000
    end_monitor

    monitor_event SettlementTurnEnd FactionType england
    and BuildingQueueIdleDespiteCash
    console_command add_money england, 2000
    end_monitor

    wait_monitors

    end_script


    Just an interesting tidbit, since most mods keep all factions at war with the slave faction, the OnAWarFooting condition will always return true.
    Looks fine. And yeah if it does that it's a pretty useless condition. It should be possible to replicate its purpose by checking diplomatic agreements/stances but I haven't really looked into it.

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

    Actually I did a tiny bit of testing with OnAWarFooting and I dont think it triggers that way but its been a long time and my memory might be a bit off on this.

    The AI decision tree has no real entries regarding slaves, either for attacking them or defending them. For purposes of the game the AI doesnt consider them a threat, so they default is "defend_minimal" and "invade_priority" = 0.

    I dont think OnAWarFooting triggers until a certain amount of points has built up regarding a certain faction. I did do some stuff with using a TargetFactionType condition with OnAWarFooting but cant remember how that turned out.

    It should be easy to test if it always fires true though:

    Code:
     monitor_event FactionTurnEnd FactionIsLocal
        and OnAWarFooting ; TrueCondition if needed, then test TargetFactionType
     
        historic_event test_event
    end_monitor

  18. #18
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,751
    Blog Entries
    3

    Default Re: Lesson 1

    I wouldn't assume it has anything to do with the AI decision tree but rather the diplomatic stances that are established for the various factions. Admittedly my sample is small, and based mostly on RTW, but OnAWarFooting seems to be true if you are at war with a faction, regardless of how much of a threat they are. Hence my comment about the slaves which every faction is usually, if not always at war with. Everyone always being at war with the slaves causes the condition to be true all the time.

    The main problem is the documentation on the condition is somewhat sparse and doesn't provide a lot of detail.
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

  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

    Quote Originally Posted by Sqυιd View Post
    I wouldn't assume it has anything to do with the AI decision tree but rather the diplomatic stances that are established for the various factions. Admittedly my sample is small, and based mostly on RTW, but OnAWarFooting seems to be true if you are at war with a faction, regardless of how much of a threat they are. Hence my comment about the slaves which every faction is usually, if not always at war with. Everyone always being at war with the slaves causes the condition to be true all the time.
    I will try and remember to check that later.

    The main problem is the documentation on the condition is somewhat sparse and doesn't provide a lot of detail.
    I say that with all the documentation.

  20. #20
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,751
    Blog Entries
    3

    Default Re: Lesson 1

    As a coder, don't I know it!! I've been, and I'm sure continue to be, guilty of it as well.
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

Posting Permissions

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