; Random Camera Position Script
; Just call [groupname, something] exec "camrandoms.sqs"
_group = _this select 0
_justtypesomething = _this select 1
_cam = "camera" camcreate [0,0,0]
_cam cameraeffect ["internal", "back"]
_units = units _group
_i = 0
_numunits = count _units
#start
_camaround = random 360
_camzoom = random 4
_camup = random 30
_currentunit = (_units select _i)
_cam camsettarget _currentunit
_cam camsetrelpos [_camaround, _camzoom, _camup]
_cam camcommit 0
~10
_i = _i + 1
?_numunits > _i:goto "start"
?_numunits = _i then _i = 0
goto "start"
~1
_cam cameraeffect ["terminate", "back"]
~1
exit
Updated it a little, what do you think could be causing this?
EDIT: I think I got it.
?_numunits > _i:goto "start"
should be:
?_numunits < _i:goto "start"
I think this was causing the script to go back to start once _i became greater than the number of the units in the group, thus causing the error.
Updated version below:
; Random Camera Position Script
; Just call [groupname, something] exec "camrandoms.sqs"
_group = _this select 0
_justtypesomething = _this select 1
_cam = "camera" camcreate [0,0,0]
_cam cameraeffect ["internal", "back"]
_units = units _group
_i = 0
_numunits = count _units
#start
_camaround = random 360
_camzoom = random 4
_camup = random 30
_currentunit = (_units select _i)
_cam camsettarget _currentunit
_cam camsetrelpos [_camaround, _camzoom, _camup]
_cam camcommit 0
~10
_i = _i + 1
?_numunits < _i:goto "start"
?_numunits = _i then _i = 0
goto "start"
~1
_cam cameraeffect ["terminate", "back"]
~1
exit
How did you make it so I don't need the "something", and how do you call it ingame?