• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

What's the logic for this?

N

nay

Guest
I have 2 characters in a room, when you finish talking to one of them i want a variable to increase by one only once, if you talk again i dont wan't the variable to increase, so i want the variable to be 2 and not change, what type of if statement and logic do i use for this?
 
O

orSQUADstra

Guest
I have 2 characters in a room, when you finish talking to one of them i want a variable to increase by one only once, if you talk again i dont wan't the variable to increase, so i want the variable to be 2 and not change, what type of if statement and logic do i use for this?
If the variable will never exceed 2, then upon trying to talk with the character, insert this line:
Code:
if yourVariableHere <= 2
If it can be higher, then store another value for that one character.
Create event:
Code:
talkedTo = 0;
In the step event, when trying to talk wtih the character:
Code:
if talkedTo = 0
and [anything else you want to check]
{
     talkedTo = 1;
     [the rest of your code comes here]
}
 
  • Like
Reactions: nay

TheouAegis

Member
Or instead of increasing it by 1, OR it by 1 or 2, depending on which NPC you talk to ( or 4, or 8 or 16 or 32...).

Suppose i is 0. Then i|1 will will be 1. Now even if you i|1 again, it is still 1. If i is 0, then i|2 will always be 2. NOOOOW... If i is 0 and you talk to the first NPC setting i|1, then when you talk to the second NPC and set i|2, i will be 3. Let's say you had 3 NPCs . You talk to the furst {1} and the third (4). So now i would be 5 when you talk to the 2nd NPC. Talking to all 3 sets i to 7 as a result.
 
Top