Jump to content
Sign in to follow this  
Hidden

Uhh uhh need help, uhh.. buh.

Recommended Posts

First: I am trying to learn how to control cameras by code, using Snypir´s tutorial (e-mail: morpj97@hn.ozemail.com.au). The tutorial itself is GREAT, makes me understand the magic works, but like I just said, I am still new at it.

To check the script, use the Desert Island map, put you and another unit on it. Call the other unit "object2" (you can see that in the script anyway). Then of course [] exec "testcam.sqs" in the player´s init field.

First it would not work at all, then I installed Properties Plus and ah.. I hadn´t changed the file extension.. *blush*. So the problem is something in the script.

Setrelpos is not working, you will get an error message, why? Appreciate any help deeply!

======================================

HERE´S THE TESTCAM SCRIPT

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

_cam cameraeffect ["internal", "back"]

; point the camera at the player, and place it 2m to

; the players left, 10m to his front and 3m above

; the ground

_cam camsettarget player

_cam setrelpos [-2,10,3]

_cam camcommit 0

; fade in from black over 2 seconds

titlecut ["Test Cam","BLACK IN", 2]

; wait for 2 seconds for the fade to complete

~2

; move the camera to 5m behind the player, 2m

; to his left and 0.5 above the ground. do the

; move over 10 seconds, and then wait for 2 seconds

_cam camsetrelpos [-2,-5,0.5]

_cam camcommit 10

@camcommitted _cam

~2

; target object 2 (the camera will spin around to

; face object2 when camcommit is called)

_cam camsettarget object2

; the camera will move relative to object2.

; 3m to the front, 1m to the left and 2m

; above the ground

_cam setrelpos [-1,3.2]

; wait for 2 seconds for the fade to complete

~2

; end cutscene

_cam cameraeffect ["terminate", "back"]

camdestroy _cam

; fade back in over 2 seconds

titlecut ["Test Cam","BLACK IN", 2]

; Exit the script

exit

========================================

So what have I done wrong here?

Hidden

Share this post


Link to post
Share on other sites

u have to add cam before the setrelpos....

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

_cam cameraeffect ["internal", "back"]

; point the camera at the player, and place it 2m to

; the players left, 10m to his front and 3m above

; the ground

_cam camsettarget player

_cam camsetrelpos [-2,10,3]

_cam camcommit 0

@camcommitted _cam

; fade in from black over 2 seconds

titlecut ["Test Cam","BLACK IN", 2]

; wait for 2 seconds for the fade to complete

~2

; move the camera to 5m behind the player, 2m

; to his left and 0.5 above the ground. do the

; move over 10 seconds, and then wait for 2 seconds

_cam camsetrelpos [-2,-5,0.5]

_cam camcommit 10

@camcommitted _cam

~2

; target object 2 (the camera will spin around to

; face object2 when camcommit is called)

_cam camsettarget object2

; the camera will move relative to object2.

; 3m to the front, 1m to the left and 2m

; above the ground

_cam camsetrelpos [-1,3.2]

; wait for 2 seconds for the fade to complete

~2

; end cutscene

_cam cameraeffect ["terminate", "back"]

camdestroy _cam

; fade back in over 2 seconds

titlecut ["Test Cam","BLACK IN", 2]

; Exit the script

exit

copy this and try it again.

Share this post


Link to post
Share on other sites

Thanks, but now I get an Operator unknown error (_cam I think), but I will check the site with Snyper´s tutorial and see if I can find more info there. I saw a link, but had saved it as a txt file..

I had forgot the @camcommited _cam, thanks for reminding me!

Hidden

EDIT..

I found the example code:

; create camera

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

_cam cameraeffect ["internal", "back"]

; point the camera at the player, and place it 2m to the players left,

; 10m to his front and 3m above the ground

_cam camsettarget player

_cam camsetrelpos [-2,10,3]

_cam camcommit 0

; fade in from black over 2 seconds

titlecut [" ","BLACK IN",2]

; wait for 2 seconds for the fade to complete

~2

; move the camera to 5m behind the player, 2m to his left and 0.5m above the ground

; do the move over 10 seconds, and then wait for 2 seconds

_cam camsetrelpos [-2,-5,0.5]

_cam camcommit 10

@camcommitted _cam

~2

; target object2, moving the camera to a relative position that is

; 3m in front, 1m to the left and 2m above the ground. Move over 10 seconds, then wait

for 2.

_cam camsettarget object2

_cam camsetrelpos [-1,3,2]

_cam camcommit 10

@camcommitted _cam

~2

; fade out to black over 2 seconds

titlecut [" ","BLACK OUT",2]

; wait for 2 seconds for the fade to complete

~2

; end cutscene

_cam cameraeffect ["terminate", "back"]

camdestroy _cam

; fade back in over 2 seconds

titlecut [" ","BLACK IN",2]

exit

Tried it and it works, no problem

(Edited by Hidden at 12:06 pm on Dec. 7, 2001)

Share this post


Link to post
Share on other sites

Wrong here:

; the camera will move relative to object2.

; 3m to the front, 1m to the left and 2m

; above the ground

_cam setrelpos [-1, 3.2 ] ; <-----------

Change to

_cam setrelpos [-1, 3, 2]

Share this post


Link to post
Share on other sites

here i just tried it and it works.....

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

_cam cameraeffect ["internal", "back"]

_cam camsettarget player

_cam camsetrelpos [-2,10,3]

_cam camcommit 0

titlecut [" ","BLACK IN",2]

~2

_cam camsetrelpos [-2,-5,0.5]

_cam camcommit 10

@camcommitted _cam

~2

_cam camsettarget object2

_cam camsetrelpos [-1,3,2]

_cam camcommit 10

@camcommitted _cam

~2

titlecut [" ","BLACK OUT",2]

~2

_cam cameraeffect ["terminate", "back"]

camdestroy _cam

titlecut [" ","BLACK IN",2]

exit

Share this post


Link to post
Share on other sites

Thanks but I solved the problem by looking more closely at the code, thanks anyway! Do you have any experience from other script languages (or semi languages like JavaScript), and how/when did you start learning this kind of scripting?

Hidden

Share this post


Link to post
Share on other sites

believe me i have no idea how to do scripts... i have no idea how people catch on to them mad.gif... i only know how to camera script quite well.

Share this post


Link to post
Share on other sites

I did Java script and visual basic scripting in collage.

It's preety much the same...

I thought those courses would never come in handy LMAO

Share this post


Link to post
Share on other sites

i will probably never catch on.. neva mind.... i guess i will have to rely on other people to make scripts for me.

Share this post


Link to post
Share on other sites

LOL been there all my life (I guess), never got far enough to learn anything really well.

What about those Dummies books (IDG?), should be something useful there?

Although HTML, JavaScript e.t.c. is not that difficult, I got lost when the more advanced sites started popping up everywhere. All of a sudden you had to know how to create and manage a database, something I still haven´t learned.

Hidden

Hidden

Share this post


Link to post
Share on other sites

well my dad knows c and c++ so he said he would help me leearn it and im doin a ict course at school.....

so i guess it will turn out alright.. i wanna be a games designer and programmer. o and i know my html quite good.

Share this post


Link to post
Share on other sites

C and C++ are fairly hard to get the hang of for a newbie programer, but they are verry powerfull if you do get it to work smile.gif

RED

Share this post


Link to post
Share on other sites

Well I figured out how to set the VCR timer for COL, then this should not be any harder!? LMAO

Well I will not give up this time. I bought the game, now I want to do just a bit more than playing it. I have seen to many scripting goodies to let go by now!

smile.gif)

Hidden

Share this post


Link to post
Share on other sites

btw way do u know if the scripts are c++ or java? cuz my dad looked at it and said that it looked like java.

Share this post


Link to post
Share on other sites

the scripts are not a single language they are a cross between C++ and java ( a bit weird smile.gif)

RED

Share this post


Link to post
Share on other sites

yeah thats wot i thought... the people that made the game must of got seriously confised. unless they did that on purposeto make sure that people wouldn't know wot they were goin on bout.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×