Thanks Vyper. Does the gamemode block run every frame until the script duration is over
Indeed it does, which makes that block pretty versatile.
and why couldn't all of that be done at once in the scripteffectstart block?
Not enough room in the block for everything. If you declare the variable and the random percent, move the Xmarker and cast the spell all in one frame, the spell will likely miss if it fires at all. This is why the variable and random percent are initially declared in
ScriptEffectStart and updated across multiple frames in
GameMode. Using a variable in a
GameMode block is very versatile since you can change it in as many frames as you want for very rapid effect changes. An alternate method of setting something like this up would be to set the random percent in the
ScriptEffectStart block, move the Xmarker in
ScriptEffectUpdate and cast the spell in
ScriptEffectFinish. With this method, you wouldn't need the other variable used in the SI script, but you lose the versatility of the
GameMode block and could take a FPS hit, depending on how much your script has to do.
I know a block can register variables set in it, so is gamemode just used to avoid slowing the fps?
It's used to quickly update the script multiple times in a single block without having to use multiple
ScriptEffect blocks. With fewer things to check for, this will have less effect on FPS, especially in a complex script.