//The staircase & room map\\
void OnStart()
{
//Step #1: Add an interact callback for each of our relics & trigger
//Our relics are called relic_1, relic_2, relic_3.
for(int i =1; i<=3; i++) SetEntityPlayerInteractCallback("relic_"+i,"cbRelicGrab",false);
AddEntityCollideCallback("Player","ChaseTrigger","cbChaseBegin",true,1);
}
What the for loop is doing, is it is executing the instruction "SetEntityPlayerInteractCallback("relic_"+i,"cbRelicGrab",false);" multiple times. What is happening is a counting variable called "i" is created, and set to 1. Whilst the counting variable is <=3, the above instruction is executed. At the end of doing the above instruction, "i" is increased. "i" is not a "
scripted" variable.
As our relics are called "relic_1", "relic_2", "relic_3", and "i" has the values, 1, 2 and 3 in each iteration of the loop. The prefix "relic_" is common between all our relics - Hopefully you can see how this pieces together.
This is all the same as executing the following instructions.
SetEntityPlayerInteractCallback("relic_"+1,"cbRelicGrab",false);
SetEntityPlayerInteractCallback("relic_"+2,"cbRelicGrab",false);
SetEntityPlayerInteractCallback("relic_"+3,"cbRelicGrab",false);