Triggering common event every time a variable increases/decreases by x amount?

Amarok

Veteran
Veteran
Joined
Dec 15, 2016
Messages
294
Reaction score
723
First Language
Spanish
Primarily Uses
RMMV
So im trying to add a bit of strategy to my game by using a turn based system on the overworld. (Think the total war games or Civilization)
I already know how to trigger events and change things when X turn is reached. But i also need certain events to trigger after every 3 turns pass, for example (with turns being a variable)

Basically in the conditional branch page i can set the event to activate once the variable turns reach a certain amount, like turn 2, 10, etc... Now i only need to make it trigger every time the variable goes up 3 times for example.
Is there a way to do this?
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
goes up 3 times like increase-increase-increase with values completely irrelevant:
have a variable track the amount of times a variable has increased.

Variable goes up 3 times (variable = 3*variable):
if - script - $gameVariables.value(1) == 3*$gameVariables.value(1)
 

Amarok

Veteran
Veteran
Joined
Dec 15, 2016
Messages
294
Reaction score
723
First Language
Spanish
Primarily Uses
RMMV
goes up 3 times like increase-increase-increase with values completely irrelevant:
have a variable track the amount of times a variable has increased.

Variable goes up 3 times (variable = 3*variable):
if - script - $gameVariables.value(1) == 3*$gameVariables.value(1)
So its possible awesome! thank you :D but im such a noob with these things, so im not sure if i understood correctly what you wrote, how can i make the variable track the amount of times it has increased?' i used the code you wrote, but now the event triggers as soon as the switch of the parallel common event gets on. :S
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
simple.
You have common event increasing variable 1, which symbolizes passed days.

Instead of the common event only doing
variable operations: 0001, +1

do this:

variable operations: 0001, +1
variable operations: 0002, +1
if (0002 is equal to 3)
trigger switch 0001 on
variable operations: 0002, = 0
and that switch 0001 is the trigger switch for your parallel process common event that is supposed to activate after 3 days passed. And every 3 days the switch 0001 turns on and the parallel process activates.

There are many ways to do this, depending on what you exactly want to do.
 

Amarok

Veteran
Veteran
Joined
Dec 15, 2016
Messages
294
Reaction score
723
First Language
Spanish
Primarily Uses
RMMV
@Poryg it worked! :D thank you so much mate! i will have to keep tinkering it to make it work the exact way it want but this is an awesome starting point.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
You're welcome :D
Yup, playing with it is the best way to learn :) I have spent 3 years playing with RM2003 :D (never really created a serious project :'( )
 

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,492
Reaction score
408
First Language
German
Primarily Uses
RMMV
You could also use the Modulo Function in Control Variable Eventcommand.
It gives the left overs of something (sorry my english is lacking).

10 modulo 3 = 1 ( 3+3+3 = 9 and the Leftover is 1)

In your example do this:
Variable?? = VariableTurn Count
Variable?? modulo 3
conditional branch variable?? equals 0
if yes show textbox: You did it :).

If the leftover is 0 its 3 turns pass ^^ if its 1 or 2than the condition is false.
That means every 3 turns this condition would be true.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,125
Reaction score
10,639
First Language
Czech
Primarily Uses
RMMV
This would only work under the assumption that the op would increase the variable always by 1 though, so I opted to give the more general answer.
 

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,492
Reaction score
408
First Language
German
Primarily Uses
RMMV
He mentioned in his first post that he knows how to let something happen at a certain turn in the fight,
thats why i assumed he uses inbuild variable or counter to keep track of that. i also just wanted to mention this as extra angle for solution ways.
 

Amarok

Veteran
Veteran
Joined
Dec 15, 2016
Messages
294
Reaction score
723
First Language
Spanish
Primarily Uses
RMMV
@Bex thanks! the example poryg provided was enough to do what i wanted, though i need more knowledge to make it exactly the way i want, i will also take a look at your solution since indeed the variable will only be increased by 1 each time.
 

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,492
Reaction score
408
First Language
German
Primarily Uses
RMMV
ah i made a mistake in the code, it would activate at turn 0, to prevent that the pseudo code would be:

In your example do this:
Conditional Branch "Variable for Turn Count" more then 0 ?
if yes
-Variable?? = VariableTurn Count
-Variable?? modulo 3
-conditional branch variable?? equals 0
-if yes show textbox: You did it :).
else
nothing

Edit: I reread first post and iam sorry my english aint the best. i partialy missread the problem. And poryg also allready posted modulo in his first answer with the scriptline ^^.
Have to take more time reading next time.

Edit2: what exactly are you building in terms of mechanic? iam just curious.
 
Last edited:

Amarok

Veteran
Veteran
Joined
Dec 15, 2016
Messages
294
Reaction score
723
First Language
Spanish
Primarily Uses
RMMV
@Bex just a simple turn based system like the one games like the total war series has. Basically, most of the game takes place on the worldmap/overworld and every time the players does something, like a quest, seeing an event, conquering a province, etc one turn passes.

The reason why i need certain events to trigger every x turns is to simulate the ability of whatever factions you are at war with to try and strike back at you, by retaking their provinces or attacking yours.

I guess the most simple way to achieve this would be the best.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c

Forum statistics

Threads
105,857
Messages
1,017,019
Members
137,564
Latest member
McFinnaPants
Top