Results 1 to 7 of 7

Thread: Maritime Raids

  1. #1

    Icon3 Maritime Raids

    This tutorial will teach you how to set up Maritime Raids for the player and the AI.

    What does this do? Well, everytime that you or the AI blockades a port, you loose some income from the trade but that's it, there's nothing more to gain from that which makes blockades not very interesting, especially when there are scripts that prevent the AI from going bankrupt.
    Thanks to this script, you can now get money from blockading the AI ports and loose more money if the AI blockades your ports.

    Example 1: Simple maritime raid script just for one faction

    Spoiler Alert, click show to read: 
    Code:
    	monitor_event Transgression TargetFactionType f_carthage
            and TransgressionName TC_BLOCKADE
            and not FactionType slave
            generate_random_counter sea_raid 1 9            ; generating a number between 1 and 9
                if I_EventCounter sea_raid > 7                    ;22% chance of occurring every turn 
                    play_sound_event Searaid_14				
                    historic_event HE_MARITIME_RAID factions { f_carthage, } ; A raid happens
                    add_money f_carthage -1000
                end_if
                if I_EventCounter sea_raid = 5                    ; 11% chance of occurring at every blockade 
                    play_sound_event Searaid_14				
                    historic_event HE_LARGE_MARITIME_RAID factions { f_carthage, } ;
                    add_money f_carthage -2000
                end_if
        end_monitor
    	
    	monitor_event Transgression FactionType f_carthage
            and TransgressionName TC_BLOCKADE
            and not TargetFactionType slave
            generate_random_counter ai_raid 1 11             ; generating a number between 1 and 11
                if I_EventCounter ai_raid > 9                    ;18% chance of occurring every time 
                    play_sound_event Searaid_15
                    historic_event HE_PLAYER_RAID factions { f_carthage, } ; A raid happens
                    add_money f_carthage 1000
                end_if
    			if I_EventCounter ai_raid = 2                    ;9% chance of occurring every time 
                    play_sound_event Searaid_15
                    historic_event HE_LARGE_PLAYER_RAID factions { f_carthage, } ; A raid happens
                    add_money f_carthage 2000
                end_if
        end_monitor


    With this script, Carthage in EBII, has some chances of either getting 1000 or 2000 everytime they blockade an enemy port which is not a rebel one (If you want to allow this script to also work with the rebels, you need to remove the line that says and not TargetFactionType slave). Beware that the player can abuse this system by continually blockading the enemy ports, therefore the chances for the player should be kept low while the chances for the AI should be higher.

    Example 2: Maritime script for all factions (currently used in EBII)

    Spoiler Alert, click show to read: 
    Code:
        ; Blockade levy
    
    
        monitor_event Transgression TransgressionName TC_BLOCKADE
            and TargetFactionIsLocal
            generate_random_counter commerce_raiding_penalty 1 10
    
    
            if I_EventCounter commerce_raiding_penalty < 3 ; 20% chance
                if I_EventCounter CamDiff < 4
                    historic_event HE_RAIDING_LOSS
                    if I_EventCounter ecRomeIsPlayer > 0
                        add_money f_rome -1000
                    end_if
                    if I_EventCounter ecCarthageIsPlayer > 0
                        add_money f_carthage -1000
                    end_if
                    if I_EventCounter ecMakedoniaIsPlayer > 0
                        add_money f_makedonia -1000
                    end_if
                    if I_EventCounter ecEpeirosIsPlayer > 0
                        add_money f_epeiros -1000
                    end_if
                    if I_EventCounter ecKHIsPlayer > 0
                        add_money f_kh -1000
                    end_if
                    if I_EventCounter ecSeleukidIsPlayer > 0
                        add_money f_seleukid -1000
                    end_if
                    if I_EventCounter ecPtolemaioiIsPlayer > 0
                        add_money f_ptolemaioi -1000
                    end_if
                    if I_EventCounter ecBaktriaIsPlayer > 0
                        add_money f_baktria -1000
                    end_if
                    if I_EventCounter ecHayastanIsPlayer > 0
                        add_money f_hayasdan -1000
                    end_if
                    if I_EventCounter ecPontosIsPlayer > 0
                        add_money f_pontos -1000
                    end_if
                    if I_EventCounter ecParthiaIsPlayer > 0
                        add_money f_parthia -1000
                    end_if
                    if I_EventCounter ecAeduiIsPlayer > 0
                        add_money f_aedui -1000
                    end_if
                    if I_EventCounter ecArverniIsPlayer > 0
                        add_money f_arverni -1000
                    end_if
                    if I_EventCounter ecCasseIsPlayer > 0
                        add_money f_casse -1000
                    end_if
                    if I_EventCounter ecLusotannanIsPlayer > 0
                        add_money f_lusotannan -1000
                    end_if
                    if I_EventCounter ecSwebozIsPlayer > 0
                        add_money f_sweboz -1000
                    end_if
                    if I_EventCounter ecGetaiIsPlayer > 0
                        add_money f_getai -1000
                    end_if
                    if I_EventCounter ecSabaIsPlayer > 0
                        add_money f_saba -1000
                    end_if
                    if I_EventCounter ecSakaIsPlayer > 0
                        add_money f_saka -1000
                    end_if
                    if I_EventCounter ecSauromataeIsPlayer > 0
                        add_money f_sauromatae -1000
                    end_if
                    if I_EventCounter ecNumidiaIsPlayer > 0
                        add_money f_numidia -1000
                    end_if
                    if I_EventCounter ecPergamonIsPlayer > 0
                        add_money f_pergamon -1000
                    end_if
                    if I_EventCounter ecGandharaIsPlayer > 0
                        add_money f_gandhara -1000
                    end_if
                    if I_EventCounter ecLugiaIsPlayer > 0
                        add_money f_lugia -1000
                    end_if
                    if I_EventCounter ecBosporanIsPlayer > 0
                        add_money f_bosporan -1000
                    end_if
                    if I_EventCounter ecArevaciIsPlayer > 0
                        add_money f_arevaci -1000
                    end_if
                    if I_EventCounter ecBoiiIsPlayer > 0
                        add_money f_boii -1000
                    end_if
                    if I_EventCounter ecNabatuIsPlayer > 0
                        add_money f_nabatu -1000
                    end_if
                    if I_EventCounter ecBelgaiIsPlayer > 0
                        add_money f_belgai -1000
                    end_if
                end_if
                if I_EventCounter CamDiff > 3
                    historic_event HE_RAIDING_LOSS
                    if I_EventCounter ecRomeIsPlayer > 0
                        add_money f_rome -2000
                    end_if
                    if I_EventCounter ecCarthageIsPlayer > 0
                        add_money f_carthage -2000
                    end_if
                    if I_EventCounter ecMakedoniaIsPlayer > 0
                        add_money f_makedonia -2000
                    end_if
                    if I_EventCounter ecEpeirosIsPlayer > 0
                        add_money f_epeiros -2000
                    end_if
                    if I_EventCounter ecKHIsPlayer > 0
                        add_money f_kh -2000
                    end_if
                    if I_EventCounter ecSeleukidIsPlayer > 0
                        add_money f_seleukid -2000
                    end_if
                    if I_EventCounter ecPtolemaioiIsPlayer > 0
                        add_money f_ptolemaioi -2000
                    end_if
                    if I_EventCounter ecBaktriaIsPlayer > 0
                        add_money f_baktria -2000
                    end_if
                    if I_EventCounter ecHayastanIsPlayer > 0
                        add_money f_hayasdan -2000
                    end_if
                    if I_EventCounter ecPontosIsPlayer > 0
                        add_money f_pontos -2000
                    end_if
                    if I_EventCounter ecParthiaIsPlayer > 0
                        add_money f_parthia -2000
                    end_if
                    if I_EventCounter ecAeduiIsPlayer > 0
                        add_money f_aedui -2000
                    end_if
                    if I_EventCounter ecArverniIsPlayer > 0
                        add_money f_arverni -2000
                    end_if
                    if I_EventCounter ecCasseIsPlayer > 0
                        add_money f_casse -2000
                    end_if
                    if I_EventCounter ecLusotannanIsPlayer > 0
                        add_money f_lusotannan -2000
                    end_if
                    if I_EventCounter ecSwebozIsPlayer > 0
                        add_money f_sweboz -2000
                    end_if
                    if I_EventCounter ecGetaiIsPlayer > 0
                        add_money f_getai -2000
                    end_if
                    if I_EventCounter ecSabaIsPlayer > 0
                        add_money f_saba -2000
                    end_if
                    if I_EventCounter ecSakaIsPlayer > 0
                        add_money f_saka -2000
                    end_if
                    if I_EventCounter ecSauromataeIsPlayer > 0
                        add_money f_sauromatae -2000
                    end_if
                    if I_EventCounter ecNumidiaIsPlayer > 0
                        add_money f_numidia -2000
                    end_if
                    if I_EventCounter ecPergamonIsPlayer > 0
                        add_money f_pergamon -2000
                    end_if
                    if I_EventCounter ecGandharaIsPlayer > 0
                        add_money f_gandhara -2000
                    end_if
                    if I_EventCounter ecLugiaIsPlayer > 0
                        add_money f_lugia -2000
                    end_if
                    if I_EventCounter ecBosporanIsPlayer > 0
                        add_money f_bosporan -2000
                    end_if
                    if I_EventCounter ecArevaciIsPlayer > 0
                        add_money f_arevaci -2000
                    end_if
                    if I_EventCounter ecBoiiIsPlayer > 0
                        add_money f_boii -2000
                    end_if
                    if I_EventCounter ecNabatuIsPlayer > 0
                        add_money f_nabatu -2000
                    end_if
                    if I_EventCounter ecBelgaiIsPlayer > 0
                        add_money f_belgai -2000
                    end_if
                end_if
            end_if
        end_monitor


    This script used by the EBII team only uses one monitor and uses an already existing event counter to determine which faction is playing so that the amount of money can even be different.

    You have now seen that the rebels are not affected by this, why so? Because it would be an even bigger exploit to be able to raid rebel ports since they barely have the capacity to respond.
    Instead, I created a different script for them, called the piracy script, this script uses two monitors, clone events, that trigger when the player ports are blockaded by rebel fleets. Then the player has chances of getting a multichoice event asking if he wants to pursue the pirates or let them go. There are two events for this with the first text being the same but will get the player different results depending on what he decides.

    Spoiler Alert, click show to read: 
    Code:
        monitor_event Transgression TargetFactionType f_carthage
            and TransgressionName TC_BLOCKADE
            and FactionType slave
            generate_random_counter pirateattack 1 5             ; generating a number between 1 and 5
                if I_EventCounter pirateattack = 2                    ;20% chance of occurring  
                    add_money f_carthage -1000
                    historic_event HE_PIRACY_A true factions { f_carthage, } ; A pirate raid happens
    
    
                    while I_EventCounter HE_PIRACY_A_accepted = 0 ;;; while-loop to pause the script until a decision is made
                        and I_EventCounter HE_PIRACY_A_declined = 0
                    end_while
    
    
                    if I_EventCounter HE_PIRACY_A_accepted = 1          ; if the player accepts
                        add_money f_carthage 1500
                        historic_event HE_PIRACY_WON factions { f_carthage, }
                        set_event_counter HE_PIRACY_A_accepted 0        ; reset until next time
                    end_if
                    if I_EventCounter HE_PIRACY_A_declined = 1
                        add_money f_carthage -250
                        historic_event HE_PIRACY_NEUTRAL factions { f_carthage, }
                        set_event_counter HE_PIRACY_A_declined 0       ; reset until next time
                    end_if
                end_if
        end_monitor
    
    
        monitor_event Transgression TargetFactionType f_carthage
            and TransgressionName TC_BLOCKADE
            and FactionType slave
            generate_random_counter piratedefence 1 5             ; generating a number between 1 and 5
                if I_EventCounter piratedefence = 3                    ;20% chance of occurring  
                    add_money f_carthage -1000
                    historic_event HE_PIRACY_B true factions { f_carthage, } ; A pirate raid happens
    
    
                    while I_EventCounter HE_PIRACY_B_accepted = 0 ;;; while-loop to pause the script until a decision is made
                        and I_EventCounter HE_PIRACY_B_declined = 0
                    end_while
    
    
                    if I_EventCounter HE_PIRACY_B_accepted = 1          ; if the player accepts
                        add_money f_carthage -750
                        historic_event HE_PIRACY_LOST factions { f_carthage, }
                        set_event_counter HE_PIRACY_B_accepted 0       ; reset until next time
                    end_if
                    if I_EventCounter HE_PIRACY_B_declined = 1          ; if the player declines
                        set_event_counter HE_PIRACY_B_declined 0        ; reset until next time
                    end_if
                end_if
        end_monitor


    I hope you enjoyed this tutorial and use it on your own mods!

  2. #2
    Jadli's Avatar The Fallen God
    Gaming Emeritus

    Join Date
    Dec 2013
    Location
    Czech Republic
    Posts
    8,528

    Default Re: Maritime Raids

    Interesting indeed!

    Though, not completely sure if I understand what is the last pirate script supposed to be doing... what do you mean by pursuing or let them go? are there some additional scripts to make that happen, or Im missing something?

  3. #3

    Default Re: Maritime Raids

    Quote Originally Posted by Jadli View Post
    Interesting indeed!

    Though, not completely sure if I understand what is the last pirate script supposed to be doing... what do you mean by pursuing or let them go? are there some additional scripts to make that happen, or Im missing something?
    Not quite.
    They're clone events so basically when a pirate fleet blockades one of the player ports, there are some chances of getting either the event A or the event B. On those two multichoice events, the first text is the same, something like: The pirates have raided our shores, what would you like to do? Pursue them or let them go? After that the player decides what he wants to do and because he doesn't know if he got the event with the "bad ending" he can either lose more money, get the money back or nothing happening. It's like having four possibilities instead of two as usual.

  4. #4
    Jadli's Avatar The Fallen God
    Gaming Emeritus

    Join Date
    Dec 2013
    Location
    Czech Republic
    Posts
    8,528

    Default Re: Maritime Raids

    Ah... I see now

  5. #5
    Razor's Avatar Licenced to insult
    Join Date
    Apr 2004
    Location
    Deventer, The Netherlands
    Posts
    4,075

    Default Re: Maritime Raids

    This is interesting. I might include something like this in my Sengoku mod. Thanks for sharing this idea!

  6. #6

    Default Re: Maritime Raids

    Quote Originally Posted by Razor View Post
    This is interesting. I might include something like this in my Sengoku mod. Thanks for sharing this idea!
    You welcome! Feel free to send me a pm if you have any doubts about the script!

  7. #7

    Default Re: Maritime Raids

    Can you make assertions on which region's port you're blockading? I'm looking to do some scripting if a certain region's port is blockaded

Posting Permissions

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