1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. Photobucket has changed its policy concerning hotlinking images and now requires an account with a $399.00 annual fee to allow hotlink. More information is available at: this link.
    Dismiss Notice
  3. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  4. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  5. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  6. Dismiss Notice
  7. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

Modding game so Quick Movement would be active only in AI turn. Is this possible?

Discussion in 'Civ5 - Creation & Customization' started by jcraft, Jul 25, 2013.

  1. jcraft

    jcraft Chieftain

    Joined:
    Jul 22, 2013
    Messages:
    5
    This is just purely aesthetics (and performance also) issue.

    Somewhat around mid-game AI turns are starting to take really long time if Quick Movement is not turned on in options (well, at least on my PC) and I really like to watch animations of my units moving around the map :), but also don't want to wait forever until AI players finish their turns, and going every time before ending and after starting my turn to options and changing QM setting is not most convenient solution to my "problem".

    So I'm curious if it would be possible to mod it that every time when human player turn ends QM option is set automatically to ON and when human player starts his turn option is set to OFF.

    EDIT: Or at least adding a possibility to toggle this option on game main screen would be already a major convenience (for example through a button near minimap)

    I would be really grateful if someone come up with idea how to do that :D

    (non-native English speaker here, so sorry for all errors)
     
  2. jcraft

    jcraft Chieftain

    Joined:
    Jul 22, 2013
    Messages:
    5
    Come on, give me something - I don't believe it is impossible to do :)
     
  3. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    6,456
    Location:
    France
    Should be possible with a bit of Lua, using something like that (untested)

    Code:
    GameEvents.PlayerDoTurn.Add(function(iPlayer) 
    	local pPlayer = Players[iPlayer]
    	if (pPlayer) then
    		OptionsManager.SetSinglePlayerQuickMovementEnabled_Cached(not pPlayer:IsHuman())
    	end
    end)
    
     
  4. jcraft

    jcraft Chieftain

    Joined:
    Jul 22, 2013
    Messages:
    5
    Hmm, its seems that it not want to work... or maybe I'm doing something wrong (I'm still rather a newb when it comes to modding CIV5).

    Is there something particular I should do with this code to get it working?


    EDIT
    Ok, I figured it out, come up with rather different solution but it is working now. Thanks for help :)
     
  5. Maguyver

    Maguyver Chieftain

    Joined:
    Jul 29, 2013
    Messages:
    72
    Location:
    Pittsburgh
    jcraft, would you mind sharing the working code please? This would definitely help me out a great deal as well because I routinely play with the maximum number of Civs and/or City-States on huge maps.

    Thank you. :)
     
  6. jcraft

    jcraft Chieftain

    Joined:
    Jul 22, 2013
    Messages:
    5
    Keep in mind that is for now just a simple lua file edit not a proper mod, I will try later to make it that way in which it would not modify core game files but for now here what is it.

    Go to Civilization V root directory. Go into Assets/UI/Ingame, there is a file: TurnProcessing.lua open it with Notepad or some other text editor (I personally recommend Notepad++ :)), and here's what you must do next (make backup of this file first of course):

    In the file find this line - local ms_IsShowingMinorCiv = false; and below it paste this code:
    Code:
    -------------------------------------------------
    -- QuickMovement toggle functions
    -------------------------------------------------
    function ToggleQuickMovementON()
    	
    	local options = {};
    	table.insert(options, { "GAMEOPTION_QUICK_MOVEMENT", true });
    	Network.SendGameOptions(options);
    end
    
    function ToggleQuickMovementOFF()
    
    	local options = {};
    	table.insert(options, { "GAMEOPTION_QUICK_MOVEMENT", false });
    	Network.SendGameOptions(options);
    end
    Then find this line - Events.AIProcessingStartedForPlayer.Add( OnAITurnStart ); and above it paste this:
    Code:
    Events.AIProcessingStartedForPlayer.Add( ToggleQuickMovementON );
    Then you must find this two lines:
    Code:
    Events.ActivePlayerTurnStart.Add( OnPlayerTurnStart );
    Events.RemotePlayerTurnStart.Add( OnPlayerTurnStart );
    And then make it to look that way:
    Code:
    Events.ActivePlayerTurnStart.Add( ToggleQuickMovementOFF );
    Events.ActivePlayerTurnStart.Add( OnPlayerTurnStart );
    Events.RemotePlayerTurnStart.Add( ToggleQuickMovementOFF );
    Events.RemotePlayerTurnStart.Add( OnPlayerTurnStart );
    And thats all, just save the changes and play the game.

    I didn't tested it properly yet but it seemed to work perfectly last time :) (tested on latest version of CIV5 with BNW installed)

    EDIT: And here's the full modified file just in case - http://pastebin.com/XWUc2Zby
    EDIT2: The easiest way to test if its working is to turn on Quick Movement in options and then ending turn, if everything is working correctly when next turn starts Quick Movement should be automatically turned off.
     
  7. Maguyver

    Maguyver Chieftain

    Joined:
    Jul 29, 2013
    Messages:
    72
    Location:
    Pittsburgh
    Thank you! I was going to come home and write it up as a proper mod, however the motivation has left me for tonight. :lol:

    If I finish it before you do I will post it here.
     
  8. jcraft

    jcraft Chieftain

    Joined:
    Jul 22, 2013
    Messages:
    5
    Made it into a proper mod. Seems to be working without any problems.

    Download in attachment.
     

    Attached Files:

  9. tedoll78

    tedoll78 aka 'HylianTom' :)

    Joined:
    Apr 27, 2011
    Messages:
    138
    Location:
    New Orleans!
    jcraft (et al.), I wanted to thank you for this mod. I played a huge map/22-civ marathon game this weekend on my somewhere-between-minimum-and-recommended-spec'd computer, and your mod made quite a noticeable difference in turn times, especially in later eras.

    If anyone is considering this mod, I'd classify it as essential. Many thanks again! :goodjob:
     
  10. Neirai

    Neirai the Forgiven

    Joined:
    Aug 5, 2013
    Messages:
    963
    Location:
    Canada
    Definitely (if you can) throw this one up on Steam, too :)

    That way I can subscribe for life.
     
  11. Dark_Jedi06

    Dark_Jedi06 "Deus ex Machina."

    Joined:
    Jul 19, 2006
    Messages:
    1,287
    Gender:
    Male
    Thank you! I was just thinking how much I wanted a mod like this and then stumbled upon this thread. :D
     
  12. Qoma

    Qoma Chieftain

    Joined:
    Dec 12, 2012
    Messages:
    137
    Wow, this is actually a fantastic idea. Tagging so I can install it tonight.
     
  13. Irkalla

    Irkalla ENTP POWWWEEEEEER

    Joined:
    Sep 25, 2012
    Messages:
    1,009
    Location:
    Way down around Vicksburg
    I think it might be a good idea to disable this for AI's who are at war with a human player.
     
  14. sukritact

    sukritact Artist and Modder

    Joined:
    Sep 21, 2010
    Messages:
    2,749
    Location:
    Bangkok
    Thank the heavens! This should be brilliant!

    Sounds a reasonable idea.
     
  15. DarkMessiah

    DarkMessiah Chieftain

    Joined:
    Feb 26, 2013
    Messages:
    16
  16. Enginseer

    Enginseer Serf of the Community Patch

    Joined:
    Nov 7, 2012
    Messages:
    1,746
    Gender:
    Male
    Location:
    Nottingham, UK

    I'm surprised no one just linked this mod.
     
  17. Nutty

    Nutty Chieftain

    Joined:
    Mar 9, 2011
    Messages:
    3,028
    Gender:
    Male
    Location:
    Orange County, California, U.S.A.
    Check the dates. DarkMessiah necro'd this thread, and Quick Turns was created a few months after the last post in this thread, based on jcraft's mod in post #8.
     

Share This Page