Results 1 to 6 of 6

Thread: Unhandled events question

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Unhandled events question

    Hi, I have a question about unhandled historic events.

    I will explain what I mean with unhandled, using this example.

    1. An historic event is fired

      Code:
      historic_event ask_this true
    2. For some reason I reload my game without accepting or declining the event.
    3. When the game is reloaded the historic_event wont fire up again and whatever I was trying to do with the event is lost forever.


    Is there a way to fire up the historic_event again if the game is realoaded and the event isn't handled?

  2. #2
    Kiliç Alì's Avatar Domesticus
    Artifex

    Join Date
    Feb 2011
    Location
    Italy
    Posts
    2,114

    Default Re: Unhandled events question

    no. If you save\reload a yes\no event, event is considered "declined" by the engine. IIRC exceptions are the papal election and marriage\adoption proposals, wich are not events howewer

    EDIT solution is not save-compatible, you should edit the campaign_script so it fires multiple times if it is declined.

    declare_counter timer

    monitor [... the conditions of the main event]
    and I_CompareCounter timer = 0
    ...
    historic_event ask_this true
    set_counter timer 1
    end_monitor

    DO NOT USE THE terminate_monitor CALL OR IT WILL NEVER FIRE AGAIN!

    monitor_event FactionTurnEnd FactionType slave
    if I_CompareCounter timer < x [put a number]
    and I_CompareCounter timer >= 1
    inc_counter timer 1
    end_if
    if I_CompareCounter timer = x
    set_counter timer 0
    end_if
    end_monitor
    Last edited by Kiliç Alì; February 07, 2012 at 02:32 PM.

    Member of the Imperial House of Hader, proud client of The only and sole Ferrit

  3. #3

    Default Re: Unhandled events question

    Thanks for the answer!

    To bad there is no cleaner way to this without have to use more counters.

    I'm trying to fire this within a specific turn, firing it in a difrerent turn would not return the spected results.

    Edit:

    I tried something similar as your suggestion and worked (at least for autosaves ), thank you!

    Code:
    while I_CompareCounter event_handler < 3
    	wait 1
    		if I_CompareCounter event_handler = 2
    			historic_event ask_this true
    		end_if
    	inc_counter event_handler 1
    end_while
    set_counter event_handler 0
    If I reload an autosave it'll fire up the event again.
    Last edited by proximusj; February 07, 2012 at 03:43 PM.

  4. #4
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default Re: Unhandled events question

    Quote Originally Posted by Kiliç Alì View Post
    If you save\reload a yes\no event, event is considered "declined" by the engine.
    I think it is more a case of: when you reload it is not retriggering the monitor that asked the question. The question has been asked (before the save) but it has not been answered. So on reload it is not "declined"; rather just "not accepted": the accepted monitor has not fired. i.e. Neither declined nor accepted, as though the question had never been asked.

    If you have a monitor to handle the "declined" case then does it fire when you reload? I don't know but I suspect not. Which means that both the accepted and declined monitors are sitting there, unfired, still waiting for the question to be answered.

    If the asking is done in something like "FactionTurnStart where TurnNumber = x" then it will never be asked again.

    Another solution might be: instead of this...

    Code:
    monitor_event FactionTurnStart [conditions]
    
      historic_event ask_this true
    
    terminate_monitor
    end_monitor
    
    monitor_event EventCounter EventCounterType ask_this_accepted
      and EventCounter > 0
      
      ;do "accepted" stuff
      
    terminate_monitor
    end_monitor
    
    monitor_event EventCounter EventCounterType ask_this_declined
      and EventCounter > 0
      
      ;do "declined" stuff
      
    terminate_monitor
    end_monitor
    ...it could do this...

    Code:
    set_event_counter ask_this_trigger 0
    
    ;A
    monitor_event FactionTurnStart [conditions]
    
      set_event_counter ask_this_trigger 1
    
    terminate_monitor
    end_monitor
    
    ;B
    monitor_event EventCounter EventCounterType ask_this_trigger
      and EventCounter > 0
      
      historic_event ask_this true
      
    ;do not terminate!
    end_monitor
    
    ;C
    monitor_event GameReloaded TrueCondition
    
      if I_EventCounter ask_this_trigger == 1
        set_event_counter ask_this_trigger 0
        set_event_counter ask_this_trigger 1
      end_if
    
    end_monitor
    
    ;D
    monitor_event EventCounter EventCounterType ask_this_accepted
      and EventCounter > 0
      
      ;do "accepted" stuff
      
      set_event_counter ask_this_trigger 0
      
    terminate_monitor
    end_monitor
    
    ;E
    monitor_event EventCounter EventCounterType ask_this_declined
      and EventCounter > 0
      
      ;do "declined" stuff
      
      set_event_counter ask_this_trigger 0
      
    terminate_monitor
    end_monitor
    Rather than doing the historic_event from the main trigger monitor (A), do it from another monitor (B) that is triggered by both the first monitor (A) and another one that fires when the game is loaded (C). The accept/decline monitors flag it as "answered, do not ask again" by setting the counter back to zero.

    So until Yes/No is clicked ask_this_trigger remains as 1, which C is testing for: at that point it resets it to 1 (0 then 1) to retrigger B.
    Last edited by Withwnar; February 07, 2012 at 10:51 PM.

  5. #5
    Kiliç Alì's Avatar Domesticus
    Artifex

    Join Date
    Feb 2011
    Location
    Italy
    Posts
    2,114

    Default Re: Unhandled events question

    Thanks for this, gives me a lot of things to think

    Member of the Imperial House of Hader, proud client of The only and sole Ferrit

  6. #6
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default Re: Unhandled events question

    It's all speculation and theory, mind.

Posting Permissions

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