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

Thread: Creating a World - Disasters and the add_events command

  1. #21
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,132
    Blog Entries
    35

    Default Re: Creating a World - Disasters and the add_events command

    I remember test spawning a fleet on dry land and then triggering a storm next to it. That did work, it was in the middle of Ireland in the default campaign so characters will have been in that region. If you have a 'script faction' then you could use a transparent texture and later kill the ship\admiral as it would be the only one for that faction. Or do it via custom unit (custom attribute as reference for kill).










  2. #22
    bitterhowl's Avatar Campidoctor
    Join Date
    Feb 2011
    Location
    Russian Feodality
    Posts
    1,695

    Default Re: Creating a World - Disasters and the add_events command

    Here's an example of Fire event used in combination with scripted damage to settlement.

    It requires settlement coordinates and a monitor for each settlement. You may set damage level by yourself - only core_building, or additional buildings, or population decrease.

    In my example event fires when Naffatun unit is inside settlement.


    My sister, do you still recall the blue Hasan and Khalkhin-Gol?
    Russian warship is winning. Proofs needed? Go find yourself!

  3. #23
    Jurand of Cracow's Avatar History and gameplay!
    Join Date
    Oct 2012
    Location
    Cracovia
    Posts
    8,494

    Default Re: Creating a World - Disasters and the add_events command

    Hi Guys,
    could you tell me why I cannot see the fires?

    Code:
        ;------------------------------------------------------ FL/FH CHANGE COSTS poland    monitor_event BecomesFactionLeader FactionType poland
        
            if I_IsFactionAIControlled poland                        ; only for player
                terminate_monitor
            end_if
    
    
            set_event_counter FL_is_senile 0
            set_event_counter FL_player_is_new_this_turn 1            ; counter only for player - is set to 0 at the end of the Settlements' turn
    
    
        end_monitor
    Code:
        monitor_event SettlementTurnStart SettlementName Wroclaw
    
            if I_EventCounter is_the_player > 0
            
                if I_EventCounter FL_player_is_new_this_turn > 0            ; (one-off) shock for the kingdom: FL died
                and I_EventCounter faction_size_small < 1                    ; doesn't matter for small factions            
                    inc_counter Wroclaw_turmoil_points 10                        ; 10+10
                    add_events
                        event    fire                                        ; a visual
                        date    0
                        position    199, 214                                ; (coordinates easily obtained in descr_strat)
                    end_add_events
                    console_command add_population Wroclaw -500                 ; some fleeing the capital after change on the throne                        
                end_if
            
            end_if
            
            if I_EventCounter is_the_player > 0
    
    
                set_event_counter FL_player_is_new_this_turn 0
    
    
            end_if    
            
        end_monitor
    actually, the full monitors look like below - and they work. I just cannot see the fires.
    Code:
        ;------------------------------------------------------ FL/FH CHANGE COSTS poland    monitor_event BecomesFactionLeader FactionType poland
    	
    		if I_IsFactionAIControlled poland						; only for player
    			terminate_monitor
    		end_if
    		
            if I_NumberOfSettlements poland > 4						; low payment from 5 settlements up
    			console_command add_money -1209
    			if I_NumberOfSettlements poland > 10				; high payment from 11 settlements up
    				console_command add_money -1209
    				if I_EventCounter DifficultyLevel > 2 			; addition for H difficulty
    					console_command add_money -1209
    					if I_EventCounter DifficultyLevel > 3 		; addition for VH difficulty
    						console_command add_money -1209
    					end_if
    				end_if
    			end_if
    		end_if
    
    
    		set_event_counter FL_is_senile 0
    		set_event_counter FL_player_is_new_this_turn 1			; counter only for player - is set to 0 at the end of the Settlements' turn
    
    
            if I_FactionLeaderAttribute poland Authority < 7
    		and I_FactionLeaderAttribute poland Command < 8
    		and I_FactionLeaderAttribute poland Chivalry > -8
    		and I_FactionLeaderTrait poland Usurper > 0
    			log --- Weak usurper FL ascending the throne
    			set_event_counter FL_weak_usurper_on_the_throne 1
    			set_event_counter FL_weak_on_the_throne 1
    			if not I_IsFactionAIControlled
    				historic_event FL_WEAK_LEADER_TAKES_THRONE
    			end_if
    		end_if
    
    
            if I_FactionLeaderAttribute poland Authority < 4
    		and I_FactionLeaderTrait poland Usurper < 1		
    		and I_FactionLeaderAttribute poland Command < 6
    		and I_FactionLeaderAttribute poland Chivalry > -6
    			log --- Weak legitimate FL ascending the throne		
    			set_event_counter FL_weak_legitimate_on_the_throne 1
    			set_event_counter FL_weak_on_the_throne 1
    			if not I_IsFactionAIControlled
    				historic_event FL_WEAK_LEADER_TAKES_THRONE
    			end_if
    		end_if
    
    
        end_monitor
    Code:
        ;============================================================================================================    ;------------------------------------------------------------------------------  Wroclaw Turmoil Script section
    
    
        monitor_event SettlementTurnStart SettlementName Wroclaw
        
            set_counter Wroclaw_turmoil_points 0
    
    
            log --- (A) Wroclaw Turmoil Points (for the Player) -----------------------------------------    
            
            if I_EventCounter is_the_player > 0
            and I_EventCounter Wroclaw_turns_in_our_realm > 4 
            
                if I_EventCounter FL_policy_protector < 1                    ; base unrest value - if no FL policy protector
                and I_EventCounter DifficultyLevel > 2                        ; Hard or Very Hard difficulty
                and I_EventCounter faction_size_small < 1                    ; 
                    inc_counter Wroclaw_turmoil_points 2                        ; 2 for factions 4-9 settlements
                    if I_EventCounter faction_size_medium < 1                ; 
                        inc_counter Wroclaw_turmoil_points 2                    ; 4 for factions 10-19 settlements
                        if I_EventCounter faction_size_large < 1            ;
                            inc_counter Wroclaw_turmoil_points 2                ; 6 for factions 20+ settlements
                        end_if
                    end_if
                end_if
                
                if I_EventCounter FL_is_crowned_ruler < 1                            ; FL is UNcrowned - it will be true for the most of the factions for a long time
                    inc_counter Wroclaw_turmoil_points 4                                ; 4 for a home province
                    if I_EventCounter Wroclaw_turns_in_our_realm < 390
                        inc_counter Wroclaw_turmoil_points 1
                        if I_EventCounter Wroclaw_turns_in_our_realm < 290                ; many provinces have initial 200, so they will have +2
                            inc_counter Wroclaw_turmoil_points 1
                            if I_EventCounter Wroclaw_turns_in_our_realm < 190
                                inc_counter Wroclaw_turmoil_points 1
                                if I_EventCounter Wroclaw_turns_in_our_realm < 90
                                    inc_counter Wroclaw_turmoil_points 1
                                    if I_EventCounter Wroclaw_turns_in_our_realm < 30
                                        inc_counter Wroclaw_turmoil_points 1            ; +5 for a new conquered province
                                    end_if
                                end_if
                            end_if
                        end_if
                    end_if                
                end_if
    
    
                if I_EventCounter Wroclaw_turns_in_our_realm < 480                                 ; province not yet integrated into our realm: 0-9
                    inc_counter Wroclaw_turmoil_points 1
                    if I_EventCounter Wroclaw_turns_in_our_realm < 320
                        inc_counter Wroclaw_turmoil_points 1
                        if I_EventCounter Wroclaw_turns_in_our_realm < 160
                            inc_counter Wroclaw_turmoil_points 1
                            if I_EventCounter Wroclaw_turns_in_our_realm < 90
                                inc_counter Wroclaw_turmoil_points 1
                                if I_EventCounter Wroclaw_turns_in_our_realm < 50
                                    inc_counter Wroclaw_turmoil_points 1
                                    if I_EventCounter Wroclaw_turns_in_our_realm < 25
                                        inc_counter Wroclaw_turmoil_points 1
                                        if I_EventCounter Wroclaw_turns_in_our_realm < 16
                                            inc_counter Wroclaw_turmoil_points 1
                                            if I_EventCounter Wroclaw_turns_in_our_realm < 12
                                                inc_counter Wroclaw_turmoil_points 1
                                                if I_EventCounter Wroclaw_turns_in_our_realm < 8    ; right after capture: 9
                                                    inc_counter Wroclaw_turmoil_points 1
                                                end_if
                                            end_if
                                        end_if
                                    end_if
                                end_if
                            end_if
                        end_if
                    end_if
                end_if        
                    
                if I_FactionLeaderAttribute Authority < 3                    ; FL really lacks Authority
                and I_EventCounter DifficultyLevel > 3                        ; Very Hard difficulty
                and I_EventCounter faction_size_small < 1                    ; doesn't matter for small factions - everybody knows him
                    inc_counter Wroclaw_turmoil_points 3                        ; 3+3
                    if I_EventCounter Wroclaw_turns_in_our_realm < 300
                        inc_counter Wroclaw_turmoil_points 1
                        if I_EventCounter Wroclaw_turns_in_our_realm < 200
                            inc_counter Wroclaw_turmoil_points 1
                            if I_EventCounter Wroclaw_turns_in_our_realm < 100
                                inc_counter Wroclaw_turmoil_points 1
                            end_if
                        end_if
                    end_if
                end_if
    
    
                if I_EventCounter FL_weak_on_the_throne > 0                    ; weak FL (low authority or weak usurper)
                and I_EventCounter faction_size_small < 1                    ; doesn't matter for small factions
                    inc_counter Wroclaw_turmoil_points 5                        ; 5+5
                    if I_EventCounter Wroclaw_turns_in_our_realm < 440
                        inc_counter Wroclaw_turmoil_points 1
                        if I_EventCounter Wroclaw_turns_in_our_realm < 340
                            inc_counter Wroclaw_turmoil_points 1
                            if I_EventCounter Wroclaw_turns_in_our_realm < 240
                                inc_counter Wroclaw_turmoil_points 1
                                if I_EventCounter Wroclaw_turns_in_our_realm < 140
                                    inc_counter Wroclaw_turmoil_points 1
                                    if I_EventCounter Wroclaw_turns_in_our_realm < 40
                                        inc_counter Wroclaw_turmoil_points 1
                                    end_if
                                end_if
                            end_if
                        end_if
                    end_if                
                end_if
        
                if I_EventCounter FL_player_is_new_this_turn > 0            ; (one-off) shock for the kingdom: FL died
                and I_EventCounter faction_size_small < 1                    ; doesn't matter for small factions            
                    inc_counter Wroclaw_turmoil_points 10                        ; 10+10
                    add_events
                        event    fire                                        ; a visual
                        date    0
                        position    199, 214                                ; (coordinates easily obtained in descr_strat)
                    end_add_events
                    console_command add_population Wroclaw -500                 ; some fleeing the capital after change on the throne                
                    if I_EventCounter Wroclaw_turns_in_our_realm < 450
                        inc_counter Wroclaw_turmoil_points 2
                        if I_EventCounter Wroclaw_turns_in_our_realm < 350
                            inc_counter Wroclaw_turmoil_points 2
                            if I_EventCounter Wroclaw_turns_in_our_realm < 250
                                inc_counter Wroclaw_turmoil_points 2
                                if I_EventCounter Wroclaw_turns_in_our_realm < 150
                                    inc_counter Wroclaw_turmoil_points 2
                                    if I_EventCounter Wroclaw_turns_in_our_realm < 50
                                        inc_counter Wroclaw_turmoil_points 2
                                    end_if
                                end_if
                            end_if
                        end_if
                    end_if                
                end_if
    
    
    
    
                if I_EventCounter player_aggressivity > 6                    ; (conquest of 1 settlement adds 3-18 aggressivity pts., usually 12)
                    inc_counter Wroclaw_turmoil_points 4
                    if I_EventCounter player_aggressivity > 12
                        inc_counter Wroclaw_turmoil_points 8
                        if I_EventCounter player_aggressivity > 24
                            inc_counter Wroclaw_turmoil_points 16                ; cumulative, so levels of turmoi points: 4-12-28
                        end_if
                    end_if
                end_if
            
            end_if
    
    
            log --- (B) Wroclaw Turmoil Points (for AI) -----------------------------------------------
            
            if I_EventCounter is_the_player < 1                        ; AI
            
                if I_EventCounter faction_turn_poland < 1             ; not "creator" of this province
                and I_EventCounter faction_turn_hre < 1
                and I_EventCounter faction_turn_hre < 1        ; pagans have it easier and to make Lithuania life easier
                and I_EventCounter faction_size_small < 1            ; not for small factions
                   inc_counter Wroclaw_turmoil_points 20
                end_if
                
                if I_EventCounter FL_weak_on_the_throne > 0         ; rather unlikely event
                   inc_counter Wroclaw_turmoil_points 10
                end_if
    
    
            end_if    
            
            log --- (C) Wroclaw Turmoil Points Translated Into Unrest -----------------------------------------------
            
            if I_CompareCounter Wroclaw_turmoil_points > 5
                add_settlement_turmoil Wroclaw 1
                if I_CompareCounter Wroclaw_turmoil_points > 10
                    add_settlement_turmoil Wroclaw 2
                    if I_CompareCounter Wroclaw_turmoil_points > 15
                        add_settlement_turmoil Wroclaw 3
                        if I_CompareCounter Wroclaw_turmoil_points > 20
                            add_settlement_turmoil Wroclaw 4
                            if I_CompareCounter Wroclaw_turmoil_points > 25
                                add_settlement_turmoil Wroclaw 5
                                if I_CompareCounter Wroclaw_turmoil_points > 30
                                    add_settlement_turmoil Wroclaw 6
                                    if I_CompareCounter Wroclaw_turmoil_points > 35
                                        add_settlement_turmoil Wroclaw 7
                                        if I_CompareCounter Wroclaw_turmoil_points > 40
                                            add_settlement_turmoil Wroclaw 8
                                            if I_CompareCounter Wroclaw_turmoil_points > 45
                                                add_settlement_turmoil Wroclaw 9
                                                if I_CompareCounter Wroclaw_turmoil_points > 50
                                                    add_settlement_turmoil Wroclaw 10
                                                    if I_CompareCounter Wroclaw_turmoil_points > 55
                                                        add_settlement_turmoil Wroclaw 11
                                                        if I_CompareCounter Wroclaw_turmoil_points > 60
                                                            add_settlement_turmoil Wroclaw 12
                                                        end_if
                                                    end_if
                                                end_if
                                            end_if
                                        end_if
                                    end_if
                                end_if
                            end_if
                        end_if
                    end_if
                end_if
            end_if            
                    
            log --- (D) Wroclaw Integration Process ----------------------------------------
            
            if    I_EventCounter Wroclaw_turns_in_our_realm < 500
    
    
                if I_EventCounter FL_weak_on_the_throne < 1                ; natural integration process but not with a Usurper (thus not during a civil war either)
                    inc_event_counter Wroclaw_turns_in_our_realm 1
                end_if
    
    
                if I_EventCounter FL_is_crowned_ruler > 0                ; if the owner's faction FL has the crown
                    inc_event_counter Wroclaw_turns_in_our_realm 1            ; integration is faster
                end_if
    
    
                if I_EventCounter FL_policy_thinks_of_his_people > 0    ; if FL pursues a conducive policy
                    inc_event_counter Wroclaw_turns_in_our_realm 1            ; integration is faster
                end_if
                
                if I_EventCounter faction_turn_poland > 0                ; this faction 
                and I_EventCounter poland7_golden_age_player > 0        ; has special circumstances 
                and I_EventCounter FL_weak_on_the_throne < 1            ;             
                    inc_event_counter Wroclaw_turns_in_our_realm 1            ; that allow faster integration
                end_if
                            
                if I_EventCounter faction_turn_hre > 0                ; this province is a core province of this factiton
                and I_EventCounter FL_weak_on_the_throne < 1            ; and the FL is not lacking authority / usurper
                    set_event_counter Wroclaw_turns_in_our_realm 500        ; no integration is needed
                end_if
                
                if I_EventCounter faction_turn_hre > 0                ; this province is a core province of this factiton
                and I_EventCounter FL_weak_on_the_throne < 1
                    set_event_counter Wroclaw_turns_in_our_realm 500        ; no integration is needed
                end_if
    
    
            end_if
    
    
            log --- (E) Wroclaw Infos & Counters for the Player ----------------------------------------
                
            if I_EventCounter is_the_player > 0
    
    
                set_event_counter FL_player_is_new_this_turn 0
                
                if I_EventCounter Wroclaw_turns_in_our_realm > 4
                and I_EventCounter Wroclaw_turns_in_our_realm < 6
                    historic_event SETTLEMENT_UNREST_NORMAL_RULES_WROCLAW
                end_if    
                if I_EventCounter Wroclaw_turns_in_our_realm > 197
                and I_EventCounter Wroclaw_turns_in_our_realm < 199
                    historic_event SETTLEMENT_UNREST_INTEGRATED_WROCLAW
                end_if
                if I_EventCounter Wroclaw_turns_in_our_realm > 487
                and I_EventCounter Wroclaw_turns_in_our_realm < 489
                    historic_event SETTLEMENT_UNREST_INTEGRATED_WROCLAW
                end_if
            end_if    
            
        end_monitor
    Last edited by Jurand of Cracow; March 06, 2022 at 12:57 PM.

  4. #24
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,132
    Blog Entries
    35

    Default Re: Creating a World - Disasters and the add_events command

    You do not reveal the tile so the event will only be visible for the owner of the settlement.

    Given the rather large number of IF loops and conditions I would suggest to test the functionality of the event in a short monitor.
    Code:
        monitor_event SettlementTurnStart SettlementName Wroclaw
            snap_strat_camera 199, 214     ; instantly move camera to event
            add_events
                event    fire              ; a visual
                date    0
                position    199, 214       ; (coordinates easily obtained in descr_strat)
            end_add_events
            
        end_monitor
    The animation lasts for about 5 seconds if I remember correctly.

    My small monitor will fire at game start which obviously is the player's turn - hence I didn't add the reveal or a player condition. Always assuming that the player owns the settlement - something your full script makes no provision for, hence it might as well be owned by someone else when the event fires in which case you are back to the reveal issue.
    Last edited by Gigantus; March 06, 2022 at 02:38 PM.










  5. #25
    Jurand of Cracow's Avatar History and gameplay!
    Join Date
    Oct 2012
    Location
    Cracovia
    Posts
    8,494

    Default Re: Creating a World - Disasters and the add_events command

    The event fires after the FL death only in own settlements - they're already visible for the player, so there's no need to reveal the tile.

    Furthermore, the event fires for all settlements owned by the faction (in this case for 5) - can 5 fires be visible?

  6. #26

    Default Re: Creating a World - Disasters and the add_events command

    Quote Originally Posted by Jurand of Cracow View Post
    The event fires after the FL death only in own settlements - they're already visible for the player, so there's no need to reveal the tile.

    Furthermore, the event fires for all settlements owned by the faction (in this case for 5) - can 5 fires be visible?
    I actually never tried more than 1 fire at the same time, should be something interesting to try. But you need to reveal the tile even if you own the settlements. Let me give an example of a code I wrote for EBII (already tested and it works).

    Code:
     
           monitor_event FactionTurnStart FactionType f_carthage                and I_EventCounter ecSummer > 0  				;
                    if I_IsFactionAIControlled f_carthage                                      ; not for the AI
                        terminate_monitor
                    end_if
                    if I_EventCounter fire_disaster = 6                   ; 10% chance of occurring every turn
                    reveal_tile 113,128
                    add_events
                         event fire    
                         date 0
                         position 113, 128       ; Kart-Hadasht
                    end_add_events
                    console_command add_money f_carthage, -1500
                    console_command set_building_health sett_170 core_building 65
                    console_command set_building_health sett_170 market 60
                    historic_event HE_FIRE_IN_CARTHAGE  factions { f_carthage, }
                    play_sound_event Fire
                    add_settlement_turmoil sett_170 6
                    end_if

  7. #27
    Jurand of Cracow's Avatar History and gameplay!
    Join Date
    Oct 2012
    Location
    Cracovia
    Posts
    8,494

    Default Re: Creating a World - Disasters and the add_events command

    Thanks, Lusi! I'll try to check it.
    Is the sound of fire included in vanilla, or you need to add it?
    @Gig: I understand that move a the camera to the place is universal for the whole Med2 language, not to only for disasters? Eg. if I have a code for spawn of Princesses, I can include it also there?
    snap_strat_camera 199, 214 ; instantly move camera to event
    Last edited by Jurand of Cracow; March 07, 2022 at 12:38 AM.

  8. #28
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,132
    Blog Entries
    35

    Default Re: Creating a World - Disasters and the add_events command

    snap_strat_camera is the cousin of move_strat_camera - while the first is instant placement the second does actually move (sweep like) from the map view when the command got triggered to the destination. Both are regular script commands and can be used as such, just not within the add_event section itself. The command is often used in conjunction with zoom_strat_camera which does exactly what the name says.

    I used the command instead of the 'position' line within the add_event section as clicking on the locator button enabled by 'position' might happen after the animation has expired. Never mind that 'fire' hasn't got a message window to start with.

    Tip: if you use the command together with message windows (historic events) then change the value of the snap x co-ordinate until the event is to one side of the message. Hazy memory says that's about 10-12 tiles.
    Last edited by Gigantus; March 07, 2022 at 01:28 AM.










  9. #29
    Jurand of Cracow's Avatar History and gameplay!
    Join Date
    Oct 2012
    Location
    Cracovia
    Posts
    8,494

    Default Re: Creating a World - Disasters and the add_events command

    Quote Originally Posted by Gigantus View Post
    snap_strat_camera is the cousin of move_strat_camera - while the first is instant placement the second does actually move (sweep like) from the map view when the command got triggered to the destination. Both are regular script commands and can be used as such, just not within the add_event section itself. The command is often used in conjunction with zoom_strat_camera which does exactly what the name says.

    I used the command instead of the 'position' line within the add_event section as clicking on the locator button enabled by 'position' might happen after the animation has expired.
    Ok, so I understand that:
    move_strat_camera - move (sweep like) from the current map view to the location of the event
    snap_strat_camera - instant placement of view on the location of the event
    position - locator button in a pop-out window
    zoom_strat_camera - zooms afterhe move/snap/clicking on the locator button

    Do you know how does it square with a multiple similar events? If there're five "fires" that are scripted in the "SettlementTurnStart", then the player has only 5 seconds to see them (all)?
    What does "point_at_settlement" do?
    BTW, is there a difference in use in script between "campaign_wait 1" and "wait 0.5" ?
    Last edited by Jurand of Cracow; March 07, 2022 at 03:32 AM.

  10. #30

    Default Re: Creating a World - Disasters and the add_events command

    You don't need to reveal_tile for the fire event to work (that command is also not hotseat compatible, the tile is revealed for all factions), the settlement just needs to be visible to the player when the event happens. You can even use toggle_fow, issue the event, then toggle back for settlements that haven't been revealed yet to the player. The particles only last about 10 seconds but I think that's the only thing this event does, so there's no harm in issuing it multiple times. You could loop it for a whole turn if needed.

    Code:
    if I_EventCounter fire_event == 1
       snap_strat_camera 10,10
       historic_event fire_event_message factions { england, }
       while I_EventCounter fire_event == 1 ;set this counter to 1 when the fires start and 0 when you're done with the fires
          add_events
             event fire
             date 0
             position 10,10
          end_add_events
          campaign_wait 10
       end_while
    end_if
    The point_at_settlement command is a UI highlight, it circles the settlement with vanilla textures iirc and can be disabled with ui_flash_stop.

    The wait command pauses execution of commands within the same monitor but not other monitors . It doesn't pause anything on the map or respect pauses (unless 'heed_pause on' is declared). The campaign_wait and battle_wait commands do the same thing but only in their respective domains (campaign and battle maps). It is almost always better to use 'while' than wait - basically the only time to use wait is when you don't know how long something lasts and there is no event for it (like a character playing their death animation). See here for discussion.
    Last edited by Callistonian; March 07, 2022 at 10:20 AM.

  11. #31
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,132
    Blog Entries
    35

    Default Re: Creating a World - Disasters and the add_events command

    The reveal is indeed not needed for the events to work. It is however needed to make it visible for factions that have FoW over the co-ordinate (see 'important note' in OP). I was not aware that the 'fire' event automatically reveals the tile for all factions, the other events do not, can you confirm?

    Your code does not reset the fire_event counter value, so when would you be doing that?










  12. #32

    Default Re: Creating a World - Disasters and the add_events command

    You can toggle_fow, create the event, then toggle back off to show the smoke coming out of settlements that haven't been revealed to the player... but I'm not sure how desirable this is, it looks funny to see smoke coming out of a blank spot on the map or even from a settlement under fog. I meant that the reveal tile command reveals the tile for all players since factions can't be specified. Sorry for the ambiguous wording.

    The fire_event counter is just for the sake of example. This isn't a free floating if-statement either, presumably there would be some monitor context and some context for setting that counter to 0 and 1. You could set the counter to 1 at slave turn end if some other condition is met and then back to 0 at the next slave turn end to loop the fire for a whole turn.

  13. #33
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,132
    Blog Entries
    35

    Default Re: Creating a World - Disasters and the add_events command

    It would be desirable if the player needs to be aware of it, be it just for game consistency or scripting reasons (see important notes again). Otherwise it's optional, and in this case toggling FoW will have the same effect as the reveal command - I just think that doing a global reveal is counter productive. I use reveal fairly often (eg intro tours in RotK) and have a 'reset' monitor at slave turn end for that reason.

    Doing a reveal on a settlement is the same mechanics as for settlements in the victory conditions - it reveals, but does not update. So seeing smoke coming from a settlement that you know is there is not that far fetched, akin to getting verbal news of an event far away.










  14. #34

    Default Re: Creating a World - Disasters and the add_events command

    If you just do toggle_fow, add_events, then toggle_fow again, there is no "global reveal" really. It's instantaneous so none of the map is revealed to the player. I'm actually surprised toggle_fow works for this purpose. But I see what you're saying - it makes more sense to see the smoke coming from a settlement than from a blank spot on the map.



    I've been testing some of the disaster events using a shortcut script to add the event repeatedly (there doesn't seem to be any limit on the number of disasters you can create in a turn). The volcano effects appears to have two modes depending on scale factor. For scale 1-4, there is no message (if you supply no custom), low casualties within a small radius of ~2 tiles. For scale 5-9, there is a generic message, high casualties, and a larger radius of ~6 tiles. From what I can tell, the actual value of the scale factor within those ranges doesn't matter, all the matters is which range it's in. Settlements can suffer civilian casualties if the settlement is within the radius. Buildings aren't damaged. Characters within the radius have a pretty high chance of dying that appears to depend somewhat on the scale but is pretty high even at low scales. At scale 9, characters are basically guaranteed to die.
    Last edited by Callistonian; March 08, 2022 at 05:23 AM.

  15. #35
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,132
    Blog Entries
    35

    Default Re: Creating a World - Disasters and the add_events command

    Toggling FoW will reveal every single settlement on the map which will leave it visible under the fog of war - that's what I meant with 'global'.

    Thanks for the feed back on the volcano setting. I linked to the post in the OP.










  16. #36
    Jurand of Cracow's Avatar History and gameplay!
    Join Date
    Oct 2012
    Location
    Cracovia
    Posts
    8,494

    Default Re: Creating a World - Disasters and the add_events command

    Interestingly, such coding:
    Code:
        monitor_event SettlementSelected TrueCondition
    
        log -------------------------------------------------------------------- 0 STARTING INFO
        
            if not I_IsFactionAIControlled poland
                ;------------------------------------- log POLAND info
                disable_cursor
                hide_ui
                zoom_strat_camera 1
                campaign_wait 0.5
                move_strat_camera 214, 217
                campaign_wait 2
                ui_flash_stop
                show_ui
                enable_cursor
                campaign_wait 0.2
                historic_event POLAND0_STARTING_INFO
                terminate_monitor            
            end_if
            
        end_monitor
    
        monitor_event SettlementSelected TrueCondition
            and I_TurnNumber > 2
            
        log -------------------------------------------------------------------- 1 REFORMS
        
            if not I_IsFactionAIControlled poland
                ;------------------------------------- log POLAND reforms
                disable_cursor
                hide_ui
                zoom_strat_camera 1
                campaign_wait 0.5
                move_strat_camera 214, 216
                campaign_wait 2        
                ui_flash_stop
                show_ui
                enable_cursor
                campaign_wait 0.2            
                historic_event POLAND1_REFORMS_INFO        
                terminate_monitor            
            end_if
            
        end_monitor
    produces a following result: the first info pops out after the player clicks on any of the settlements (and the view is duly centered, ui disabled etc), but the second doesn't - it does at the beginning of the following turn (in this case turn 4), so the view is centered (but I haven't noticed ui disabled) and the message pops out among all other messages.

    The culprit is the second condition because the first info starts behaving in the same way when I add at the first monitor also that one. But: then the second one works properly 0 even with condition "and I_TurnNumber == 2"
    Code:
        monitor_event SettlementSelected TrueCondition
            and I_TurnNumber == 1
        log -------------------------------------------------------------------- 0 STARTING INFO
        
            if not I_IsFactionAIControlled poland
                ;------------------------------------- log POLAND info
                disable_cursor
                hide_ui
                zoom_strat_camera 1
                campaign_wait 0.5
                move_strat_camera 214, 217
                campaign_wait 2
                ui_flash_stop
                show_ui
                enable_cursor
                campaign_wait 0.2
                historic_event POLAND0_STARTING_INFO
                terminate_monitor            
            end_if
    .......
    
        monitor_event SettlementSelected TrueCondition
            and I_TurnNumber == 2
            
        log -------------------------------------------------------------------- 1 REFORMS
        
            if not I_IsFactionAIControlled poland
                ;------------------------------------- log POLAND reforms
                disable_cursor
                hide_ui
                zoom_strat_camera 1
                campaign_wait 0.5
                move_strat_camera 214, 216
                campaign_wait 2        
                ui_flash_stop
                show_ui
                enable_cursor
                campaign_wait 0.2            
                historic_event POLAND1_REFORMS_INFO        
                terminate_monitor            
            end_if
    But there're many quirks... This army spawned with the name different than the list for the Polish faction. Afaik, it shouldn't but... Furthermore, the reveal command doesn't reveal the army. Maybe it hasn't been created yet?
    Code:
            if I_EventCounter is_the_player = 1                            ; only for the player        and RandomPercent < 66
            and I_EventCounter DifficultyLevel > 2                        ; only for H/VH difficulties
            and I_EventCounter poland5_council_of_leczyca_player < 1    ; no more resistance for Poland after this reform
    
                spawn_army
                    faction slave, sub_faction poland
                        character random_name, named character, age 32, x 184, y 228
                        traits CounterOfBattles 4, NaturalMilitarySkill 2 , GoodCommander 1 , Hardened 1 , StrategyDread 1 , Feck 4 , BattleScarred 3 , Xenophobia 3
                        unit    EE Bodyguard        exp 1 armour 1 weapon_lvl 0
                        unit    Scouts                exp 7 armour 1 weapon_lvl 0
                        unit    Woodsmen            exp 7 armour 0 weapon_lvl 0
                        unit    Woodsmen            exp 0 armour 0 weapon_lvl 0
                        unit    Slav Levies            exp 7 armour 1 weapon_lvl 0
                        unit    Slav Levies            exp 0 armour 0 weapon_lvl 0
                        unit    Slavic Javelinmen    exp 1 armour 0 weapon_lvl 0
                        unit    Hunters                exp 7 armour 0 weapon_lvl 0
                        unit    Hunters                exp 0 armour 0 weapon_lvl 0                
                end
    
                if I_EventCounter is_the_player > 0
                    historic_event SETTLEMENT_CAPTURE_REBELLION
                    reveal_tile 184, 228
                    move_strat_camera 184, 228
                end_if
    Last edited by Jurand of Cracow; March 08, 2022 at 11:06 PM.

  17. #37
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,132
    Blog Entries
    35

    Default Re: Creating a World - Disasters and the add_events command

    Well, the first monitor has no turn condition hence it will fire at the first settlement the player selects, the second has turn>2 and correctly fires in round 4 (turn3=round4). By that time you will always have generic and custom messages to some degree that will appear at turn start.

    The UI will only be disabled for the period of the move to the camera's target, which depends on the map windows position when the message gets triggered.










  18. #38
    Jurand of Cracow's Avatar History and gameplay!
    Join Date
    Oct 2012
    Location
    Cracovia
    Posts
    8,494

    Default Re: Creating a World - Disasters and the add_events command

    My point is slightly different: the SettlementSelected fires in the first instance (the monitor starts once I click on a settlement), but the second monitors fires not when I clic on the settlement, but before start of my turn. I'd conclude that you can have only one SettlementSelected monitor (per settlement? for all?) firing in a game - maybe once it fires, all other fire at the beginnig of turn when the secon condition (in this case: TurnNumber) is fullfiled?

  19. #39

    Default Re: Creating a World - Disasters and the add_events command

    @Gigantus - toggle_fow does not permanently reveal every settlement (or fort, resource, port, etc.) on the map. It is not equivalent to using reveal_tile for every tile.

    @Jurand - You're still using redundant terminating monitors for the same event. It should be one non-terminating SettlementSelected monitor broken down into if-blocks based on which faction's turn it is, then by whether or not the faction is AI-controlled, then by whatever else you need (e.g. turn number).

    Code:
    monitor_event SettlementSelected TrueCondition
       if I_EventCounter faction_turn_poland == 1 ;set to 1 during poland's turn using a PreFactionTurnStart monitor, set to 0 using the FactionTurnEnd monitor like in the other thread
          if not I_IsFactionAIControlled poland
             if I_TurnNumber == 0 ;display turn 1
                if not I_EventCounter POLAND_STARTING_INFO > 0 ;to prevent infinite looping every time the player selects a settlement on turn 1
                   ;do stuff
                end_if
             end_if
             if I_TurnNumber == 1 ;display turn 2
                if not I_EventCounter POLAND_REFORMS_INFO > 0
                   ;do stuff
                end_if
             end_if
          end_if
       end_if
    end_monitor
    I can't explain your observation of the second monitor firing at the start of your turn instead of when you select a settlement except by guessing that a settlement is being selected without your knowledge. The AI can't select settlements but you can force select settlements in script, maybe you're using select_settlement or e_select_settlement elsewhere in script? Your conclusion about the SettlementSelected event only working once is incorrect, something else is going on there. But if you use my code above it will work.

    In your last bit of code where you spawn the army, the sub_faction tag doesn't work in campaign_script which is why the random_name pulls from the slave faction male name list. Your condition 'if I_EventCounter is_the_player > 1' is superfluous because it's inside an if-block that already tests if that counter == 1. The reveal_tile command does reveal armies and whatever else is on the tile and it will continue to reveal that tile for the rest of the campaign unless you issue hide_all_revealed_tiles. My suspicion is that you're issuing hide_all_reveal_tiles somewhere else in script which will make armies, fleets, agents, etc. disappear under fog as they're not permanent fixtures on the map. A final note about reveal_tile, if you're going to use it for a whole bunch of tiles at once, I recommend putting a 'campaign_wait 0.1' before the reveal commands to prevent a mysterious CTD.

  20. #40
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,132
    Blog Entries
    35

    Default Re: Creating a World - Disasters and the add_events command

    toggle_fow - thanks, I was under the wrong impression then.










Page 2 of 5 FirstFirst 12345 LastLast

Tags for this Thread

Posting Permissions

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