Jump to content
Sign in to follow this  
shadow

Need help understanding

Recommended Posts

This part of the scipt is taken from a cutscene from a mission called Rychlý blesk II by Celoush.

Quote[/b] ]

_i = 0

titletext ["Káòata opustila hnízdo! Opakuji Káòata opustila hnízdo!","PLAIN DOWN",2]

#loop1

_CameraPos = getpos a101

_cmx = _CameraPos select 0

_cmy = _CameraPos select 1

_cmz = _CameraPos select 2

_cam camSetFov 0.5

_cam CamSetPos [_cmx-25-(_i*0.2),_cmy-20,_cmz+2]

_cam CamSetTarget a101

_cam CamCommit 0

@CamCommitted _cam

~0.01

_i = _i + 1

?(_i<200): goto "loop1"

_i = 0

The lines in bold are the ones confusing me, but they are the ones creating the "magic" smile_o.gif

In other words; I need to learn how to control the camera around flying objects smile_o.gif

Share this post


Link to post
Share on other sites

I could ask the same question. WTF are those?

Share this post


Link to post
Share on other sites

cmX,cmY and cmZ are the coords for the camera taken from the "target" plus a relative adjustment.

What I don't get is how the I-part works.

This for instance:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_cmx-25-(_i*0.2)

sad_o.gif

Share this post


Link to post
Share on other sites

the camera script allows increase in _cmx distance between target object and camera.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_cam CamSetPos [_cmx-25-(_i*0.2),_cmy-20,_cmz+2]

since i has value from 0 to 200, the camera will follow targetted object, starting from 25 meters, and during next 2 seconds will move camera to 65 meters away in X-axis.

Share this post


Link to post
Share on other sites
the camera script allows increase in _cmx distance between target object and camera.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_cam CamSetPos [_cmx-25-(_i*0.2),_cmy-20,_cmz+2]

since i has value from 0 to 200, the camera will follow targetted object, starting from 25 meters, and during next 2 seconds will move camera to 65 meters away in X-axis.

Can you be more specific?

I got a headache after trying to figure out that part. My headache just got worse after your explanation crazy_o.gif

How did you end up with 65 meters?

Share this post


Link to post
Share on other sites

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_cam CamSetPos [_cmx-25-(_i*0.2),_cmy-20,_cmz+2]

i starts from 0.

so relative distance is, [-25,-20,2]

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_i = _i + 1

?(_i<200): goto "loop1"

increase _i from 0 to 1.

on second line, since _i=1 and is less than 200, it will go back to "loop1".

and execute this line,

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_cam CamSetPos [_cmx-25-(_i*0.2),_cmy-20,_cmz+2]

where relative distance is, [-25-(0.2),-20,2]

do this for 199 more times.

and relative distance is going to be [-25-(40),-20,2]

at this point, _i=200, thus the condition is over, moving to next line

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_i=0

that is just for re-initialization of variaboe i

Share this post


Link to post
Share on other sites
Quote[/b] ]but they are the ones creating the "magic"

Where can i download this mission, or any other mission using this "technique"

Oh and another thing... How does ppl come up with this kind of stuff? was it "found" in some com reff, BIS mission or tutorial?

Share this post


Link to post
Share on other sites

aaah

I'm learning biggrin_o.gif

Thanks, bro' smile_o.gif

Share this post


Link to post
Share on other sites
Where can i download this mission, or any other mission using this "technique"

Fast Flash 2 (A very original way of fighting a battle, very cool mission)

Share this post


Link to post
Share on other sites

it's basically 'Basic;(an old programming language) type syntax.

Quote[/b] ]Oh and another thing... How does ppl come up with this kind of stuff? was it "found" in some com reff, BIS mission or tutorial?

i use this kind of coding occasionally, so it's not that magical. just pure logical analysis, coupled with creativity

Share this post


Link to post
Share on other sites

I knew basic-programming from school

...and I sucked at it  biggrin_o.gif so I did'nt pay that much attention in class.

Geez, who could know I would get to use that stuff 10 years later ?  biggrin_o.gif

Share this post


Link to post
Share on other sites

k well i tried it now. Really nice and all but i didnt see anything in the intro that looked so very complicated so i assume its somwehere else? like an outro or ingame cutscene?

smile_o.gif

Share this post


Link to post
Share on other sites
k well i tried it now. Really nice and all but i didnt see anything in the intro that looked so very complicated so i assume its somwehere else? like an outro or ingame cutscene?

smile_o.gif

The cutscene right before you take off with the Apache

There a short scene in that scene when the camera is looking at an airborne A10...

Share this post


Link to post
Share on other sites
I knew basic-programming from school

...and I sucked at it  biggrin_o.gif so I did'nt pay that much attention in class.

Geez, who could know I would get to use that stuff 10 years later ?  biggrin_o.gif

I have that this year in school. Pascal If I'm correct... what the hell do you need Pascal for? Can't they teach us like VB? I once started learning VB by myself, but never really learned anything 'cause I got bored with the dull example programs that the tutorial book had.

Share this post


Link to post
Share on other sites

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_cam CamSetPos [_cmx-25-(_i*0.2),_cmy-20,_cmz+2]

in the beginning it says _i = 0

So wouldn't _i*.02 = 0? (* is the multiplication sign for this right?) So, you'd be subtracting 25, and then 0rock.gif

Share this post


Link to post
Share on other sites
Quote[/b] ]what the hell do you need Pascal for

To make your OFP scripts more robust smile_o.gif Pascal is an ideal language to teach the principles of sound programming.

Quote[/b] ]So wouldn't _i*.02 = 0?  (* is the multiplication sign for this right?)  So, you'd be subtracting 25, and then 0

Yeah, but as the loop progresses the camera will shift along the X axis in increasing amounts. This just lets you move the camera from one position to another, in predefined steps. Like the keyframes used in animation.

If you used the same principle of interpolation with some trigganometry, you could setup up some dramatic, sweeping camera scripts.

For example you could define three positions for the camera for say three characters, then get your script to move smoothly between each of the three camera positions (Keyframes). This could be done using either 200 steps or 2000, either way you would just have to worry about the three keyframes, and the script would work the rest out.

I found excel's scatter graph to be an absolute god send when it comes to 2D visualisation of this kind of thing in OFP.

Share this post


Link to post
Share on other sites

Okay, so I figured like Sgt_Wilson said: this script-snippet can be used for some very smooth cam-movement, completely circular movements among things.

Is there a simple way of modifying this script to move a camera (in a circular movement) i.e from the back of an object to the front of it?

both X and Y need to change but in a "different matter".

Do I use one variable for X and a different for Y?

Multiply?

or divide?

EDIT: Donkey: it's a cutscene in the middle of the mission. After you've taken out the Shilka (you and 5 other men aboard 2 Jeep-MG)

Share this post


Link to post
Share on other sites

instead of

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_cam CamSetPos [_cmx-25-(_i*0.2),_cmy-20,_cmz+2]

try

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_cam CamSetPos [_cmx-25-(_i*0.2),_cmy-20+(_i*0.2),_cmz+2]

should move from 20 meters behind to 20 front(or 20 front to 20 behind) while moving X axis as it was before. but it won't be curcular, more like a diagonal line across the plane.

there is a circular movement script in OFPEC.

Share this post


Link to post
Share on other sites

Yeah, you're right. I see now what I was thinking.

But is there no way of moving it circular?  wow_o.gif

What about the pre-set cam-movements in the editor ?

Around slow something....

<s>Do you know what that scipt is called over at ofpec?</s>

nm. found it. thanks smile_o.gif

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  

×