Lua to grant Envoys?

Hi all,

Is there a Lua hook to grant a player a # of Envoys?

Thanks,
A
Code:
Players[0]:GetInfluence():ChangeTokensToGive(5)
give +5 envoys to player 0 (the human player in a local game)

Code:
Players[0]:GetInfluence():ChangeTokensToGive(-2)
remove 2 envoys to player 0
 
I`m not so good with Lua, how would I add this little gem to my mod please?
Is there an XML version of the above code?
 
Last edited:
Riker, you would need to put together a LUA script. You probably should first decide on the requirements for getting this. Every time you meet a City State? Upon certain conditions? It's not as simple as with, say modifiers. You'd have to write code that implements this. As you think throught all the details, it becomes more and more complex. But it's a lot more flexible. As for XML, here are all the Dynamic Modifiers:

MODIFIER_PLAYER_ADJUST_DUPLICATE_FIRST_INFLUENCE_TOKEN COLLECTION_OWNER EFFECT_ADJUST_DUPLICATE_FIRST_INFLUENCE_TOKEN
MODIFIER_PLAYER_ADJUST_DUPLICATE_INFLUENCE_TOKEN_WHEN_RIVAL_GOVERNMENT COLLECTION_OWNER EFFECT_ADJUST_DUPLICATE_INFLUENCE_TOKEN_WHEN_RIVAL_GOVERNMENT
MODIFIER_PLAYER_ADJUST_YIELD_CHANGE_PER_USED_INFLUENCE_TOKEN COLLECTION_OWNER EFFECT_ADJUST_PLAYER_YIELD_CHANGE_PER_USED_INFLUENCE_TOKEN
MODIFIER_PLAYER_GRANT_INFLUENCE_TOKEN COLLECTION_OWNER EFFECT_GRANT_INFLUENCE_TOKEN
MODIFIER_PLAYER_GRANT_INFLUENCE_TOKEN_FROM_CITY_WONDER COLLECTION_OWNER EFFECT_GRANT_CITY_OWNER_INFLUENCE_TOKEN_WONDER

Issau (Quo) has an excellent implementation of the token Modifier in his Quo's Tweaks. It's attached to a wonder there. You should take a look.

The problem with all of these modifiers is that they are at the COLLECTION_OWNER level, which is a really inflexible set-up. You could probably play around with it by setting a series of identical modifiers for more than one token at once, using Modifier Attach Modifier. Don't know.

As for Lua, if no one else is interested, I could be persuaded to give it some thought and come up with an implementation for your mod. But you have to give me a detailed outline of Who, When, What, How, Why. Then I'll look at it.

Cheers.
 
Thanks Gleb for the information, I will take a look.
As for what I wanted, it was for a Diplomatic Buillding I was going to make, once you get it you get say 5 envoys.
 
Top Bottom