A way to change or set a player's CO2 value?

Kenska

Chieftain
Joined
Jan 13, 2019
Messages
1
Location
France
Hello everyone!

I've been looking for the past two days for a way to change or set a player's CO2 value, the same way we could update the gold or diplomatic victory points with a method such as

Code:
ChangeGoldBalance(-100); -- substracting 100 golds from the player

but I couldn't find anything so far. I searched in the Game, GameClimate, Player and GameConfiguration classes, but couldn't find anything. The CO2 update seems to be done internally. The only way it can be altered is through the modification of the save file itself.

I also tried to find a property that I could set with Game or GameConfiguration, in vain.

I don't think there is any way to do so for now. But maybe one of you guys has found something that I haven't been able to find.

Help would be greatly appreciated!
Thanks.
 
You can attach modifiers directly to players in GS. You have to have the modifier defined first in the database.
Code:
<ModifierId>PROJECT_COMPLETION_CARBON_SEQUESTRATION</ModifierId>
Might be a good modifier to use as a template.
This would attach the carbon sequestration project's modifier to a player directly via lua
Code:
Player:AttachModifierByID("PROJECT_COMPLETION_CARBON_SEQUESTRATION");
The ModifierType is
Code:
MODIFIER_PLAYER_ADD_SEQUESTERED_CARBON
and the EffectType is
Code:
EFFECT_ADD_PLAYER_SEQUESTERED_CARBON
If you want to bork the player by adding more carbon to them I'm not sure if there'e a modfier-type or effect-type for that.
 
Last edited:
Top Bottom