Results 1 to 6 of 6

Thread: Addind difficutly levels and making a siege

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    sinople's Avatar These Romans are crazy!
    Join Date
    Apr 2007
    Location
    France
    Posts
    2,447

    Default Addind difficutly levels and making a siege

    Hello,

    I'm doind the scripting class lessons by J@mes, I want to make a script when capitals are taken.

    The first step work well, exemple with Paris :
    Code:
    		monitor_event GeneralCaptureSettlement SettlementName Paris
    		spawn_army 
    			faction france
    			character	Casin, named character, age 30, x 112, y 131 
    			traits GoodCommander 2
    			unit		NE Bodyguard		exp 2 armour 0 weapon_lvl 0
    			unit		Crossbow Militia		exp 1 armour 0 weapon_lvl 0
    			unit		Peasant Archers		exp 0 armour 0 weapon_lvl 0
    			unit		Spear Militia		exp 0 armour 0 weapon_lvl 0
    			unit		Spear Militia		exp 0 armour 0 weapon_lvl 0
    		end
    				terminate_monitor
    		end_monitor
    The second step make problems, because the IA army never attack the settlement. So, I decided to add a attacking script, It works, the IA general attack but it take the town before I can choose wether I want to occupied the settlement, destroyed population...

    Here is the script :
    Code:
    		monitor_event GeneralCaptureSettlement SettlementName Paris
    		siege_settlement Casin, Paris, siege
    				terminate_monitor
    		end_monitor
    I also tried this :
    Code:
    		monitor_event GeneralCaptureSettlement SettlementName Paris
    		siege_settlement Casin, Paris, attack
    				terminate_monitor
    		end_monitor
    But it gived the same result. I was wondering if we can add a command wich tells the AI general to wait one turn.

    The last step is also making problems. I want to change the number of armies spawned wether the difficutly :
    Code:
    	   ; ---------------------
    	   ; counters
    		
    		declare_counter Opened_Faction_Overview_Scroll
    		declare_counter Opened_Settlement_Scroll
    		declare_counter timurids_yerevan
    		declare_counter timurids_baghdad
    
    
    		declare_counter difficulty
    		declare_counter difficulty_easy 
    		declare_counter difficulty_medium
    		declare_counter difficulty_hard
    		declare_counter difficulty_very_hard
    		
    		
    	   ; ---------------------
    	   ; start up
    
    	   ;freeze_faction_ai aztecs
    		restrict_strat_radar false
    
    	   ;----------------------
    	   ; monitors
    
    		 monitor_event FactionTurnStart FactionIsLocal
    							   and CampaignDifficulty = very_hard
    				set_event_counter difficulty_easy 0
    				set_event_counter difficulty_medium 0
    				set_event_counter difficulty_hard 0
    				set_event_counter difficulty_very_hard 1
    
    				terminate_monitor
    		end_monitor
    
    		 monitor_event FactionTurnStart FactionIsLocal
    							   and CampaignDifficulty = hard
    				set_event_counter difficulty_easy 0
    				set_event_counter difficulty_medium 0
    				set_event_counter difficulty_hard 1
    				set_event_counter difficulty_very_hard 0
    
    				terminate_monitor
    		end_monitor
    
    		 monitor_event FactionTurnStart FactionIsLocal
    							   and CampaignDifficulty = medium
    				set_event_counter difficulty_easy 0
    				set_event_counter difficulty_medium 1
    				set_event_counter difficulty_hard 0
    				set_event_counter difficulty_very_hard 0
    
    				terminate_monitor
    		end_monitor
    
    		 monitor_event FactionTurnStart FactionIsLocal
    							   and CampaignDifficulty = easy
    				set_event_counter difficulty_easy 1
    				set_event_counter difficulty_medium 0
    				set_event_counter difficulty_hard 0
    				set_event_counter difficulty_very_hard 0
    
    				terminate_monitor
    		end_monitor
    
    		monitor_event GeneralCaptureSettlement SettlementName Paris
    		if I_CompareCounter difficulty_very_hard = 1
    		spawn_army 
    			faction france
    			character	Casin, named character, age 30, x 112, y 131 
    			traits GoodCommander 2
    			unit		NE Bodyguard		exp 2 armour 0 weapon_lvl 0
    			unit		Crossbow Militia		exp 1 armour 0 weapon_lvl 0
    			unit		Peasant Archers		exp 0 armour 0 weapon_lvl 0
    			unit		Spear Militia		exp 0 armour 0 weapon_lvl 0
    			unit		Spear Militia		exp 0 armour 0 weapon_lvl 0
    			unit		Peasant Archers		exp 0 armour 0 weapon_lvl 0
    			unit		Spear Militia		exp 0 armour 0 weapon_lvl 0
    			unit		Spear Militia		exp 0 armour 0 weapon_lvl 0
    			unit		Peasant Archers		exp 0 armour 0 weapon_lvl 0
    			unit		Spear Militia		exp 0 armour 0 weapon_lvl 0
    			unit		Spear Militia		exp 0 armour 0 weapon_lvl 0
    			unit		Peasant Archers		exp 0 armour 0 weapon_lvl 0
    			unit		Spear Militia		exp 0 armour 0 weapon_lvl 0
    			unit		Spear Militia		exp 0 armour 0 weapon_lvl 0
    		end_if
    
    		if I_CompareCounter difficulty_hard = 1
    		spawn_army 
    			faction france
    			character	Casin, named character, age 30, x 112, y 131 
    			traits GoodCommander 2
    			unit		NE Bodyguard		exp 2 armour 0 weapon_lvl 0
    			unit		Crossbow Militia		exp 1 armour 0 weapon_lvl 0
    			unit		Peasant Archers		exp 0 armour 0 weapon_lvl 0
    			unit		Spear Militia		exp 0 armour 0 weapon_lvl 0
    		end_if
    
    		if I_CompareCounter difficulty_medium = 1
    		spawn_army 
    			faction france
    			character	Casin, named character, age 30, x 112, y 131 
    			traits GoodCommander 2
    			unit		NE Bodyguard		exp 2 armour 0 weapon_lvl 0
    			unit		Crossbow Militia		exp 1 armour 0 weapon_lvl 0
    		end_if
    
    		if I_CompareCounter difficulty_easy = 1
    		spawn_army 
    			faction france
    			character	Casin, named character, age 30, x 112, y 131 
    			traits GoodCommander 2
    			unit		NE Bodyguard		exp 2 armour 0 weapon_lvl 0
    		end_if
    				terminate_monitor
    		end_monitor
    I can't get it working.

    Thanks

  2. #2

    Default Re: Addind difficutly levels and making a siege

    Quote Originally Posted by sinople View Post

    Code:
            monitor_event GeneralCaptureSettlement SettlementName Paris
            siege_settlement Casin, Paris, siege
                    terminate_monitor
            end_monitor
    I also tried this :
    [code] monitor_event GeneralCaptureSettlement SettlementName
    change this to siege_settlement Casin, Paris, siege > siege_settlement Casin, Paris, maintain ( a parameter oF siege does not exist sorry my mistake)
    Last edited by J@mes; August 09, 2008 at 03:20 AM.


  3. #3
    sinople's Avatar These Romans are crazy!
    Join Date
    Apr 2007
    Location
    France
    Posts
    2,447

    Default Re: Addind difficutly levels and making a siege

    Code:
            monitor_event GeneralCaptureSettlement SettlementName Paris
    		spawn_army 
    			faction france
    			character	Casin, named character, age 30, x 112, y 131 
    			traits GoodCommander 2
    			unit		NE Bodyguard		exp 2 armour 0 weapon_lvl 0
    			unit		Crossbow Militia		exp 1 armour 0 weapon_lvl 0
    			unit		Peasant Archers		exp 0 armour 0 weapon_lvl 0
    			unit		Spear Militia		exp 0 armour 0 weapon_lvl 0
    			unit		Spear Militia		exp 0 armour 0 weapon_lvl 0
    			unit		Peasant Archers		exp 0 armour 0 weapon_lvl 0
    			unit		Spear Militia		exp 0 armour 0 weapon_lvl 0
    			unit		Spear Militia		exp 0 armour 0 weapon_lvl 0
    			unit		Peasant Archers		exp 0 armour 0 weapon_lvl 0
    			unit		Spear Militia		exp 0 armour 0 weapon_lvl 0
    			unit		Spear Militia		exp 0 armour 0 weapon_lvl 0
    			unit		Peasant Archers		exp 0 armour 0 weapon_lvl 0
    			unit		Spear Militia		exp 0 armour 0 weapon_lvl 0
    			unit		Spear Militia		exp 0 armour 0 weapon_lvl 0
    		end
                    terminate_monitor
            end_monitor
    
            monitor_event GeneralCaptureSettlement SettlementName Paris
    		siege_settlement Casin, Paris, maintain
                    terminate_monitor
            end_monitor
    Used this, but this is not working.

    Something like this, is it possible ? :
    Code:
            monitor_event GeneralCaptureSettlement SettlementName Paris
    		and wait = 1
    		siege_settlement Casin, Paris, maintain
                    terminate_monitor
            end_monitor

  4. #4

    Default

    This is similar to the script that J@mes helped me with (a lot!)
    Spoiler Alert, click show to read: 

    ;--Swiss Uprising

    monitor_event EventCounter EventCounterType swiss_uprising
    and EventCounter > 0
    and not I_SettlementOwner Bern = slave

    spawn_army
    faction slave
    character Skaris, named character, age 42, x 327, y 119,
    traits GoodCommander 4 , GoodAttacker 3 , NaturalMilitarySkill 3 , StrategyDread 3 , BattleDread 4, NightBattleCapable 1
    unit NE Bodyguard exp 6 armour 1 weapon_lvl 1
    unit Swiss Pikemen exp 6 armour 1 weapon_lvl 1
    unit Swiss Pikemen exp 6 armour 1 weapon_lvl 1
    unit Swiss Pikemen exp 6 armour 1 weapon_lvl 1
    unit Swiss Pikemen exp 6 armour 1 weapon_lvl 1
    unit Swiss Pikemen exp 6 armour 1 weapon_lvl 1
    unit Mercenary Ribault exp 3 armour 0 weapon_lvl 0
    unit Mercenary Ribault exp 3 armour 0 weapon_lvl 0
    unit Mercenary Ribault exp 3 armour 0 weapon_lvl 0
    unit Chivalric Knights exp 4 armour 1 weapon_lvl 1
    unit Chivalric Knights exp 4 armour 1 weapon_lvl 1
    unit Dismounted Mercenary Knights exp 4 armour 0 weapon_lvl 1
    unit Dismounted Mercenary Knights exp 4 armour 0 weapon_lvl 1
    unit Dismounted Mercenary Knights exp 4 armour 0 weapon_lvl 1
    unit Dismounted Mercenary Knights exp 4 armour 0 weapon_lvl 1
    unit Hussites exp 3 armour 0 weapon_lvl 0
    unit Hussites exp 3 armour 0 weapon_lvl 0
    unit Hussites exp 3 armour 0 weapon_lvl 0
    end

    siege_settlement Skaris, Bern, maintain
    siege_settlement Skaris, Bern, attack
    set_counter new_counter 1

    terminate_monitor
    end_monitor

    My Idea was for the army to spawn in the rebel turn, in your case the french turn. I imagine setting a counter when the settlement is taken and monitoring for it during the appropriate other factions turn, is the best way to the script working nicely. I just don't have the knowledge to set it out correctly either.

    Here's how I eventually got a 1 turn delay.
    ;--Swiss Uprising
    declare_counter new_counter
    monitor_event EventCounter EventCounterType swiss_uprising
    and EventCounter > 0
    and not I_SettlementOwner Bern = slave
    set_counter new_counter 1
    end_monitor
    monitor_event FactionTurnStart FactionType slave
    and I_CompareCounter new_counter = 1
    spawn_army
    faction slave
    character Skaris, named character, age 42, x 327, y 119,
    traits GoodCommander 4 , GoodAttacker 3 , NaturalMilitarySkill 3 , StrategyDread 3 , BattleDread 4, NightBattleCapable 1
    unit NE Bodyguard exp 6 armour 1 weapon_lvl 1
    etc.
    end
    siege_settlement Skaris, Bern, maintain
    siege_settlement Skaris, Bern, attack
    set_counter new_counter 2
    terminate_monitor
    end_monitor

    You should be able to figure it out from that, don't think I can help you with the difficulty though.
    :hmmm:
    Last edited by Amroth; August 10, 2008 at 01:17 PM. Reason: dp

  5. #5

    Default Re: Addind difficutly levels and making a siege

    it's funny I have the same issue. For now the only solutions to me is to fake siege lenght.
    Use while
    ex:
    monitor_event PreFactionTurnStart FactionType turks
    and I_TurnNumber = 1
    while I_SettlementOwner Isparta = byzantium
    siege_settlement Cihangir, Isparta, maintain
    end_while
    if I_SettlementOwner Isparta = turks
    terminate_monitor
    end_if

    then 5 turns later:

    monitor_event PreFactionTurnStart FactionType turks
    and I_TurnNumber = 6

    siege_settlement Cihangir, Isparta, attack

    Everyturn the AI will lift the siege move then come back and siege again.

    Then 5 turns later it will attack the settlement.

    The only way to make a proper siege, is to freeze AI, but I don't like it, even though it's good to test conditions. I've even erased all the scripts, just to test some conditions, with only an easy working script after, to check if my script is correct.

    Think that in the AI, for the first 10 turns, AI stops invasion and ask truce...

    ( I changed it but still does not work ).

  6. #6
    sinople's Avatar These Romans are crazy!
    Join Date
    Apr 2007
    Location
    France
    Posts
    2,447

    Default Re: Addind difficutly levels and making a siege

    Ok thanks you, I'll try this.

Posting Permissions

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