Ok I really am wondering about this because I have no idea how it can be implemented:
This goes for triggers btw: How can I check to see if it’s the first time a player has entered that area or stepped on that trigger? For example: it’s the player’s first time going in the zone and a cutscene appears, but if it’s the second, third, etc time the cutscene wont play. How would I go about doing this?
Oh ok thanks!
So in my understanding, the variable is HasBeenVisited and says that it’s false (meaning that the zone has not just been visited) and if it’s the first time visited then play a cutscene. If not just continue normally. Right?
Now I’m also wondering (bit off topic) because I havent really figured this out but what is the difference between “{” and “}”?
{ and } are like the beginning and end of a container. After the ‘if (something)’ statement, the code will execute the next line of code if (something) is true, and will skip over it if (something) is false.
Usually, of course, we want to do more than one thing after we check the value of (something). So instead, we write:
The curly braces say that all four lines belong with that if statement. If (something) is true, all four lines will be executed. If (something) is false, they’ll all be skipped.
The regular parentheses ‘(’ and ‘)’ wrap around the stuff that a function needs to do its job - so that’s where parameters for functions, if statements, loops, etc. will go.
Also, the ! in these two languages is the logical check for “not” - so if(!something) literally says “if not something”… So if “something” is true, then “not something” is automatically false, and vice versa. (You can only do that to boolean logic values).
In this case, (!something) is the same check as (something != true), or “something is not true,” and also to (something == false) or “something is false.”