Connecting FasterAlongRiver to Tech

Anondod

Chieftain
Joined
Apr 26, 2009
Messages
74
I'd like to activate the FasterAlongRiver trait for any civilization that researches a particular tech. Is that possible?
 
I'd like to activate the FasterAlongRiver trait for any civilization that researches a particular tech. Is that possible?

In theory you could add a new column to the Techs table in the DLL and hook that into CvUnitMovement::GetCostsForMove(...). That's how I'd do it anyways. There may be a way to do it with lua, I'm not certain.
 
I was thinking you could do something like "when a civ has researched this tech, set FasterAlongRiver to true", but I've only started looking at lua so I don't know if that is something you can do or not.
 
I was thinking you could do something like "when a civ has researched this tech, set FasterAlongRiver to true", but I've only started looking at lua so I don't know if that is something you can do or not.

In the DLL it is set like this

Code:
void CvUnitMovement::GetCostsForMove(const CvUnit* pUnit, const CvPlot* pFromPlot, const CvPlot* pToPlot, int iBaseMoves, int& iRegularCost, int& iRouteCost, int& iRouteFlatCost)
{
	CvPlayerAI& kPlayer = GET_PLAYER(pUnit->getOwner());
	CvPlayerTraits* pTraits = kPlayer.GetPlayerTraits();
	bool bFasterAlongRiver = pTraits->IsFasterAlongRiver();


You could add a column to the techs and then change it to something like this:
Code:
bool bFasterAlongRiver = (pTraits->IsFasterAlongRiver() || kPlayer.GetPlayerTechs()->IsFasterAlongRiver());
 
That's a bit beyond what I can understand and make use of with at my current level. But I'll keep this filed away until I know more of what I'm doing. Thank you!
 
Unfortunately, there's no way in Lua to turn the existing civ traits on and off. You need to mod the dll (C++) to do that. However, you can implement a lot of "trait-like" effects with Lua, which can be linked to techs, policies or almost anything. But that takes some learning too.
 
Would it be possible to give the trait to all civilizations but make it inactive until they research a particular tech?
 
Top Bottom