Home   Help Search Login Register  

Author Topic: help! im new to camera.sqs!  (Read 888 times)

0 Members and 1 Guest are viewing this topic.

Offline OFPfreak

  • Members
  • *
  • Who is da operation flashpoint freak now, freak?!
    • OFP NFS mod
help! im new to camera.sqs!
« on: 03 Jan 2005, 06:42:32 »
Ive tried some tutorials but espesially this is what concerns me. When I type "this exec "camera.sqs" I can move around the world my self. Ive tryed things like [p1,p2] exec "camera.sqs" but then it says it exepected an object instead of an array while I have created a camera.sqs! I think the camera.sqs is right but Im confused at putting what in the init field or activation line of a trigger ??? . Heres my camera.sqs ok? If its wrong tell me becuase I want to learn it becuase I suck at camera effects :(... let me know it if you see something wrong  ;)!

Camera.sqs: ( i have added a ~5 to see if the problem occured. it did)

Code: [Select]
~5
_camera = camcreate getpos p1
_camera camCommit 5
~1
cameraEffect["Fixed", "Back"]
_camera camSetTarget p1
_camera camSetTarget getPos p1
~5
_camera camSetRelPos [10,5]
~10
_camera = camcreate getpos p2
_camera camCommit 5
cameraEffect["Internal", "Back"]
_camera camSetTarget p2
_camera camSetTarget getPos p2
~5
_camera camSetRelPos [10,5]
~10
CamDestroy
ofp nfs REBORN! All new nitro, neon, customized cars, off-road, on-road, rally, bikes, racer models and more!
ofp nfs's homepage

Offline OFPfreak

  • Members
  • *
  • Who is da operation flashpoint freak now, freak?!
    • OFP NFS mod
Re:help! im new to camera.sqs!
« Reply #1 on: 03 Jan 2005, 06:44:39 »
um yes I found out its terribly wrong.. I tryed to copy some lines from the comref program but eh.. I dont think that program is right. SOMONE CREATE A CAMERA.SQS WIZARD!!! :o
ofp nfs REBORN! All new nitro, neon, customized cars, off-road, on-road, rally, bikes, racer models and more!
ofp nfs's homepage

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:help! im new to camera.sqs!
« Reply #2 on: 03 Jan 2005, 10:02:58 »
I'm not sure I understand all your problems, but I think I know one problem.

OFP has a special script called "camera.sqs". When you name your script camera.sqs, weird stuff will happen, because ofp might run it's own camera.sqs when you call the script. That stuff where you move around the world, like you said? That is ofp's camera.sqs script. It is very useful for making cutscenes, check the ed depot for the camera.sqs tutorial.

But changing your camera script's name to something else (like "cutscene.sqs") should fix that problem.

If thats not clear let me know and I'll try explaining again when it isn't so late at night here. :)
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Silencer

  • Guest
Re:help! im new to camera.sqs!
« Reply #3 on: 03 Jan 2005, 15:57:07 »
Hi,

http://www.ofpec.com/editors/resource_view.php?id=50

If you read this, you will understand how to to camera scripting!
This great tutorial is made by snYpir.
I have learned a lot from this!

Good luck ;D

Offline RujiK

  • Members
  • *
  • KoKo Puh-Fizzles!
Re:help! im new to camera.sqs!
« Reply #4 on: 03 Jan 2005, 19:28:47 »
Obviously no one bothered too take a second glance at your scripting.

I saw several things that may not cause errors however are not the best way too do things.

example you typed:

_camera = camcreate getpos p1
_camera camCommit 5

this may work however I am doubting it, because you never defined what "_camera" is.
you just told the system too create it, obviosly you need too define what this "_camera" is.

I would erase that and put in this instead:

_cam = "Camera" camcreate [0,0,0]
_cam cameraeffect ["Internal", "back"]

Now, this will create a camera just as it does in the triggers, however this camera can be told what too do with other camera commands.

However Obviously you dont want your camera at the very edge of the map at point [0,0,0]

so next put in

_cam camsettarget p1
_cam camsetpos [(getpos p1 select 0)+2,(getpos p1 select 1)+2,(getpos p1 select 2)+1.4]
_cam camcommit 0
@camcommitted _cam

that will move the camera too the position you will need, this can be tweeked around with the camsetpos command if you want the position at other places.

also you put

cameraEffect["Fixed", "Back"]

Camera effects are really pointless and unneeded because you can just user camsetpos, or camsetrelpos.

And you also put

_camera camSetTarget p1
_camera camSetTarget getPos p1

You gave the camera too targets, one is where p1 is currently standing and another is p1 himself, I would take that out and put in "_cam camsettarget p1"

And you also put
_camera = camcreate getpos p2

The only problem is you already have a _camera and are trying too create a second. This can cause many errors, so instead of that just put in _cam camcommit 0.

And  you put

_camera camSetRelPos [10,5]

You only put in two variables [x,y] however no z, you should put in [10,5,2]
instead of just those two.

and finnally you put in

Camdestroy

The system will obviosuly have no idea on What camera too destroy as you told it nothing, take that out and put in

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

so instead of your script try putting in this:

_cam = "Camera" camcreate [0,0,0]
_cam cameraeffect ["Internal", "back"]

_cam camsettarget p1
_cam camsetrelpos [10,5,2]
_cam camcommit 0
@camcommitted _cam
~5
_cam camsettarget p2
_cam camsetrelpos [10,5,2]
_cam camcommit 5
@camcommitted _cam
~10
_cam cameraeffect ["terminate", "back"]
camdestroy _cam

That will fix your problem.

If you have any other problems, or wish too do anything else PM me, camera scripting is my strongsuit as well as my favorite form of scripting.

Post count number one.
« Last Edit: 03 Jan 2005, 19:32:49 by RujiK »
I like your approach, lets see your departure.
Download the New Flashlight Script!

Dubieman

  • Guest
Re:help! im new to camera.sqs!
« Reply #5 on: 07 Jan 2005, 03:44:58 »
Read snYpir's tut then Messiah's tutorial. snYpir's tut is an odler way of cam scripting, but it gets all the basics and code across. Messiah's is on the newer, faster, better, camera.sqs.


Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Re:help! im new to camera.sqs!
« Reply #6 on: 20 Jan 2005, 11:45:52 »
i sound almost famous  ;D
Proud Member of the Volunteer Commando Battalion

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:help! im new to camera.sqs!
« Reply #7 on: 20 Jan 2005, 12:40:47 »
and so you should messiah - that tute of yours... hats off to you sir. in a few short hours, switching between snYpir's tute and yours, i was able to come up with (modesty aside) a fairly professional looking cutscene.

even though i have some programming experience, i found it easy to follow - dunno what others are finding so cryptic about it...

as for ofpfreak's query, it sounds to me like you're trying to call camera.sqs using other soldiers than your own player. i tried this too, and it can't be done - as you pointed out, flashpoint doesn't like it, throwing up an "expected object" error.

EDIT - this is NOT the case - camera.sqs can be called by any soldier, not just the player, by using

Code: [Select]
this exec "camera.sqs"
in the init field. note: it's not [this] exec "camera.sqs", the brackets seem to break it.

if you're trying to play a cutscene you've already saved under whatever filename, then you put

Code: [Select]
[] exec "name_of_cutscene.sqs"
in the init line, or in a trigger, or in a script.

camera scripting seems very complicated to begin with but basically it comes down to 6 steps:

create the camera

tell it where to go
tell it what to point at
tell it how long to get to that point
wait until it's finished


(these four steps get repeated depending on how many 'shots' you have)

destroy the camera

that's it. as suggested above, go back to the two tutorials mentioned. it may seem frustrating reading the same thing over and over again and still not understanding it, but it will sink in eventually - hey, i managed :P

good luck
b
« Last Edit: 29 Jan 2005, 14:43:40 by bedges »

Dubieman

  • Guest
Re:help! im new to camera.sqs!
« Reply #8 on: 21 Jan 2005, 21:01:42 »
What bedges said.  ;)

@Messiah, your tutorial was great and all but I was very pissed off cause I had been using snYpir's older way before and wasting hours cause I was no good with the code. I picked yours up and once I "got" it I was angry and happy. Realizing that I had wasted many hours and yet I was no longer slave to the camsetrelpos command. ;D :booty:

 :cheers: