Creating New Traits

Ampharos

Chieftain
Joined
Aug 15, 2014
Messages
28
Location
New Jersey
I want to create a sponsor that gets a research bonus for killing aliens, identical to Scavenging from the Might tree.

The code is this, taken from the possible bonuses for virtues.

Code:
<ResearchFromBarbarianKills>100</ResearchFromBarbarianKills>
<ResearchFromBarbarianCamps>60</ResearchFromBarbarianCamps>

Is there a simple way to give this bonus to my sponsor by default? I figure that the easiest way to do this would be to make an invisible virtue that only my sponsor can have, but I'm not sure that this is possible.

Insights?
 
I would assume that they've linked the flags to the alien civ in beyond earth, but it might not work (you'll need to run some tests :) )

However, i do believe if you just create the virtue, it isnt linked in the virtue screen, so, once the game starts, you'll need to write a bit of lua code to loop over all civilizations, and if they're of your civ type, award them the virtue you've created.

You could try something like the following (which is untested)

Code:
<GameRules>
	<Policies>
		<Row>
			<Type>put your policy type here</Type>
			<ResearchFromBarbarianKills>100</ResearchFromBarbarianKills>
			<ResearchFromBarbarianCamps>60</ResearchFromBarbarianCamps>
		</Row>
	</Policies>
</GameRules>

This would add the policy type to the game, and then this

Code:
for i = 0, GameDefines.MAX_MAJOR_CIVS -1, 1 do
	local pPlayer = Players[i]
	if pPlayer:IsEverAlive() then
		if pPlayer:GetCivilizationType() == GameInfo.Civilizations["YOUR CIV TYPE HERE"].ID then
			pPlayer:SetHasPolicy(GameInfo.Policies["YOUR POLICY TYPE HERE"], true)
		end
	end
end

Would grant the policy at the start of the game.

I'm not 100% on this, and like i mentioned, its untested. But! it is a start :)
 
I'm pretty sure the game bugs out if you don't add a Branch- and Depth-Type to a custom virtue, at least that's what it did when I tried to add hidden Virtues a while back. Adding stuff to existing Branch- and Depths messes up the counter and just adding custom Branch- or Depth-Types makes the UI bug out.

So I assume there is no easy way of adding virtues without also editing the Virtue-UI to fix the problems that occur. Unless of course I was just too stupid to implement custom virtues back then.
 
Back
Top Bottom