The first two lines are to get a random number for the X and Y coordinates for the variable, shake_remain. The third line is what diminishes the camera shake, so that it doesn’t go on forever. This line states:
shake_remain = max(0, shake_remain-((1/shake_length)*shake_magnitude));
So this formula states to take 1/shake_length and times it by the shake_magnitude, and set that value to shake_remain. This will keep returning a smaller number to shake_remain. So every frame the shake is happening, it’s becoming less, and less…etc. Next was to write a script to create a command that I could call upon when I needed a screen shake to happen. I named that script, ScreenShake: