Results 1 to 5 of 5

Thread: Problem with scripting an accept/decline decision

  1. #1

    Default Problem with scripting an accept/decline decision

    Code:
    declare_counter anglicization_offered
    monitor_event FactionTurnStart FactionType scotland
    and not IsFactionAIControlled
    and I_TurnNumber >= 2
    and I_CompareCounter anglicization_offered = 0
     add_events
     event counter anglicization_accepted
     event counter anglicization_declined
     end_add_events
     historic_event anglicization true factions { scotland, }
     set_counter anglicization_offered 1
    terminate_monitor
    end_monitor
    ;----------------- accept ------------------------------------
    monitor_conditions I_EventCounter anglicization_accepted = 1
    and I_LocalFaction scotland
    move_strat_camera 280, 50
    terminate_monitor
    end_monitor
    ;------------------ reject ------------------------------------
    declare_counter union_rejected
    monitor_conditions I_EventCounter anglicization_declined = 1
    and I_LocalFaction scotland
     set_counter anglicization_declined 1
    terminate_monitor
    end_monitor
    Hmm... I can't use the enter button to skip down a line anymore since the update here, so sorry for the lack of paragraphs and spacing. But my problem is with the above text in campaign_script. I've had some success with scripting, changing settlements names upon being conquered etc. But with the above, what I wanted to do was offer a human player playing as Scotland the option to Anglicize. The idea was to have a message pop up which they could accept or decline, and if they accept it, their settlement names would change from Gaelic to English form. If you are wondering why these effects aren't in it, I just left the camero shift there to test if the framework I had was working. Sadly it isn't, since upon the second turn when this script activates, I get a CTD. My attempt there is based upon a TATW script that offered the player an accept/decline decision. But it's really hard to find info on how to do this. Any ideas where I've gone wrong? ***EDIT*** I removed the historic event line, and that stopped the CTD, but nothing triggers at all at the end of turn 2 now.
    Last edited by Caledonian Rhyfelwyr; March 14, 2013 at 02:06 PM.

  2. #2
    Den Stark's Avatar Tiro
    Join Date
    May 2012
    Location
    Vladivostok
    Posts
    248

    Default Re: Problem with scripting an accept/decline decision

    may be so?.. :

    EDIT: wrong copy )
    Last edited by Den Stark; March 14, 2013 at 02:19 PM.

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

    Default Re: Problem with scripting an accept/decline decision

    historic_event is the message, true is what makes it a yes/no. You need to add an entry in historic_event.txt otherwise it CTDs.

    That script can be much simplified and there's a better way without using monitor_conditions...

    Code:
    monitor_event FactionTurnStart FactionType scotland
      and not IsFactionAIControlled
      and I_TurnNumber >= 2
    
      historic_event anglicization true factions { scotland, }
     
    terminate_monitor
    end_monitor
    
    ;----------------- accept ------------------------------------
    monitor_event EventCounter EventCounterType anglicization_accepted
      and EventCounter = 1
     
      ;do your stuff here
    
    terminate_monitor
    end_monitor
    ...assuming that you only want it to ask once and nothing happens if they decline.
    Last edited by Withwnar; March 14, 2013 at 10:06 PM.

  4. #4

    Default Re: Problem with scripting an accept/decline decision

    That's solved it, thanks!

  5. #5
    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: Problem with scripting an accept/decline decision

    See here: Yes/No Event Tutorial (although Wthnwar sample is the by no used standard)










Posting Permissions

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