# Modify villagers work rate

I wanted to make all villagers work rate increase by 10% until a certain condition is met. So I used modify attribute and first multiply by 10 and then divide by 9 the work rate for every single villager class of both genders.
When that condition isn’t met anymore I did the opposite to revert it so multiply by 9 and divide by 10.
Now my math is not that great so is it the correct procedure? Because I’m sure it’s not working properly, villagers collect too many resources so I suspect only the 10× multiplier worked but not the ÷9… Help please!

You should multiply by 11 and divide by 10, and then multiply by 10 and divide by 11, rather than by 9 and 10. Maybe split the two modify attribute effects into different triggers as well, that could help.

1 Like

So I tested for only foragers and lumberjack and it seems to work (but using 10 and 9 seemed to work too there).
But if I modify it for every villagers class it does nothing…
Why this game is so convoluted… Ufff
Are you telling me I need to do a separate trigger for every single class of male and female villager to make it work and then again to reset it?? 40 triggers circa to change working rate by 10%…
Thank you anyway, this game really drives me mad…

No, one trigger to multiply all the resource rates for each of the villager types, one to divide it. Also, you need to put in the IDs for both villager genders, which you can get out of the Advanced Genie Editor.

1 Like

Yep I know about the gender thing and done it, I wish they could be in the unit list instead of just having to type for the correct id everytime.
Aaah so only 4 triggers, one to multiply, one to divide and the other two to revert it back!
Fiu thank you, that’s way more reasonable. I hope it works.

When I tested it with foragers and lumberjack only was working but not in my scenario so I guess there’s something wrong in triggers…
It works like:

Trigger 1
Condition: variable = or > 75
Effects: all villagers class (22 effects counting idle male and female) workrate ×11
And enable trigger 3

Trigger 2
Condition: variable = or > 75
Effects: all villagers class workrate ÷10
And enable trigger 4

So 1 and 2 should trigger together…

Trigger 3
Condition: variable < 75
Effects: all villagers class workrate ×10
And enable trigger 1

Trigger 4
Condition: variable < 75
Effects: all villagers class workrate ÷11
And enable trigger 2

It seems right to me, what am I missing?

It should probably be more like:

Trigger 1:

• Conditions:
• Variable >= 75
• Effects:
• Modify attribute “Work rate” by multiplying by 11 for unit IDs (56, 57, 83, 118, 120, 122, 123, 124, 156, 212, 214, 216, 218, 220, 222, 259, 293, 354, 579, 581, 590, 592)
• Activate Trigger 2

Trigger 2:

• Conditions:
• Variable >= 75
• Effects:
• Modify attribute “Work rate” by dividing by 10 for unit IDs (56, 57, 83, 118, 120, 122, 123, 124, 156, 212, 214, 216, 218, 220, 222, 259, 293, 354, 579, 581, 590, 592)
• Activate Trigger 3

Trigger 3:

• Conditions:
• Variable < 75
• Effects:
• Modify attribute “Work rate” by multiplying by 10 for unit IDs (56, 57, 83, 118, 120, 122, 123, 124, 156, 212, 214, 216, 218, 220, 222, 259, 293, 354, 579, 581, 590, 592)
• Activate Trigger 4

Trigger 4:

• Conditions:
• Variable < 75
• Effects:
• Modify attribute “Work rate” by dividing by 11 for unit IDs (56, 57, 83, 118, 120, 122, 123, 124, 156, 212, 214, 216, 218, 220, 222, 259, 293, 354, 579, 581, 590, 592)
• Activate Trigger 1
1 Like

I don’t know for what reason but your solution seems to work! Finally, thank you man

Why do not use the advanced script call for it instead of using rubbish modify attributes?
Don’t use the math operations for modify attributes,it will round to int for every operation.

The best solution is very easy.

Use the trigger effect called script call.
And then write the words below.

void vill(){xsEffectAmount(5,904,13,1.1);}

5 means Multiply
904 means the villager class,use this you needn’t to search the villager ID,so convenience.
13 means the attribute ID for work rate
1.1 means multiply 1.1 for the work rate of villager class

1 Like

I don’t know how to use scripts yet (is it genie editor?) But I program to learn in near future!

Read the article on Bilibili is a good choice.