NPC Code:
if (wasshot) { Makes the following stuff executed when the NPC is hit by an arrow
for Initializes a for-loop
(i=0; Sets the variable "i" to 0 once
i<npcscount; Defines when to repeat the script after the ) thing: When the variable i is lower than the amount of NPCs in the level
i++) Increasing i each time the script after ) is run
callnpc i,swimming; Setting the flag "swimming" to true for the NPC with the index "i"
}
So what it would be doing in "normal" talk:
1) Wait until the NPC is hit by an arrow.
2) Set "i" to 0
3) Tell the NPC with index "i" that "swimming" is called (makes if (swimming) happen)
4) Increase "i" by one
5) Go back to 3 if "i" is lower than the amount of NPCs in the level
6) Stop executing