Jump to content
Sign in to follow this  
Eddie Haskel

Help pls! Getting error from a tutorial script

Recommended Posts

getting the error message from the script that follows.

'player=_this select 0 |#| Error Select: Type Object Expected array

SCRIPT:

player = _this select 0

_camx = getpos player select 0

_camy = getpos player select 1

_camz = getpos player select 2

; Create a camera and place it 5 meters from the object 1 meter above the ground

_cam = "camera" CamCreate [_camx,_camy+2,_camz+1.5]

; Point the camera to the passed object

_cam CamSetTarget Priest

; Set an effect for the camera

_cam CameraEffect ["Internal","Back"]

; Apply the changes!

_cam CamCommit 0

Priest setMimic "sad"

titleText ["Father, where is everyone? Are they inside? We're here to help!", "PLAIN"]

~5

titleText ["My Son, dark times are upon us.","PLAIN"]

~10

_cam CameraEffect ["Terminate","Back"]

CamDestroy _cam

Exit

Any help would be appreciated. The player is the leader for Alpha (Alpha =Group this;), and his name is P1. he camera should be playing on a priest (vehiclename), named Priest1.

THANKS!

Eddie

Share this post


Link to post
Share on other sites

The mistake is to use player as a variable. player is always the played unit in OFP.

If I understand "Point the camera to the passed object" right, the original script should "record" any passed object when executed. But you don't want to use it variable, you just need it for this priest scene.

Then the whole script should look like this:

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

_camx = getpos priest select 0

_camy = getpos priest select 1

_camz = getpos priest select 2

_cam = "camera" CamCreate [_camx,_camy+2,_camz+1.5]

_cam CamSetTarget priest

_cam CameraEffect ["Internal","Back"]

_cam CamCommit 0

priest setMimic "sad"

titleText ["Father, where is everyone? Are they inside? We're here to help!", "PLAIN"]

~5

titleText ["My Son, dark times are upon us.","PLAIN"]

~10

_cam CameraEffect ["Terminate","Back"]

CamDestroy _cam

Exit

Share this post


Link to post
Share on other sites

added the _ to player this select 0. Must have missed it when I copy and pasted to here.

Tried all variations of naming _player (P1, who is the player, priest, the person it SHOULD be), but still getting the error. Saved mission. Remove everything else from map, etc. etc.

It P**SES me off because it isn't a complicated script. I mean, even I understand it! tounge2.gif

the _player this select 0 SHOULD be _priest this select 0, as the camera is using his position for it's positioning in the camCreate line.

getPos player SHOULD actually be getPos priest, as again, it sets itself up based on the location of the priest.

Anyone know what's wrong here? Any help would be great!!!

Eddie

Share this post


Link to post
Share on other sites

Trapper,

Looks like we posted at the same time! lol!

It worked, of course. Funny, as this was taken directly out of a cam tutorial. the only thing you should really have to change then is from which object the camera is to set itself up. Or the tutorial is old, for an older version.

But thanks again!!!!!

Eddie

Share this post


Link to post
Share on other sites

Another thought..., while not so sleepy anymore smile_o.gif

The only real mistake that caused the first error (Error Select: Type Object Expected array) simply was:

I'm sure you called the script with an 'object':

priest exec "myscript.sqs"

The error message trys to tell you an 'array' is needed for the execution of this script (even if this contains just one value):

[priest] exec "myscript.sqs"

Share this post


Link to post
Share on other sites
Another thought..., while not so sleepy anymore smile_o.gif

The only real mistake that caused the first error (Error Select: Type Object Expected array) simply was:

I'm sure you called the script with an 'object':

priest exec "myscript.sqs"

The error message trys to tell you an 'array' is needed for the execution of this script (even if this contains just one value):

[priest] exec "myscript.sqs"

Trapper, I have a feeling you should finish my missions, as 95% of the time I have a problem you come to the rescue! rofl.gif

Now that you mention it with the array ( [priest] not priest ), I remember reading that in one of the 15 or 16 tutorials I have.

Anyway, I have the problem fixed, and have made a cutscene that involves the conversation with the priest, the camera passing back and forth between player and priest, the camera ALSO passing to the priests brother on another part of the island (priest was thinking of his brother while talking), and so on.

The cutscene is long, as it's an entire converation between the team leader and the priest, with the priest giving information about the REAL situation on the island, but I love the way it's working. And, as the conversation rolls on, fog rolls in.

Eddie

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  

×