Page 2 of 5 FirstFirst 12345 LastLast
Results 21 to 40 of 92

Thread: Lesson 2

  1. #21
    ♔Jean-Luc Picard♔'s Avatar Domesticus
    Join Date
    Feb 2007
    Location
    North Carolina, USA
    Posts
    2,181

    Default Re: Lesson 2

    Will the unpacker work on Kingdoms, or will i have to unpack before I install and patch kingdoms? For some reason it is malfunctioning right now and not completely unpacking.

    It is my great honour to have my poem Farmer in the Scriptorium here.

  2. #22
    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 2

    Kingdoms has its own unpacker for each campaign, but you dont have to run it. If you get the main install unpacked you can install barebones and use that.

  3. #23

    Default Re: Lesson 2

    Quote Originally Posted by GrnEyedDvl View Post
    Thats not bad, but you can condense those monitors for each faction into a single monitor.

    monitor event
    if i settlement owner france
    set counter

    if i settlement owner england
    set counter

    etc.


    Since you are terminating the monitor after the army is created, the next time Jerusalem is taken by someone the units will not spawn. I want to make sure you know how to re enable the spawning of units.

    With your create_unit lines you are creating 80 units, and the max the city can hold is 20, and you have no location set for the spear militia units. If you check your log there is probably an error related to those.


    Skand and Hesus, are you using a vanilla file copied into your mod folder?
    Aha , that's usefull .. yes , I'm already thinking of a way to respawn the next time Jerusalem is captured by Christians (counters ftw ) Yes , i didn't know what the number '10' meant after the unit name .. but now i assume it'll spawn 10 units of 80 peasant archers for instance ..

    Neh , didn't gave me an error (well i didn't check the log )

    So about all the if_conditions in the monitor , is it like this :

    Spoiler Alert, click show to read: 
    Code:
    monitor_event 
      if I_SettlementOwner Jerusalem = england
    set_counter Jerusalem 1
    
      if I_SettlementOwnerJerusalem = france
    set_counter Jerusalem 1
    
    ; and go on ... ;
    
    end_if
    end_monitor


    heh , increased the script "a little"

    Spoiler Alert, click show to read: 
    Code:
    script
    
    declare_counter jerusalem
    declare_counter armye
    declare_counter armyt
    declare_counter armymo
    declare_counter timej
    declare_counter jihadf
    
    monitor_event FactionTurnStart FactionIsLocal
      and I_SettlementOwner Jerusalem = england
      and I_CompareCounter jihadf != 1
    
    set_counter jerusalem 1
    set_counter timej 1
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
      and I_SettlementOwner Jerusalem = hre
      and I_CompareCounter jihadf != 1
    
    set_counter jerusalem 1
    set_counter timej 1
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
      and I_SettlementOwner Jerusalem = france
      and I_CompareCounter jihadf != 1
    
    set_counter jerusalem 1
    set_counter timej 1
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
      and I_SettlementOwner Jerusalem = venice
      and I_CompareCounter jihadf != 1
    
    set_counter jerusalem 1
    set_counter timej 1
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
      and I_SettlementOwner Jerusalem = sicily
      and I_CompareCounter jihadf != 1
    
    set_counter jerusalem 1
    set_counter timej 1
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
      and I_SettlementOwner Jerusalem = scotland
      and I_CompareCounter jihadf != 1
    
    set_counter jerusalem 1
    set_counter timej 1
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
      and I_SettlementOwner Jerusalem = denmark
      and I_CompareCounter jihadf != 1
    
    set_counter jerusalem 1
    set_counter timej 1
    
    end_monitor
    ;;;;;;; Turn counting ;;;;;;;;
            ;; Egypt ;;
    
    
    ; turn 1
    monitor_event FactionTurnStart FactionType egypt
      and FactionIsLocal
      and I_SettlementOwner Jerusalem != egypt
      and I_SettlementOwner Jerusalem != moors
      and I_SettlementOwner Jerusalem != turks
      and I_CompareCounter timej = 1
    
    inc_counter timej 1
    
    end_monitor
    ; turn 2
    monitor_event FactionTurnStart FactionType egypt
      and FactionIsLocal
      and I_SettlementOwner Jerusalem != egypt
      and I_SettlementOwner Jerusalem != moors
      and I_SettlementOwner Jerusalem != turks
      and I_CompareCounter timej = 2
    
    inc_counter timej 1
    
    end_monitor
    ; turn 3
    monitor_event FactionTurnStart FactionType egypt
      and FactionIsLocal
      and I_SettlementOwner Jerusalem != egypt
      and I_SettlementOwner Jerusalem != moors
      and I_SettlementOwner Jerusalem != turks
      and I_CompareCounter timej = 3
    
    inc_counter timej 1
    
    end_monitor
    ; turn 4
    monitor_event FactionTurnStart FactionType egypt
      and FactionIsLocal
      and I_SettlementOwner Jerusalem != egypt
      and I_SettlementOwner Jerusalem != moors
      and I_SettlementOwner Jerusalem != turks
      and I_CompareCounter timej = 4
    
    inc_counter timej 1
    
    end_monitor
    ; turn 5
    monitor_event FactionTurnStart FactionType egypt
      and FactionIsLocal
      and I_SettlementOwner Jerusalem != egypt
      and I_SettlementOwner Jerusalem != moors
      and I_SettlementOwner Jerusalem != turks
      and I_CompareCounter timej = 5
    
    inc_counter timej 1
    
    end_monitor
    ; turn 6
    monitor_event FactionTurnStart FactionType egypt
      and FactionIsLocal
      and I_SettlementOwner Jerusalem != egypt
      and I_SettlementOwner Jerusalem != moors
      and I_SettlementOwner Jerusalem != turks
      and I_CompareCounter timej = 6
    
    inc_counter timej 1
    
    end_monitor
    ; turn 7
    monitor_event FactionTurnStart FactionType egypt
      and FactionIsLocal
      and I_SettlementOwner Jerusalem != egypt
      and I_SettlementOwner Jerusalem != moors
      and I_SettlementOwner Jerusalem != turks
      and I_CompareCounter timej = 7
    
    inc_counter timej 1
    
    end_monitor
    ; turn 8
    monitor_event FactionTurnStart FactionType egypt
      and FactionIsLocal
      and I_SettlementOwner Jerusalem != egypt
      and I_SettlementOwner Jerusalem != moors
      and I_SettlementOwner Jerusalem != turks
      and I_CompareCounter timej = 8
    
    inc_counter timej 1
    
    end_monitor
    ; turn 9
    monitor_event FactionTurnStart FactionType egypt
      and FactionIsLocal
      and I_SettlementOwner Jerusalem != egypt
      and I_SettlementOwner Jerusalem != moors
      and I_SettlementOwner Jerusalem != turks
      and I_CompareCounter timej = 9
    
    inc_counter timej 1
    
    end_monitor
    ; turn 10
    monitor_event FactionTurnStart FactionType egypt
      and FactionIsLocal
      and I_SettlementOwner Jerusalem != egypt
      and I_SettlementOwner Jerusalem != moors
      and I_SettlementOwner Jerusalem != turks
      and I_CompareCounter timej = 10
    
    inc_counter timej 1
    
    end_monitor
    
    
    ;; Turkey ;;
    
    ; turn 1
    monitor_event FactionTurnStart FactionType turks
      and FactionIsLocal
      and I_SettlementOwner Jerusalem != egypt
      and I_SettlementOwner Jerusalem != moors
      and I_SettlementOwner Jerusalem != turks
      and I_CompareCounter timej = 1
    
    inc_counter timej 1
    
    end_monitor
    ; turn 2
    monitor_event FactionTurnStart FactionType turks
      and FactionIsLocal
      and I_SettlementOwner Jerusalem != egypt
      and I_SettlementOwner Jerusalem != moors
      and I_SettlementOwner Jerusalem != turks
      and I_CompareCounter timej = 2
    
    inc_counter timej 1
    
    end_monitor
    ; turn 3
    monitor_event FactionTurnStart FactionType turks
      and FactionIsLocal
      and I_SettlementOwner Jerusalem != egypt
      and I_SettlementOwner Jerusalem != moors
      and I_SettlementOwner Jerusalem != turks
      and I_CompareCounter timej = 3
    
    inc_counter timej 1
    
    end_monitor
    ; turn 4
    monitor_event FactionTurnStart FactionType turks
      and FactionIsLocal
      and I_SettlementOwner Jerusalem != egypt
      and I_SettlementOwner Jerusalem != moors
      and I_SettlementOwner Jerusalem != turks
      and I_CompareCounter timej = 4
    
    inc_counter timej 1
    
    end_monitor
    ; turn 5
    monitor_event FactionTurnStart FactionType turks
      and FactionIsLocal
      and I_SettlementOwner Jerusalem != egypt
      and I_SettlementOwner Jerusalem != moors
      and I_SettlementOwner Jerusalem != turks
      and I_CompareCounter timej = 5
    
    inc_counter timej 1
    
    end_monitor
    ; turn 6
    monitor_event FactionTurnStart FactionType turks
      and FactionIsLocal
      and I_SettlementOwner Jerusalem != egypt
      and I_SettlementOwner Jerusalem != moors
      and I_SettlementOwner Jerusalem != turks
      and I_CompareCounter timej = 6
    
    inc_counter timej 1
    
    end_monitor
    ; turn 7
    monitor_event FactionTurnStart FactionType turks
      and FactionIsLocal
      and I_SettlementOwner Jerusalem != egypt
      and I_SettlementOwner Jerusalem != moors
      and I_SettlementOwner Jerusalem != turks
      and I_CompareCounter timej = 7
    
    inc_counter timej 1
    
    end_monitor
    ; turn 8
    monitor_event FactionTurnStart FactionType turks
      and FactionIsLocal
      and I_SettlementOwner Jerusalem != egypt
      and I_SettlementOwner Jerusalem != moors
      and I_SettlementOwner Jerusalem != turks
      and I_CompareCounter timej = 8
    
    inc_counter timej 1
    
    end_monitor
    ; turn 9
    monitor_event FactionTurnStart FactionType turks
      and FactionIsLocal
      and I_SettlementOwner Jerusalem != egypt
      and I_SettlementOwner Jerusalem != moors
      and I_SettlementOwner Jerusalem != turks
      and I_CompareCounter timej = 9
    
    inc_counter timej 1
    
    end_monitor
    ; turn 10
    monitor_event FactionTurnStart FactionType turks
      and FactionIsLocal
      and I_SettlementOwner Jerusalem != egypt
      and I_SettlementOwner Jerusalem != moors
      and I_SettlementOwner Jerusalem != turks
      and I_CompareCounter timej = 10
    
    inc_counter timej 1
    
    end_monitor
    
    ;; Moors ;;
    
    ; turn 1
    monitor_event FactionTurnStart FactionType moors
      and FactionIsLocal
      and I_SettlementOwner Jerusalem != egypt
      and I_SettlementOwner Jerusalem != moors
      and I_SettlementOwner Jerusalem != turks
      and I_CompareCounter timej = 1
    
    inc_counter timej 1
    
    end_monitor
    ; turn 2
    monitor_event FactionTurnStart FactionType moors
      and FactionIsLocal
      and I_SettlementOwner Jerusalem != egypt
      and I_SettlementOwner Jerusalem != moors
      and I_SettlementOwner Jerusalem != turks
      and I_CompareCounter timej = 2
    
    inc_counter timej 1
    
    end_monitor
    ; turn 3
    monitor_event FactionTurnStart FactionType moors
      and FactionIsLocal
      and I_SettlementOwner Jerusalem != egypt
      and I_SettlementOwner Jerusalem != moors
      and I_SettlementOwner Jerusalem != turks
      and I_CompareCounter timej = 3
    
    inc_counter timej 1
    
    end_monitor
    ; turn 4
    monitor_event FactionTurnStart FactionType moors
      and FactionIsLocal
      and I_SettlementOwner Jerusalem != egypt
      and I_SettlementOwner Jerusalem != moors
      and I_SettlementOwner Jerusalem != turks
      and I_CompareCounter timej = 4
    
    inc_counter timej 1
    
    end_monitor
    ; turn 5
    monitor_event FactionTurnStart FactionType moors
      and FactionIsLocal
      and I_SettlementOwner Jerusalem != egypt
      and I_SettlementOwner Jerusalem != moors
      and I_SettlementOwner Jerusalem != turks
      and I_CompareCounter timej = 5
    
    inc_counter timej 1
    
    end_monitor
    ; turn 6
    monitor_event FactionTurnStart FactionType moors
      and FactionIsLocal
      and I_SettlementOwner Jerusalem != egypt
      and I_SettlementOwner Jerusalem != moors
      and I_SettlementOwner Jerusalem != turks
      and I_CompareCounter timej = 6
    
    inc_counter timej 1
    
    end_monitor
    ; turn 7
    monitor_event FactionTurnStart FactionType moors
      and FactionIsLocal
      and I_SettlementOwner Jerusalem != egypt
      and I_SettlementOwner Jerusalem != moors
      and I_SettlementOwner Jerusalem != turks
      and I_CompareCounter timej = 7
    
    inc_counter timej 1
    
    end_monitor
    ; turn 8
    monitor_event FactionTurnStart FactionType moors
      and FactionIsLocal
      and I_SettlementOwner Jerusalem != egypt
      and I_SettlementOwner Jerusalem != moors
      and I_SettlementOwner Jerusalem != turks
      and I_CompareCounter timej = 8
    
    inc_counter timej 1
    
    end_monitor
    ; turn 9
    monitor_event FactionTurnStart FactionType moors
      and FactionIsLocal
      and I_SettlementOwner Jerusalem != egypt
      and I_SettlementOwner Jerusalem != moors
      and I_SettlementOwner Jerusalem != turks
      and I_CompareCounter timej = 9
    
    inc_counter timej 1
    
    end_monitor
    ; turn 10
    monitor_event FactionTurnStart FactionType moors
      and FactionIsLocal
      and I_SettlementOwner Jerusalem != egypt
      and I_SettlementOwner Jerusalem != moors
      and I_SettlementOwner Jerusalem != turks
      and I_CompareCounter timej = 10
    
    inc_counter timej 1
    
    end_monitor
    
    
    ;;;;;;; Money penalty ;;;;;;;;;;
    
    monitor_event FactionTurnStart FactionType moors
      and I_CompareCounter timej = 11
    
    console_command add_money moors, -3750
    historic_event jihad_failed
    set_counter timej 0
    set_counter jihadf 1
    
    end_monitor
    
    monitor_event FactionTurnStart FactionType turks
      and I_CompareCounter timej = 11
    
    console_command add_money turks, -7500
    historic_event jihad_failed
    set_counter timej 0
    set_counter jihadf 1
    
    end_monitor
    
    monitor_event FactionTurnStart FactionType egypt
      and I_CompareCounter timej = 11
    
    console_command add_money egypt, -7500
    historic_event jihad_failed
    set_counter timej 0
    set_counter jihadf 1
    
    end_monitor
    
    ;;;;; Army spawning ;;;;
    
    monitor_event FactionTurnStart FactionType egypt
      and FactionIsLocal
    
      and I_CompareCounter jerusalem = 1
    
    historic_event jerusalem_captured
    
    set_counter armye 1
    
    create_unit Cairo, Desert Archers, num 10, exp 1, arm 0, wep 0
    create_unit ME Spear Militia, Desert Archers, num 10, exp 1, arm 0, wep 0
    
    terminate_monitor
    end_monitor
    
    monitor_eventFactionTurnStart FactionType egypt
      and FactionIsLocal
      and I_CompareCounter armye = 1
      and I_CompareCounter jerusalem = 1
    
    historic_event jerusalem_captured
    
    create_unit Cairo, Desert Archers, num 10, exp 1, arm 0, wep 0
    create_unit ME Spear Militia, Desert Archers, num 10, exp 1, arm 0, wep 0
    
    terminate_monitor
    end_monitor
    
    
    wait_monitors
    end_script
    Last edited by Killerbee; June 28, 2009 at 04:13 AM.

  4. #24
    Hesus de bodemloze's Avatar The Gaul
    Civitate Patrician Content Emeritus

    Join Date
    Aug 2006
    Location
    Belgium
    Posts
    12,313

    Default Re: Lesson 2

    Skand and Hesus, are you using a vanilla file copied into your mod folder?
    Yes i copied the vanilla historic_events.text.strings file in to my mod folder. I am able to convert it and change the text file. But when i delete the file it does n' t generate a new one.
    Last edited by Hesus de bodemloze; June 28, 2009 at 05:40 AM.
    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

  5. #25
    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 2

    Hesus it sounds like your mod folder isnt even running then. What did you use for a mod folder?








    Quote Originally Posted by KingTheoden1 View Post
    Aha , that's usefull .. yes , I'm already thinking of a way to respawn the next time Jerusalem is captured by Christians (counters ftw ) Yes , i didn't know what the number '10' meant after the unit name .. but now i assume it'll spawn 10 units of 80 peasant archers for instance ..
    Always check the docudemons before you use a command, so you can see what the parameters are. You are correct, that 10 is the number of units that will spawn.



    So about all the if_conditions in the monitor , is it like this :

    Spoiler Alert, click show to read: 
    Code:
    monitor_event 
      if I_SettlementOwner Jerusalem = england
    set_counter Jerusalem 1
     
      if I_SettlementOwnerJerusalem = france
    set_counter Jerusalem 1
     
    ; and go on ... ;
     
    end_if
    end_monitor
    Correct, but remember you need an end_if for every if in your statement.



    A few things about your new version of the script. You have counters named:

    armye, armyj, jihadf, etc.

    It took me a few minutes to figure out that armye is for Egypt, jihadf is for France. These counter names will work, but will you remember what the intent was 6 months from now? There are no official Best Practices for M2 scripting, though I have considered getting together with a few other scripters and coming up with some design guidelines. What I always try to do is name counters so that it is easy to figure out what they mean, and then to include comment lines as well.

    army_egypt, army_france, etc

    Your counter names will work I am just trying to help you avoid headaches in the future.


    With these lines:
    and I_CompareCounter jihadf != 1

    I am not sure that != is a legit use for Not Equal to. I have honestly never tried it. The correct method is to use the keyword NOT in the statement.

    and not I_CompareCounter jihadf = 1



    You have several monitors, one for each faction, which is fine, but what is going to end up happening is that your counter will go up 1 for each faction each turn. If you fleshed this out for every faction, at the end of turn 1 your counter would be 30. This is why:

    Every time you click EndTurn, there is a FactionTurnEnd for every faction in the game. Each faction gets processed every turn, so lets say your game has France, Egypt, Sicily, and Venice in the game. A total of 4 factions. Without listing all the other events, they will all fire something like this.

    FactionTurnEnd for local faction
    FactionTurnEnd France
    FactionTurnEnd Egypt
    FactionTurnEnd Sicily
    FactionTurnEnd Venice

    Now your condition basically says that if France doesnt own Jerusalem, increase counter by 1. So counter goes from 1 to 2. The same for Egypt, so counter goes from 2 to 3. Same for Sicily so counter goes from 3 to 4. Same for Venice so counter goes from 4 to 5. By the time it gets around to the local player again, your counter is far higher than the cap of 10 you placed in your code.

    It looks like you are trying to count the number of turns Jersualem has not been owned by certain factions, and if it is 10 turns then enable an army to spawn. But you are not counting the number of turns, you are counting the number of factions. If you want to count the number of turns for a settlement, then use SettlementTurnEnd.

    Code:
    monitor_event SettlementTurnEnd SettlementName Jerusalem
         and not I_SettlementOwner Jersualem = France
         etc etc one line for each faction
     
         inc_counter 
    end_monitor
    This monitor will only fire once every time you click EndTurn, so your counter will only go up a maximum of 1 each turn.

    Also you still have terminate_monitor in your script. With that in there it doesnt matter what other conditions you set, it will only run a max of 1 time. I think you are getting the idea, just implementing some things wrong. Do as I suggested earlier and write down what you want to happen in normal English, then try to make your code match it.

  6. #26
    Hesus de bodemloze's Avatar The Gaul
    Civitate Patrician Content Emeritus

    Join Date
    Aug 2006
    Location
    Belgium
    Posts
    12,313

    Default Re: Lesson 2

    I made one but it seems like i mist a few steps. I will download the one you provided and try again.
    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

  7. #27

    Default Re: Lesson 2

    @ GED : I, once tried this in RTW : if not I_SettlementOwner Sparta = romans_julii .. But that didn't work , and HouseofHam told me i had to use if I_SettlementOwner Sparta != romans_julii ..

    Anyway , the jihadf stans for 'jihad failed' , it should be that when the jihad fails , the counter will stop running .. I'll try to solve the issues , thx for pointing them out

    let me explain a little : When a christian faction gets Jerusalem , and you're playing as egypt, , the moors , or the turks , you'll need to recapture it , within 10 tu!rns .. there'll spawn an army for all islams at the moment the christian faction captures the city .. If you don't have jerusalem in 10 turns , you'll get a penalty .. And if you do get it , you'll get a bonyus ..

    here you'll see what HouseofHam posted :

    http://www.twcenter.net/forums/showt...75#post5221975
    http://www.twcenter.net/forums/showt...28#post5223128

    Aargh , I'll jsut gonna start over with my script

    i styarted over , already made a base setup :

    Spoiler Alert, click show to read: 
    Code:
    script
    
    declare_counter jihad 
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;; Setup ;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = england
    
    set_counter jihad 1
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = france
    
    set_counter jihad 1
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = denmark
    
    set_counter jihad 1
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = hre
    
    set_counter jihad 1
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = venice
    
    set_counter jihad 1
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = sicily
    
    set_counter jihad 1
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = spain
    
    set_counter jihad 1
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = portugal
    
    set_counter jihad 1
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = scotland
    
    set_counter jihad 1
    
    end_monitor
    
    ;;;;;;;;;;;;;;;;;;;;;;; Mission Setup ;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    monitor_event 
      if I_LocalFaction egypt
      and I_CompareCounter jihad = 1
    
      historic_event to_arms
      create_unit Cairo, Desert Archers, num 4, exp 1, arm 0, wep 0
      create_unit Cairo, ME Spear Militia, num 6, exp 1, arm 0, wep 0
    
    end_if
      
      if I_LocalFaction turks
      and I_CompareCounter jihad = 1
    
      historic_event to_arms
      create_unit Yerevan, Turkish Archers, num 4, exp 1, arm 0, wep 0
      create_unit Yerevan, ME Spear Militia, num 6, exp 1, arm 0, wep 0
    
    end_if
     
      if I_Localfaction moors
      and I_CompareCounter jihad = 1
    
      historic_event to_arms
      create_unit Granada, Desert Archers, num 4, exp 1, arm 0, wep 0
      create_unit Granada, ME Spear Militia, num 6, exp 1, arm 0, wep 0
    
    end_if
    end_monitor
    
    wait_monitors
    end_script
    Last edited by Killerbee; June 28, 2009 at 11:38 AM.

  8. #28
    Hesus de bodemloze's Avatar The Gaul
    Civitate Patrician Content Emeritus

    Join Date
    Aug 2006
    Location
    Belgium
    Posts
    12,313

    Default Re: Lesson 2

    I am using barebones now but it seems like i can' t get it to work.
    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

  9. #29

    Default Re: Lesson 2

    Here we go! Thanks for the great lesson, GED. It took a while to figure it out but I think I did it now.

    First of all, here are the units which I spawned (I sent you the complete script via PM):

    Code:
    create_unit York, Peasant Archers, num 5, exp 4, arm 3, wep 0
    And here are the screenshots:

    York before the siege:
    Spoiler Alert, click show to read: 


    The reinforcements event:
    Spoiler Alert, click show to read: 


    The reinforced besieged army:
    Spoiler Alert, click show to read: 


    The reset event (and I also made sure that it runs only once. There appears to be a spelling error but that shouldn't be a huge problem I hope ):
    Spoiler Alert, click show to read: 
    Last edited by Astaroth; June 28, 2009 at 12:48 PM.
    Curious Curialist curing the Curia of all things Curial.

  10. #30

    Default Re: Lesson 2

    All right—I’ve gotten decently far along with this, but I’m having difficulties with the army script. I can get historic events working(although since the Barebones folder doesn’t have one, I had to import from another mod). I can count turn numbers. I can further randomize the event.
    However, the difficulties begin with army creation. I started out testing it with end turn, placing the code in as indicated.
    Code:
    create_unit York, Peasants, num 1, exp 1, arm 0, wep 0

    However, rather than creating one unit—it creates fifteen, giving York a full stack. But I knew I could create something, so I soldiered on with the rest, ending up with a completely non-working script. Here it is, after five hours—maybe it will be obvious to someone else. Note: I did not include the reset counter part of the script yet—I wanted to see if this would fire first.
    Code:
    ;
    ; Campaign script
    ;
    script
    declare_counter TurnNumber
    set_counter TurnNumber 1
    declare_counter york_army_spawned
    set_counter york_army_spawned 1
    monitor_event FactionTurnEnd FactionIsLocal
     inc_counter TurnNumber 1
    end_monitor
    monitor_event FactionTurnEnd FactionisLocal
     if I_SettlementUnderSiege
     and I_EventCounter york_army_spawned == 0
     create_unit York, Peasants, num 1, exp 1, arm 0, wep 0
     historic_event york_army_spawned
     set_event_counter york_army_spawned 1
    end_monitor
    Son of PW

  11. #31

    Default Re: Lesson 2

    As far as I can see, you forgot to put an "end_if" for the "if" in your monitor. Furthermore, you need to put the city's name after "I_SettlementUnderSiege" - in this case you should write "I_SettlementUnderSiege York".
    Last edited by Astaroth; June 28, 2009 at 03:12 PM.
    Curious Curialist curing the Curia of all things Curial.

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

    Quote Originally Posted by Hesus de bodemloze View Post
    I am using barebones now but it seems like i can' t get it to work.
    Did you go through the read me and set up the cfg files properly? There is a batch file included that will copy parts of your cfg file and create a new one for the barebones folder, then you launch the game from barebones.bat. I know it works as I am using a freshly installed M2 and I just downloaded and installed barebones.



    Quote Originally Posted by KingTheoden1 View Post
    @ GED : I, once tried this in RTW : if not I_SettlementOwner Sparta = romans_julii .. But that didn't work , and HouseofHam told me i had to use if I_SettlementOwner Sparta != romans_julii ..
    Thats a new one on me but I never scripted RTW. The two engines are very close but there are some differences.



    i styarted over , already made a base setup :

    Spoiler Alert, click show to read: 
    Code:
    script
     
    declare_counter jihad 
     
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;; Setup ;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = england
     
    set_counter jihad 1
     
    end_monitor
     
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = france
     
    set_counter jihad 1
     
    end_monitor
     
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = denmark
     
    set_counter jihad 1
     
    end_monitor
     
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = hre
     
    set_counter jihad 1
     
    end_monitor
     
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = venice
     
    set_counter jihad 1
     
    end_monitor
     
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = sicily
     
    set_counter jihad 1
     
    end_monitor
     
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = spain
     
    set_counter jihad 1
     
    end_monitor
     
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = portugal
     
    set_counter jihad 1
     
    end_monitor
     
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = scotland
     
    set_counter jihad 1
     
    end_monitor
     
    ;;;;;;;;;;;;;;;;;;;;;;; Mission Setup ;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     
    monitor_event 
      if I_LocalFaction egypt
      and I_CompareCounter jihad = 1
     
      historic_event to_arms
      create_unit Cairo, Desert Archers, num 4, exp 1, arm 0, wep 0
      create_unit Cairo, ME Spear Militia, num 6, exp 1, arm 0, wep 0
     
    end_if
     
      if I_LocalFaction turks
      and I_CompareCounter jihad = 1
     
      historic_event to_arms
      create_unit Yerevan, Turkish Archers, num 4, exp 1, arm 0, wep 0
      create_unit Yerevan, ME Spear Militia, num 6, exp 1, arm 0, wep 0
     
    end_if
     
      if I_Localfaction moors
      and I_CompareCounter jihad = 1
     
      historic_event to_arms
      create_unit Granada, Desert Archers, num 4, exp 1, arm 0, wep 0
      create_unit Granada, ME Spear Militia, num 6, exp 1, arm 0, wep 0
     
    end_if
    end_monitor
     
    wait_monitors
    end_script
    That looks a lot better, but notice there is nothing after your monitor_event in the Mission Setup section. I have seen that done before using TrueCondition but the script will always run.





    Quote Originally Posted by Theodotos I View Post
    All right—I’ve gotten decently far along with this, but I’m having difficulties with the army script. I can get historic events working(although since the Barebones folder doesn’t have one, I had to import from another mod). I can count turn numbers. I can further randomize the event.
    However, the difficulties begin with army creation. I started out testing it with end turn, placing the code in as indicated.
    Code:
    create_unit York, Peasants, num 1, exp 1, arm 0, wep 0

    However, rather than creating one unit—it creates fifteen, giving York a full stack. But I knew I could create something, so I soldiered on with the rest, ending up with a completely non-working script. Here it is, after five hours—maybe it will be obvious to someone else. Note: I did not include the reset counter part of the script yet—I wanted to see if this would fire first.
    Code:
    ;
    ; Campaign script
    ;
    script
    declare_counter TurnNumber
    set_counter TurnNumber 1
    declare_counter york_army_spawned
    set_counter york_army_spawned 1
    monitor_event FactionTurnEnd FactionIsLocal
     inc_counter TurnNumber 1
    end_monitor
    monitor_event FactionTurnEnd FactionisLocal
     if I_SettlementUnderSiege
     and I_EventCounter york_army_spawned == 0
     create_unit York, Peasants, num 1, exp 1, arm 0, wep 0
     historic_event york_army_spawned
     set_event_counter york_army_spawned 1
    end_monitor
    Astaroth is correct, you are missing end_if and a settlement name for the I_SettlementUnderSiege condition. I suspect that its not actually creating 15 units, it just runs in an endless loop until the settlement is full. If there were already 10 units there then you would think it was creating 10 units.

    Check the two parts I highlighted in red. These are NOT the same object, one is a counter, one is an event_counter. You can remove the declare_counter and set_counter for york_army_spawned.

  13. #33
    ♔Jean-Luc Picard♔'s Avatar Domesticus
    Join Date
    Feb 2007
    Location
    North Carolina, USA
    Posts
    2,181

    Default Re: Lesson 2

    For some reason it won't unpack all the files right now, so i'll try it on a fresh copy. I should have the script tomorrow afternoon.

    It is my great honour to have my poem Farmer in the Scriptorium here.

  14. #34

    Default Re: Lesson 2

    Oof , i hope it's better this time GED

    Spoiler Alert, click show to read: 
    Code:
    script
    
    declare_counter jihad 
    declare_counter reset
    declare_counter already
    
    ;; Setup ;;
    
    monitor_event FactionTurnStart FactionIsLocal
      and I_TurnNumber = 0
    
    set_counter already 1
    create_unit Jerusalem, Peasants, num 15, exp 1, arm 0, wep 0
    
    end_monitor
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;; Setup ;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = england
       and I_CompareCounter already == 1
    
    set_counter jihad 1
    set_counter reset 1
    set_counter already 1
    historic_event jerusalemc
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = france
       and I_CompareCounter already == 1
    
    set_counter jihad 1
    set_counter reset 1
    historic_event jerusalemc
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = denmark
       and I_CompareCounter already == 1
    
    set_counter jihad 1
    set_counter reset 1
    historic_event jerusalemc
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = hre
       and I_CompareCounter already == 1
    
    set_counter jihad 1
    set_counter reset 1
    historic_event jerusalemc
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = venice
       and I_CompareCounter already == 1
    
    set_counter jihad 1
    set_counter reset 1
    historic_event jerusalemc
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = sicily
       and I_CompareCounter already == 1
    
    set_counter jihad 1
    set_counter reset 1
    historic_event jerusalemc
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = spain
       and I_CompareCounter already == 1
    
    set_counter jihad 1
    set_counter reset 1
    historic_event jerusalemc
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = portugal
       and I_CompareCounter already == 1
    
    set_counter jihad 1
    set_counter reset 1
    historic_event jerusalemc
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = scotland
       and I_CompareCounter already == 1
    
    set_counter jihad 1
    set_counter reset 1
    historic_event jerusalemc
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = milan
       and I_CompareCounter already == 1
    
    set_counter jihad 1
    set_counter reset 1
    historic_event jerusalemc
    
    end_monitor
    
    ;;;;;;;;;;;;;;;;;;;;;;; Mission Setup ;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    monitor_event 
    if I_LocalFaction egypt
      and I_CompareCounter jihad = 1
      and I_CompareCounter already == 1
    
      historic_event to_arms
      create_unit Cairo, Desert Archers, num 4, exp 1, arm 0, wep 0
      create_unit Cairo, ME Spear Militia, num 6, exp 1, arm 0, wep 0
      inc_counter already 1
    
    end_if
      
    if I_LocalFaction turks
      and I_CompareCounter jihad = 1
      and I_CompareCounter already == 1
    
      historic_event to_arms
      create_unit Yerevan, Turkish Archers, num 4, exp 1, arm 0, wep 0
      create_unit Yerevan, ME Spear Militia, num 6, exp 1, arm 0, wep 0
      inc_counter already 1
    
    end_if
     
    if I_LocalFaction moors
      and I_CompareCounter jihad = 1
      and I_CompareCounter already == 1
    
      historic_event to_arms
      create_unit Granada, Desert Archers, num 4, exp 1, arm 0, wep 0
      create_unit Granada, ME Spear Militia, num 6, exp 1, arm 0, wep 0
      inc_counter already 1
    
    end_if
    end_monitor
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;; Turn counting and resetting ;;;;;;;;;;
    
    ;;;;;;;;;;;; Egypt ;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction egypt
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 1
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction egypt
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 2
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction egypt
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 3
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction egypt
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 4
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction egypt
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 5
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction egypt
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 6
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction egypt
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 7
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction egypt
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 8
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction egypt
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 9
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction egypt
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 10
    
    inc_counter reset 1
    
    end_monitor
    
    ;;;;;;;;;;;; Turks ;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction turks
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 1
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction turks
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 2
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction turks
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 3
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction turks
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 4
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction turks
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 5
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction turks
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 6
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction turks
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 7
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction turks
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 8
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction turks
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 9
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction turks
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 10
    
    inc_counter reset 1
    
    end_monitor
    
    
    ;;;;;;;;;;;; Moors ;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction moors
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 1
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction moors
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 2
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction moors
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 3
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction moors
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 4
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction moors
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 5
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction moors
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 6
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction moors
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 7
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction moors
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 8
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction moors
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 9
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction moors
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 10
    
    inc_counter reset 1
    
    end_monitor
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    ;;;;;; Reward ;;;;;;;;;;;
    ;;; Egypt ;;
    
    monitor_event
    if I_LocalFaction egypt
       and I_CompareCounter reset <= 11
       and I_SettlementOwner Jerusalem = egypt
    
    console_command add_money egypt, 5000
    historic_event jihads
    
    end_if
    
    if I_LocalFaction egypt
       and I_CompareCounter reset = 11
       and I_SettlementOwner Jerusalem = egypt
    
    console_command add_money egypt, 5000
    historic_event jihads
    
    end_if
    
    ;;;;;;;;;;;; Turks ;;;;;;;;;;;;;;;;;;;
    
    if I_LocalFaction turks
       and I_CompareCounter reset <= 11
       and I_SettlementOwner Jerusalem = turks
    
    console_command add_money turks, 5000
    historic_event jihads
    
    end_if
    
    if I_LocalFaction turks
       and I_CompareCounter reset = 11
       and I_SettlementOwner Jerusalem = turks
    
    console_command add_money turks, 5000
    historic_event jihads
    
    end_if
    
    ;;;;;;;;;;;; Moors ;;;;;;;;;;;;;;;;;
    
    if I_LocalFaction moors
       and I_CompareCounter reset <= 11
       and I_SettlementOwner Jerusalem = moors
    
    console_command add_money moors, 8000
    historic_event jihads
    
    end_if
    
    if I_LocalFaction moors
       and I_CompareCounter reset = 11
       and I_SettlementOwner Jerusalem = moors
    
    console_command add_money moors, 8000
    historic_event jihads
    
    end_if
    end_monitor
    
    ;;;;;; Punishment ;;;;;;;
    
    monitor_event 
    if I_LocalFaction egypt
      and I_CompareCounter reset = 11
      and not I_SettlementOwner Jerusalem = egypt
      and not I_SettlementOwner Jerusalem = turks
      and not I_SettlementOwner Jerusalem = moors
    
    
    console_command add_money egypt, -15000
    
    end_if
    
    if I_LocalFaction turks
      and I_CompareCounter reset = 11
      and not I_SettlementOwner Jerusalem = egypt
      and not I_SettlementOwner Jerusalem = moors
      and not I_SettlementOwner Jerusalem = turks
    
    console_command add_money turks, -15000
    
    end_if
    
    if I_LocalFaction moors
      and I_CompareCounter reset = 11
      and not I_SettlementOwner Jerusalem = egypt
      and not I_SettlementOwner Jerusalem = moors
      and not I_SettlementOwner Jerusalem = turks
    
    console_command add_money moors, -8000
    
    end_if
    end_monitor
    
    ;;;;;; Resetting ;;;;;;;
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction egypt
       and not I_SettlementOwner Jerusalem = egypt
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 11
    
    historic_event jihadf
    set_counter jihad 0
    set_counter reset 0
    set_counter already 0
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction turks
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 11
    
    historic_event jihadf
    set_counter jihad 0
    set_counter reset 0
    set_counter already 0
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction moors
       and not I_SettlementOwner Jerusalem = moors
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 11
    
    historic_event jihadf
    set_counter jihad 0
    set_counter reset 0
    set_counter already 1
    
    end_monitor
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; end of script ;;
    
    wait_monitors
    end_script


    Only need to do some testing

    there's something weird .. I get no erro in system.log , but my script doesn't work .. Well , not my whole script , it's enough to compare these 3 bits :

    Spoiler Alert, click show to read: 
    Code:
    monitor_event FactionTurnStart FactionIsLocal
      and I_TurnNumber = 0
    
    set_counter already 1
    create_unit Jerusalem, Peasants, num 15, exp 1, arm 0, wep 0
    
    end_monitor
    The counter 'already' will be set to 1 , wich is needed for the next bit .

    Code:
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = england
       and I_CompareCounter already == 1
    
    set_counter jihad 1
    set_counter reset 1
    set_counter already 1 ; this is needed for the next bit i assume ?
    historic_event jerusalemc
    
    end_monitor
    Above , you can see that the script checks the counter , sees it's good , and fires the event . However , the following bit doesn't work . I get no army , no event is fired , and the counter stays 1 , cause the previous event keeps firing every turn ..

    Code:
    if I_LocalFaction egypt
      and I_CompareCounter jihad = 1
      and I_CompareCounter already == 1
    
      historic_event to_arms
      create_unit Cairo, Desert Archers, num 4, exp 1, arm 0, wep 0
      create_unit Cairo, ME Spear Militia, num 6, exp 1, arm 0, wep 0
      inc_counter already 1 ; so , the coutner will become 2 , making the previous bit invalid
    
    end_if
    Last edited by Killerbee; June 29, 2009 at 10:55 AM.

  15. #35

    Default Re: Lesson 2

    Quote Originally Posted by GrnEyedDvl View Post

    Astaroth is correct, you are missing end_if and a settlement name for the I_SettlementUnderSiege condition. I suspect that its not actually creating 15 units, it just runs in an endless loop until the settlement is full. If there were already 10 units there then you would think it was creating 10 units.

    Check the two parts I highlighted in red. These are NOT the same object, one is a counter, one is an event_counter. You can remove the declare_counter and set_counter for york_army_spawned.
    Thanks for the help, I'll try this. As for the initial unit creation, I'm not seeing things. York starts out with five units. After the first create_unit on monitor_event FactionEndTurn, they have a full stack.
    Son of PW

  16. #36
    ♔Jean-Luc Picard♔'s Avatar Domesticus
    Join Date
    Feb 2007
    Location
    North Carolina, USA
    Posts
    2,181

    Default Re: Lesson 2

    Huzzah! I re-installed and got everything to unpack. My script and events will be done by tonight at the latest.

    It is my great honour to have my poem Farmer in the Scriptorium here.

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

    Quote Originally Posted by Theodotos I View Post
    Thanks for the help, I'll try this. As for the initial unit creation, I'm not seeing things. York starts out with five units. After the first create_unit on monitor_event FactionEndTurn, they have a full stack.
    Thats because the event never ends, it sounds like it just keeps creating until it runs out of room in the settlement.


    Quote Originally Posted by Skandranon Rakshae View Post
    Huzzah! I re-installed and got everything to unpack. My script and events will be done by tonight at the latest.
    Cool.


    Theoden you are sooo close. I assume you are playing as Egypt? If not then I will have to look for something else that would cause a problem.

  18. #38

    Default Re: Lesson 2

    Quote Originally Posted by GrnEyedDvl View Post
    Thats because the event never ends, it sounds like it just keeps creating until it runs out of room in the settlement.
    And that is now my only problem. It stopped with the appropriate amount of units once--now it creates fifteen, on one endturn with no other changes to the script. How do I fix this?
    Son of PW

  19. #39
    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 2

    PM me the entire script and I will try to sort this out for you. Anything I change will be well documented.

  20. #40

    Default Re: Lesson 2

    Quote Originally Posted by GrnEyedDvl View Post
    Theoden you are sooo close. I assume you are playing as Egypt? If not then I will have to look for something else that would cause a problem.
    Yep , i am playing as egypt .. Maybe it's because of the fact that most of the time the rebels take over Jerusalem at around turn 2 ?

    Alright , got the jihad script working !! Yay !! Here it is :

    Spoiler Alert, click show to read: 
    Code:
    script
    
    declare_counter jihad 
    declare_counter reset
    declare_counter already
    
    ;; Setup ;;
    
    monitor_event FactionTurnStart FactionIsLocal
      and I_TurnNumber = 0
    
    set_counter already 1
    create_unit Jerusalem, Peasants, num 15, exp 1, arm 0, wep 0
    
    end_monitor
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;; Setup ;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = england
       and I_CompareCounter already == 1
    
    set_counter jihad 1
    set_counter reset 1
    set_counter already 1
    historic_event jerusalemc
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = france
       and I_CompareCounter already == 1
    
    set_counter jihad 1
    set_counter reset 1
    historic_event jerusalemc
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = denmark
       and I_CompareCounter already == 1
    
    set_counter jihad 1
    set_counter reset 1
    historic_event jerusalemc
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = hre
       and I_CompareCounter already == 1
    
    set_counter jihad 1
    set_counter reset 1
    historic_event jerusalemc
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = venice
       and I_CompareCounter already == 1
    
    set_counter jihad 1
    set_counter reset 1
    historic_event jerusalemc
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = sicily
       and I_CompareCounter already == 1
    
    set_counter jihad 1
    set_counter reset 1
    historic_event jerusalemc
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = spain
       and I_CompareCounter already == 1
    
    set_counter jihad 1
    set_counter reset 1
    historic_event jerusalemc
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = portugal
       and I_CompareCounter already == 1
    
    set_counter jihad 1
    set_counter reset 1
    historic_event jerusalemc
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = scotland
       and I_CompareCounter already == 1
    
    set_counter jihad 1
    set_counter reset 1
    historic_event jerusalemc
    
    end_monitor
    
    monitor_event FactionTurnStart FactionIsLocal
       and I_SettlementOwner Jerusalem = milan
       and I_CompareCounter already == 1
    
    set_counter jihad 1
    set_counter reset 1
    historic_event jerusalemc
    
    end_monitor
    
    ;;;;;;;;;;;;;;;;;;;;;;; Mission Setup ;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    monitor_event FactionTurnEnd FactionIsLocal
      and I_LocalFaction egypt
      and I_CompareCounter jihad = 1
      and I_CompareCounter already == 1
    
      historic_event to_arms
      create_unit Cairo, Desert Archers, num 4, exp 1, arm 0, wep 0
      create_unit Cairo, ME Spear Militia, num 6, exp 1, arm 0, wep 0
      inc_counter already 1
    
    end_monitor
    
    monitor_event FactionTurnEnd FactionIsLocal  
      and I_LocalFaction turks
      and I_CompareCounter jihad = 1
      and I_CompareCounter already == 1
    
      historic_event to_arms
      create_unit Yerevan, Turkish Archers, num 4, exp 1, arm 0, wep 0
      create_unit Yerevan, ME Spear Militia, num 6, exp 1, arm 0, wep 0
      inc_counter already 1
    
    end_monitor
    
    monitor_event FactionTurnEnd FactionIsLocal 
      and I_LocalFaction moors
      and I_CompareCounter jihad = 1
      and I_CompareCounter already == 1
    
      historic_event to_arms
      create_unit Granada, Desert Archers, num 4, exp 1, arm 0, wep 0
      create_unit Granada, ME Spear Militia, num 6, exp 1, arm 0, wep 0
      inc_counter already 1
    
    end_monitor
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;; Turn counting and resetting ;;;;;;;;;;
    
    ;;;;;;;;;;;; Egypt ;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction egypt
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 1
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction egypt
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 2
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction egypt
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 3
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction egypt
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 4
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction egypt
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 5
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction egypt
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 6
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction egypt
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 7
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction egypt
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 8
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction egypt
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 9
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction egypt
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 10
    
    inc_counter reset 1
    
    end_monitor
    
    ;;;;;;;;;;;; Turks ;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction turks
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 1
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction turks
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 2
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction turks
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 3
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction turks
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 4
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction turks
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 5
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction turks
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 6
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction turks
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 7
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction turks
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 8
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction turks
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 9
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction turks
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 10
    
    inc_counter reset 1
    
    end_monitor
    
    
    ;;;;;;;;;;;; Moors ;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction moors
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 1
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction moors
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 2
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction moors
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 3
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction moors
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 4
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction moors
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 5
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction moors
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 6
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction moors
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 7
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction moors
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 8
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction moors
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 9
    
    inc_counter reset 1
    
    end_monitor
    
    monitor_event SettlementTurnEnd SettlementName Jerusalem
       and I_LocalFaction moors
       and not I_SettlementOwner Jerusalem = egypt
       and not I_SettlementOwner Jerusalem = moors
       and not I_SettlementOwner Jerusalem = turks
       and I_CompareCounter already = 2
       and I_CompareCounter reset = 10
    
    inc_counter reset 1
    
    end_monitor
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    
    ;;;;;; Reward ;;;;;;;;;;;
    ;;; Egypt ;;
    
    monitor_event
    if I_LocalFaction egypt
       and I_CompareCounter reset <= 11
       and I_SettlementOwner Jerusalem = egypt
    
    console_command add_money egypt, 5000
    historic_event jihads
    
    end_if
    
    if I_LocalFaction egypt
       and I_CompareCounter reset = 11
       and I_SettlementOwner Jerusalem = egypt
    
    console_command add_money egypt, 5000
    historic_event jihads
    
    end_if
    
    ;;;;;;;;;;;; Turks ;;;;;;;;;;;;;;;;;;;
    
    if I_LocalFaction turks
       and I_CompareCounter reset <= 11
       and I_SettlementOwner Jerusalem = turks
    
    console_command add_money turks, 5000
    historic_event jihads
    
    end_if
    
    if I_LocalFaction turks
       and I_CompareCounter reset = 11
       and I_SettlementOwner Jerusalem = turks
    
    console_command add_money turks, 5000
    historic_event jihads
    
    end_if
    
    ;;;;;;;;;;;; Moors ;;;;;;;;;;;;;;;;;
    
    if I_LocalFaction moors
       and I_CompareCounter reset <= 11
       and I_SettlementOwner Jerusalem = moors
    
    console_command add_money moors, 8000
    historic_event jihads
    
    end_if
    
    if I_LocalFaction moors
       and I_CompareCounter reset = 11
       and I_SettlementOwner Jerusalem = moors
    
    console_command add_money moors, 8000
    historic_event jihads
    
    end_if
    end_monitor
    
    ;;;;;; Punishment ;;;;;;;
    
    monitor_event 
    
    if I_LocalFaction egypt
      and I_CompareCounter already = 2
      and I_CompareCounter reset = 11
      and not I_SettlementOwner Jerusalem = egypt
      and not I_SettlementOwner Jerusalem = turks
      and not I_SettlementOwner Jerusalem = moors
    
    historic_event jihadf
    set_counter jihad 0
    set_counter reset 0
    set_counter already 1
    console_command add_money egypt, -15000
    
    end_if
    
    if I_LocalFaction turks
      and I_CompareCounter reset = 11
      and not I_SettlementOwner Jerusalem = egypt
      and not I_SettlementOwner Jerusalem = moors
      and not I_SettlementOwner Jerusalem = turks
    
    historic_event jihadf
    set_counter jihad 0
    set_counter reset 0
    set_counter already 1
    console_command add_money turks, -15000
    
    end_if
    
    if I_LocalFaction moors
      and I_CompareCounter reset = 11
      and not I_SettlementOwner Jerusalem = egypt
      and not I_SettlementOwner Jerusalem = moors
      and not I_SettlementOwner Jerusalem = turks
    
    historic_event jihadf
    set_counter jihad 0
    set_counter reset 0
    set_counter already 1
    console_command add_money moors, -8000
    
    end_if
    end_monitor
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; end of script ;;
    
    wait_monitors
    end_script
    There were some issues , for instance : in the prvious script , i had 2 seperate bits , with the exact same conditions , but other commands .. They gave a sort of error , but after i merged them , it worked .. Than the second issue :
    Instead of this :
    Spoiler Alert, click show to read: 

    Code:
    if I_LocalFaction egypt
      and I_CompareCounter jihad = 1
      and I_CompareCounter already == 1
    
      historic_event to_arms
      create_unit Cairo, Desert Archers, num 4, exp 1, arm 0, wep 0
      create_unit Cairo, ME Spear Militia, num 6, exp 1, arm 0, wep 0
      inc_counter already 1 ; so , the coutner will become 2 , making the previous bit invalid
    
    end_if
    I changed it to

    Code:
    monitor_event FactionTurnEnd FactionIsLocal
      and I_LocalFaction egypt
      and I_CompareCounter jihad = 1
      and I_CompareCounter already == 1
    
      historic_event to_arms
      create_unit Cairo, Desert Archers, num 4, exp 1, arm 0, wep 0
      create_unit Cairo, ME Spear Militia, num 6, exp 1, arm 0, wep 0
      inc_counter already 1
    
    end_monitor
    Why ? well , it's hard to explain , but i was guessing that this bit :

    Code:
    monitor_event FactionTurnStart FactionIsLocal
    
       and I_SettlementOwner Jerusalem = england
    
       and I_CompareCounter already == 1
    
    
    
    set_counter jihad 1
    
    set_counter reset 1
    
    set_counter already 1
    
    historic_event jerusalemc
    
    
    
    end_monitor
    loaded at the same time as the first bit i posted here (the one i changed) , and constantly set the counter 'already' to 1 , even after he was put to 2 by the other bit , thus making the other bit invalid each turn .. that's also the reason i used 'FationturnEnd , so the first bit would load before this bit .
    Last edited by Killerbee; June 30, 2009 at 05:14 PM.

Page 2 of 5 FirstFirst 12345 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
  •