Last active
September 7, 2016 17:48
-
-
Save jameslkingsley/abae6f867df0c6cf2ddfdf3d4521ba04 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{ | |
{ | |
// _x is a variable that contains a merlin from the list after "forEach" | |
// The code in this loop will run 6 time, each time _x will change to the next one, starting with merlin1 and ending with merlin6 | |
// _forEachIndex is the current index in the loop, it's just a number basically | |
// First iteration on merlin1 would make it 0, when it gets to merlin6 it will be 5 (notice that it doesn't start at 1) | |
// The command "private" makes the given variable only available to the current scope | |
// Doing this means _marker and _randPos aren't available to be used outside of the loop | |
// It's somewhat optional in this case, but it's good practice | |
// The command "format" is just for string concatenation | |
// %1 is an indicator to the command that the first value should be placed here, in this case it's _forEachIndex | |
// Each iteration of the loop, you're left with "Marker0" up to "Marker5" | |
private _marker = format ["Marker%1", _forEachIndex]; | |
private _randPos = [_x, 50] call CBA_fnc_randPos; | |
if (alive _x) then { | |
_marker setMarkerPos _randPos; | |
} else { | |
deleteMarker _marker; | |
}; | |
} forEach [merlin1, merlin2, merlin3, merlin4, merlin5, merlin6]; | |
}, 60, []] call CBA_fnc_addPerFrameHandler; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment