Page 4 of 5 FirstFirst 12345 LastLast
Results 61 to 80 of 99

Thread: Yes/No Event Tutorial

Hybrid View

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

    Default Re: Yes/No Event Tutorial

    monitor_event I_EventCounter bongo_ask_accepted = 1
    Wrong syntax. I don't know what new to say. Two people have warned you not to use bongo_ask_accepted and bongo_ask_declined as historic event names but you're still doing it. And I gave a script (the second one) that completely fixes all of the problems of your script but you're still doing it your way. Maybe neither of those things fixes your original problem but at least they're moving forward; here we're just going in circles.

  2. #2
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Yes/No Event Tutorial

    Quote Originally Posted by tedster1995 View Post
    Okay i'm just getting crash after crash after crash with this and all i'm getting from the logs is two lines
    You do not appear to take to advice too well:

    monitor_event I_EventCounter bongo_ask_accepted = 1
    I_EventCounter is not an event, it's a condition.

    The set up from Withnwhar's second example is the correct way:

    monitor_event EventCounter EventCounterType bongo_ask_accepted
    and EventCounter = 1










  3. #3

    Default Re: Yes/No Event Tutorial

    Sorry that was my fault I pasted the old script in instead of the new one I made from @withnars advice, sorry my bad , cannot believe I didn't notice that.

    Here is the actual i'm using now

    Code:
    monitor_event FactionTurnStart FactionType sheikah
      and I_TurnNumber = 3
      if not I_IsFactionAIControlled sheikah
        historic_event bongo_ask true
      end_if
    terminate_monitor
    end_monitor
    monitor_event EventCounter EventCounterType bongo_ask_accepted
      and EventCounter = 1
      
      historic_event ask_bongo_yes
      set_event_counter sheikah_under_agahnim 1
      set_event_counter disable_stance 1
      
    terminate_monitor
    end_monitor
    monitor_event EventCounter EventCounterType bongo_ask_declined
      and EventCounter = 1
      
      historic_event ask_bongo_no
     set_event_counter offer_rejected 1
    terminate_monitor
    end_monitor
    all that's happening now is that it crashes whenever I try to start as the sheikah faction. I can't seem to find anything in the logs, but as you have seen I'm virtually blind so I could have missed something but I'm not sure what.
    Last edited by tedster1995; August 20, 2014 at 08:44 AM.

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

    Default Re: Yes/No Event Tutorial

    Quote Originally Posted by tedster1995 View Post
    it crashes whenever I try to start as the sheikah faction.
    It crashes at campaign start do you mean? I doubt that this script has anything to do with that. Take this script out altogether and see if it still crashes. If it does then your problem lies elsewhere.

  5. #5

    Default Re: Yes/No Event Tutorial

    Hmmm well it didn't crash without the script, but it did with the original script I did nothing to, hmmmm ill try uninstalling it and reinstall see if that works

  6. #6

    Default Re: Yes/No Event Tutorial

    Okay really confused now, reinstalled the faction started fine, I add my files. I chose the faction it finishes loading then it crashes, I replace with the original unedited files it still crashes I'm sort of lost here.

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

    Default Re: Yes/No Event Tutorial

    As it has nothing to do with this Yes/No event tutorial it would be best to ask for help on it somewhere else.

  8. #8
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Yes/No Event Tutorial

    I'll just simply plop this single monitor yes\no event here. Don't think it will need additional explanations, picture and text issues are the same as usual:

    Code:
        monitor_event [event and condition]
           
                historic_event [name of event] true
    
                ; while-loop pauses the monitor until a decision is made
                while I_EventCounter [name of event]_accepted = 0
                    and I_EventCounter [name of event]_declined = 0
                end_while
                
                ; YES decision made
                if I_EventCounter [name of event]_accepted = 1
                    [ do your stuff]
                    terminate_monitor
                end_if
                
                ; NO decision made
                if I_EventCounter [name of event]_declined = 1
                    [ do your stuff]
                    terminate_monitor
                end_if
        end_monitor










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

    Default Re: Yes/No Event Tutorial

    It's more concise though personally I'm not a big fan because a while loop is just as bad as a monitor_conditions - although in this case at least the while loop is only lasting a short while.

    But there's a problem. If the game is saved at a point between the question being asked (historic_event) and being answered (accept/decline clicked) then, upon that save being loaded, the while loop will resume and go on forever: the question will never be answered because the game will not re-ask the question, and the while loop will be chewing up resources for the rest of the campaign. To avoid that, add another monitor...

    Code:
    monitor_event GameReloaded
    
      if I_EventCounter [name of event] > 0
        and I_EventCounter [name of event]_accepted = 0
        and I_EventCounter [name of event]_declined = 0
    
        ;the question has been asked but not yet answered: re-ask
        campaign_wait 0.1
        historic_event [name of event] true
    
      end_if
    
    end_monitor
    Some discussion on this here: http://www.twcenter.net/forums/showt...-Yes-No-Events

    EDIT: to clarify, the "unanswered question upon reload" problem affects all yes/no events no matter what script mechanism is used to handle the answering. My main point was that this particular script introduces the additional problem of the while loop going on forever.
    Last edited by Withwnar; June 16, 2015 at 05:11 AM.

  10. #10
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Yes/No Event Tutorial

    Ah yes, I vaguely remember that - thanks for the fail safe.










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

    Default Re: Yes/No Event Tutorial

    No worries. Writing an additional two monitors to handle the answer is a pain, so I get where you're coming from.

    I had just edited my previous post, by the way.

  12. #12
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Yes/No Event Tutorial

    Tagging along a single GameReloaded monitor to handle all yes\no events is no issue - although you have to admit that the probability of the situation arising is infinitesimally small.










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

    Default Re: Yes/No Event Tutorial

    I think that the probability is quite high. People often save the game at the start of a new turn, before even reading the event scrolls - not to mention responding to them. That's all it takes, if the historic event was displayed at a turn start (which they usually are). I think that it would apply to Autosaves as well ... they save at the start of the turn, right? Or is it the end of the turn? I can't remember.

  14. #14
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Yes/No Event Tutorial

    My bad - I was thinking from the perspective of having the message right in front of you. Saving at the beginning of a turn will obviously effect this.
    Autosave is at the end of the turn if I am not mistaken.










  15. #15

    Default Re: Yes/No Event Tutorial

    Bit of an old thread, but i was wondering if you could help me figure out what I'm missing here.

    I'm trying to reach Lando Calrissian! Wait? No that's not right, oh yer now i remember!
    I am trying to give the player an opportunity to form the Kalmar Union:
    Spoiler Alert, click show to read: 
    Code:
        ;######################### HKoK Stage 3 #########################
        
        declare_counter extra_money_offered
        
        monitor_event FactionTurnStart FactionType denmark
            and I_LocalFaction denmark
            and I_CompareCounter extra_money_offered = 0
            
            add_events
                event counter extra_money_accepted
                event counter extra_money_declined
            end_add_events
            
            historic_event kalmar_question true
            set_counter extra_money_offered 1
            
            terminate_monitor
        end_monitor
        
        ;######################### HKoK Accepted #########################
        
        declare_counter extra_money_accepted
        
        monitor_conditions I_EventCounter extra_money_accepted = 1
            
            add_money Denmark 20000
            historic_event kalmar_question_accepted true
            historic_event kalmar_now true
            
            terminate_monitor
        end_monitor
        
        ;######################### HKoK Declined #########################
        
        declare_counter extra_money_declined
        
        monitor_conditions I_EventCounter extra_money_declined = 1
            
            add_money Denmark -20000
            historic_event kalmar_question_declined
            
            set_counter extra_money_declined 1
            
            terminate_monitor
        end_monitor

  16. #16
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Yes/No Event Tutorial

    You misunderstood how the yes\no coding works, it's the 'true' after the historic event that starts it all:

    historic_event kalmar_question true

    The choice then decides whether the decline or accept event counter will be set to 1 - this is what you then test.

    Code:
        monitor_event ....
                historic_event the_big_question true            ; yes\no message pop up
            while I_EventCounter the_big_question_accepted = 0    ; while-loop to pause the script until a decision is made
                and I_EventCounter the_big_question_declined = 0
            end_while
            if I_EventCounter the_big_question_accepted = 1
                ; do stuff
                set_event_counter the_big_question_accepted 0    ;resetting for next use
            end_if
            if I_EventCounter the_big_question_declined = 1
                ; do stuff
                set_event_counter the_big_question_declined 0    ;resetting for next use
            end_if
            set_event_counter the_big_question 0    ;resetting for next use
            terminate_monitor        ; terminate if single use
        end_monitor
    There is no need to use add_events to set event_counters: they are deemed to exist already set to zero. Which means you could test for them without declaring them.
    Last edited by Gigantus; February 23, 2017 at 06:21 AM.










  17. #17

    Default Re: Yes/No Event Tutorial

    I'm not sure i understand.

    I copied your code into the Campaign_script, but the event doesn't appear?

    I don't seem to be able to create a yes/no event, the choice never appears,
    if i get it to show me the event, it only gives me the opportunity to "acknowledge" it

  18. #18
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Yes/No Event Tutorial

    This yes\no event is a kingdoms feature - which means you require the descr_event_images file from a kingdoms campaign for this to work. The easiest way is to copy it from my Bare Geomod installation.
    Make sure the text for the message is present in data\text\historic_events. If it still doesn't work then copy your code here for me to have a look.
    Last edited by Gigantus; February 23, 2017 at 08:12 AM.










  19. #19

    Default Re: Yes/No Event Tutorial

    Okay, nothing you say seem to make any sense =D (not your fault)

    I had the original Descr_event_images from mods/Teutonic (there was the possibility to write yes/no events)

    I don't understand how the 2 files work together.. Hmm, have you ever wondered about making some instructional videos?
    It sometimes helps to SEE how the files are cooperating.

    This is my code, everything is as i wanted, except the part about yes/no events (stage 3):

    Spoiler Alert, click show to read: 
    Code:
        ;###########################################################
        ;################### HIGH KING OF KALMAR ###################
        ;###########################################################
        
        ;######################### HKoK Stage 1 #########################
        
        monitor_event FactionTurnStart FactionType denmark
            and I_TurnNumber = 0
            
            historic_event kalmar_notification factions { denmark, }
            
            terminate_monitor
            
        end_monitor
        
        ;######################### HKoK Stage 2 #########################
        
        monitor_event FactionTurnStart FactionType denmark
            and I_TurnNumber > 1
            and I_SettlementOwner Arhus denmark
            and I_SettlementOwner Stockholm denmark
            and I_SettlementOwner Oslo denmark
            and I_SettlementOwner Helsinki denmark
            and I_SettlementOwner Kalmar denmark
            
            historic_event kalmar_stage2 factions { denmark, }
            
            terminate_monitor        
            
            end_if
        
        end_monitor
        
        ;######################### HKoK Stage 3 #########################
        
        monitor_event FactionTurnStart FactionType denmark
            historic_event mission_issued true            ; yes\no message pop up
        while I_EventCounter mission_issued_accepted = 0    ; while-loop to pause the script until a decision is made
            and I_EventCounter mission_issued_declined = 0
        end_while
        if I_EventCounter mission_issued_accepted = 1
            ; do stuff
            set_event_counter mission_issued_accepted 0    ;resetting for next use
        end_if
        if I_EventCounter mission_issued_declined = 1
            ; do stuff
        set_event_counter mission_issued_declined 0    ;resetting for next use
        end_if
        set_event_counter mission_issued 0    ;resetting for next use
        terminate_monitor        ; terminate if single use
        end_monitor
        
        ;######################### HKoK Traits & Ancillaries #########################
        monitor_event CharacterSelected CharacterIsLocal
            and I_TurnNumber > 8
            and I_EventCounter extra_money_accepted = 1                               ;(this is just whatever the former counter is, or can just be removed)
            and IsFactionLeader
            and I_SettlementOwner Arhus denmark
            and I_SettlementOwner Stockholm denmark
            and I_SettlementOwner Oslo denmark
            and I_SettlementOwner Helsinki denmark
            and not FactionwideAncillaryExists HK_Kalmar
            
            console_command remove_ancillary this Duke_Denmark
            console_command remove_ancillary this Duke_Sweden
            console_command remove_ancillary this Duke_Norway
            console_command remove_ancillary this Duke_Finland
            console_command give_ancillary this HK_Kalmar
            console_command give_trait this HKKalmar 3
            
            historic_event kalmar_union event/kalmar_union.bik
            
        end_monitor
        
        monitor_event CharacterSelected CharacterIsLocal
            and FactionwideAncillaryExists HK_Kalmar
            and FactionwideAncillaryExists Duke_Denmark
            
            console_command remove_ancillary this Duke_Denmark
        end_monitor
        
        monitor_event CharacterSelected CharacterIsLocal
            and FactionwideAncillaryExists HK_Kalmar
            and FactionwideAncillaryExists Duke_Sweden
            
            console_command remove_ancillary this Duke_Sweden
        end_monitor
        
        monitor_event CharacterSelected CharacterIsLocal
            and FactionwideAncillaryExists HK_Kalmar
            and FactionwideAncillaryExists Duke_Norway
            
            console_command remove_ancillary this Duke_Norway
        end_monitor
        
        monitor_event CharacterSelected CharacterIsLocal
            and FactionwideAncillaryExists HK_Kalmar
            and FactionwideAncillaryExists Duke_Finland
            
            console_command remove_ancillary this Duke_Finland
        end_monitor


    So, again, basically Stage 3 is the part were i want a simple Yes/No question, which will result in the sending of a historic event message

  20. #20
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Yes/No Event Tutorial

    I inserted your code into my Bare Geomod set up with some minor changes (faction, event message, add money at acceptance) and had no problems whatsoever. I also disabled the terminate line and it worked in the next round as well. To test if there is an error somewhere else in the script make a copy of your script file and then delete it's content completely, then copy the code from below into it. Then start a campaign with england.
    Code:
    script
    
        restrict_strat_radar false    ; removes mini map restriction
    
        monitor_event FactionTurnStart FactionType england
            historic_event mission_issued true                  ; yes\no message pop up
            while I_EventCounter mission_issued_accepted = 0    ; while-loop to pause the script until a decision is made
                and I_EventCounter mission_issued_declined = 0
            end_while
            if I_EventCounter mission_issued_accepted = 1
                add_money england 1200
                set_event_counter mission_issued_accepted 0    ;resetting for next use
            end_if
            if I_EventCounter mission_issued_declined = 1
                ; do stuff
                set_event_counter mission_issued_declined 0    ;resetting for next use
            end_if
            set_event_counter mission_issued_issued 0          ;resetting for next use
            ;    terminate_monitor                              ; terminate if single use
        end_monitor
    
        ; keep script unfinised until last monitor termination
        wait_monitors
    
    end_script
    Note: in your script you should have gotten the kalmar notification message first and then right after it the mission issued message as both have the simple turnstart condition.










Page 4 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
  •