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

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)
 
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)
 
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 :)
 
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. :)
 
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.
 
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.
 
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:
 
Definitely (if you can) throw this one up on Steam, too :)

That way I can subscribe for life.
 
Made it into a proper mod. Seems to be working without any problems.

Download in attachment.

Thank you! I was just thinking how much I wanted a mod like this and then stumbled upon this thread. :D
 
I think it might be a good idea to disable this for AI's who are at war with a human player.
 

I'm surprised no one just linked this mod.
 
I'm surprised no one just linked this mod.
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.
 
Back
Top Bottom