Download

best way to Get Multipes of an variable?

Its there anybetter way to obtain multiple of a variable?

The case is:

I have an variable(int) wich hold a number of enemies have been slain. And want to for every 100
enemies slain get an mastery point or some specia token i will use in another part

First i can just divide it but for what i want to achieve its useless.

the second way is to make another variable wich restarts after reaching the multiple i need
and then simply add the point to the token count but i think there is probably a better way to do so.

Any Ideas?

Thx In advance.

Use the Do N node. Have the N be 100, have enemies killed trigger the counter. Hook the counter up to a branch and use If INT Counter = 100 then add mastery point, reset counter

Cool, I didn’t know of the Do N node, that is awesome!

How I would have done it otherwise is to keep an enemy counter and using the module (%) operation which returns the remainder after integer division. When doing A % B, the operation only returns 0 when A is a multiple of B. So it would look like this: If (EnemiesSlain % 100 == 0) -> Add mastery point. The Do N node is a shorter hand way for this though!