Cloughy 0 Posted October 3, 2013 Below is a script I have been using since OFP days. Does anyone have a beter one. This has been fine upto now. Now in arma 3, it gets a lot of juddering. Cheers GC -------------------------------------------------------------------------------------------------- ; concept by Turok_GMT, modified by snYpir,modified by [F-L]Sneaker 01.10.01 V3.0 ; Sneaker added BLACK IN and BLACK OUT at the end of the script ; Sneaker added alive test of _unit in case of midair collision or enemy attack ; Sneaker added time limitation in seconds to prevent endless loop within game ; Sneaker doubled refresh rate of the camCommit command, to prevent lags at fast movements ; syntax: ; [<name of vehicle>, <name of unit to target>, <[xoffset,yoffset,zoffset]>,<relative to vehicle?>,<time limitation>] exec "vehiclecamV3.sqs" ; example: [heli, dilbert,[0,0,-10],false,300] exec "vehiclecam.sqs" ; get camera vehicle and target _unit = _this select 0 _target = _this select 1 _timelimit = _this select 4 ; define relative time at start of this script _initialtime=daytime ; you can change the positional offsets for the camera (these are relative to the vehicle) _camoffsetX = (_this select 2) select 0 _camoffsetY = (_this select 2) select 1 _camoffsetZ = (_this select 2) select 2 ; do u want your offsets to be relative to the vehicle? _camrelative = _this select 3 ; clear the variable that will stop this script vehiclecamstop = false ; create a camera _cam = "camera" camcreate [0,0,0] _cam cameraeffect ["internal", "back"] #loop ; get actual time and calculate the time difference to _initialtime in seconds _actualtime=daytime _runtime=(_actualtime-_initialtime)*3600 ; now create a loop to continuously update the cam's pos, so it appears to be attached to the vehicle _newpos = getpos _unit ; set posn not relative to vehicle? ? NOT(_camrelative) : _cam camsetpos [(_newpos select 0) + _camoffsetX, (_newpos select 1) + _camoffsetY, (_newpos select 2) + _camoffsetZ]; goto "commit" ; set posn relative to vehicle _cam camsettarget _unit _cam camsetrelpos [_camoffsetX,_camoffsetY,_camoffsetZ] #commit ; aim camera at target _cam camcommit 0 _cam camsettarget _target _cam camcommit 0 ; insert a small update time to avoid anychance of any nasty infinity loop errors ~0.005 ; perform an if test to see if _stop has been set to true or _uint has been killed: if not, do another lap of the loop ? (NOT(vehiclecamstop) AND (alive _unit) AND (_runtime<_timelimit)): goto "loop" ; the loop ends here when vehiclecamstop gets set to true by either a trigger or a waypoint's "on activation" field once loop had ended, kill the camera and return control to player ;TitleCut ["","BLACK OUT",2] ;vehiclecamstop = true ;~2 ;_cam cameraeffect ["terminate", "back"] camdestroy _cam ;TitleCut ["","BLACK IN",2] exit Share this post Link to post Share on other sites
na_palm 19 Posted October 3, 2013 maybe it's time to rewrite the .sqs one in .sqf and look if it runs smoother then. The used commands are all quick ones so it should really run fast. greetings Na_Palm Share this post Link to post Share on other sites