Home   Help Search Login Register  

Author Topic: SnYpirs VehcileCam.sqs  (Read 696 times)

0 Members and 1 Guest are viewing this topic.

Offline rhysduk

  • Former Staff
  • ****
SnYpirs VehcileCam.sqs
« on: 13 Aug 2003, 14:01:59 »
Hi! I have a problem regarding SnYpir's vehiclecam.sqs script which is used to attach a camera to a vehicle.

My problem is that i want to end the script so , like instructed to , i put the following into the ON ACTIAVTIOn feild of a rtrigger ;-

vehiclecamstop = true

The trouble is that this is supopsed to end the script but it doesnt.. have i read something wrongly or is it a problem with the script....

i have the latest version of the script (if htere is  a ltest one or maybe only1) so could someone help me plz ?

Thx ppl ;D

Here the script an dwhat it looks like

Quote
;syntax:
;[<name of vehicle>, <name of unit to target>,
;<[xoffset,yoffset,zoffset]><relative to vehicle?>] exec "vehiclecam.sqs"

;example:
;[heli, dilbert,[0,0,-10],false] exec "vehiclecam.sqs"






; get camera vehicle and target
_unit = _this select 0
_target = _this select 1

; u can change the positional offsets for the camera (these are relative to the vehicle)
; x offset
_camoffsetX = (_this select 2) select 0

; y offset
_camoffsetY = (_this select 2) select 1

; z offset
_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"]








; now create a loop to continuously update the cam's pos
; so it appears to be attached to the vehicle

#loop

_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
_cam camcommit 0

; aim camera at target
_cam camsettarget _target
_cam camcommit 0


; insert a small update time to avoid anychance of any nasty
; infinity loop errors

~0.01

; perform an if test to see if _stop has been set to true
; of not, do another lap of the loop

? NOT(vehiclecamstop) : 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

_cam cameraeffect ["terminate", "back"]
camdestroy _cam

exit
]/quote]
Reviewed Missions Board: Please Read the User's Guide before posting!

Pride and Joy 1 (HW100-T)

Captain Winters

  • Guest
Re:SnYpirs VehcileCam.sqs
« Reply #1 on: 16 Aug 2003, 21:11:49 »
It may sounds simple, but what unit is hitting the trigger? Make sure you have that uynit as the Activation for the trigger!

Tanks!  8)

Offline rhysduk

  • Former Staff
  • ****
Re:SnYpirs VehcileCam.sqs
« Reply #2 on: 16 Aug 2003, 22:06:26 »
hi Cpt Winters !

Both triggers (teh one to activate the script and the one to deactivate it) are both activated by AnyBody, i have tried grouping the deactivating trigger to the Helo (Empty class) but nothing seems to work.... Wheres SnYpir when u need him ?

Rhys
Reviewed Missions Board: Please Read the User's Guide before posting!

Pride and Joy 1 (HW100-T)

Captain Winters

  • Guest
Re:SnYpirs VehcileCam.sqs
« Reply #3 on: 17 Aug 2003, 03:37:30 »
Don't use 'Anybody'- causes probs for me all the time. Time some other class, n leme know!

Tanks! 8)

Offline rhysduk

  • Former Staff
  • ****
Re:SnYpirs VehcileCam.sqs
« Reply #4 on: 17 Aug 2003, 16:16:15 »
Still not working...  :'(

I have used a Wets trigger for activating the script and a West trigegr for deactivating it - and still no god damn deactivation of the script... any more ideas Cpt W ?

Thx for all teh help by the way ;D
Reviewed Missions Board: Please Read the User's Guide before posting!

Pride and Joy 1 (HW100-T)

B-2-0

  • Guest
Re:SnYpirs VehcileCam.sqs
« Reply #5 on: 01 Sep 2003, 17:11:08 »
Try this vehicle-cam script, it's pretty much the same as snYpir's although slightly different.  

;--Vehicle-cam----------------------------------------------------------

vehiclecamstop = false
#loop

_cam = "camera" camcreate [0,0,0]

_cam cameraeffect ["internal", "front"]

_cam camsettarget Car

_cam camsetrelpos [1, -6, 1.5]

#commit
_cam camcommit 0


_cam camsettarget Car
_cam camcommit 0

~0.01

? NOT(vehiclecamstop) : goto "loop"  


_cam cameraeffect ["terminate", "back"]
camdestroy _cam
;------------------------------------------------------------------


Just change the 'Car' to the name of the vehicle u want to target and u can change the X, Y, Z co-ordinates to determine where u want the cam to be in relation to the vehicle.

U will need to set a trigger where u want the cam to end with vehiclecamstop = true in the 'on activation' field and this in the condition field to return to normal play.  If the vehicle that is going to activate the trigger is west then a west present trigger is needed obviously.
« Last Edit: 01 Sep 2003, 17:18:03 by B-2-0 »

Offline rhysduk

  • Former Staff
  • ****
Re:SnYpirs VehcileCam.sqs
« Reply #6 on: 02 Sep 2003, 21:56:25 »
Ok mate - ill try it and let u know ;D

Rhys
Reviewed Missions Board: Please Read the User's Guide before posting!

Pride and Joy 1 (HW100-T)