OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Rytuklis on 27 Dec 2010, 18:21:29
-
Here is what i do:
_camera = "camera" camCreate [0 , 0, 0]
_camera cameraEffect ["internal","back"]
;=== 0:00:03
_camera camSetTarget Civilian1
_camera camSetPos [11102.43,1261.10,0.75]
_camera camSetFOV 0.700
_camera camCommit 0
@camCommitted _camera
player cameraEffect ["terminate","back"]
camDestroy _camera
But camera spawns at random location and shows me random location at the map... I dont know what to do... Also how do i find the coordinates where do i need to set the camera??
-
That was an example, do not place it. You have to do the above steps the other was an example of how he had to stay.
-
Use descriptive topic titles, please. Also, place multiple lines of code inside of UBB code tags (use the # symbol in the toolbar above the smileys).
You mentioned in the other thread that
i dont understand coding, i am looking for easier solutions
Somehow, you can make camera cutscenes using triggers, but I never bothered to learn how. I think most OFP mission makers use scripting for cutscenes, and that's why the tutorials are written with scripting in mind.
Coding is not as difficult as you might think. There are a ton of tutorials. This is the one I learned from:
http://www.armaholic.com/page.php?id=92
Anyway, I'll try to explain what's gone wrong with your script.
But camera spawns at random location and shows me random location at the map
What's probably happening is that it the camera spawns at location [0,0,0], which is at the southwest corner of the map, in the water. That's because of this line:
_camera = "camera" camCreate [0, 0, 0]
You have to enter the correct co-ordinates inside of the brackets so that the game knows where to create the camera. To get correct co-ordinates, use camera.sqs (http://www.ofpec.com/ed_depot/index.php?action=details&id=50&game=ArmA) or use scripting commands such as getPos (http://www.ofpec.com/COMREF/index.php?action=details&id=152&game=All). Example:
_camera = "camera" camCreate getpos player
After being spawned at [0,0,0], the camera will want to move to [11102.43,1261.10,0.75], because of this:
;=== 0:00:03
_camera camSetTarget Civilian1
_camera camSetPos [11102.43,1261.10,0.75]
_camera camSetFOV 0.700
_camera camCommit 0
Once again, the correct co-ordinates must be entered into the brackets after camSetPos. Actually, camSetRelPos (http://www.ofpec.com/COMREF/index.php?action=details&id=52&game=All) is usually better than camSetPos, which is bugged.
I'm surprised that the following code did not cause the camera to be terminated instantly:
_camera camCommit 0
@camCommitted _camera
player cameraEffect ["terminate","back"]
camDestroy _camera
The number after camCommit is the number of seconds that the camera will take to move to new coordinates.
Enter the correct values into your code, and then see if it works.
-
I'm locking this topic. To discuss it further, feel free to post in the thread started before it entitled "Need help with cutscenes (http://www.ofpec.com/forum/index.php?topic=35400.0)". It contains the proper title that other forum searchers can use. Thank you.
-
I remember i asked question about cutscenes, yes, i found that topic but i do everything what the guy answered in the topic but camera wont work. I create Camera.SQS at "Users/Rytuklis/Saved/Missions/Strength of Unity" but when i go edit the "man1" and do in intialization "this exec "Camera.SQS" i go in preview and nothing happens? Help please!
-
Unlocked, merged, retitled
I suspect it's that you are using a path to the savegame folder: "Users/Rytuklis/Saved/Missions/Strength of Unity". This will contain files with names like autosave.fps and weapons.cfg.
You want just "Users/Rytuklis/Missions/" for missions that are being edited. In their folders they will contain mission.sqm and, if you have created them, description.ext, briefing.html, overview.html plus any other scripts.
-
Thank you so much :) I'm gong to try and i will let you know does this works or no
EDIT: Problem >:('
Now my camera spawns near legs of the characeter. I remember there used to be a way to set the position you want like that: You go to prievew and focus the crosshair into the character you want and then press SPACE and CTRL+C and CTRL+V into the code? How? I forgot
-
you have to point the crosshair wherever you want and then press CONTROL, then go to the notes and you press CONTROL+V to paste the camera pos. if you want to target a special soldier or thing, the only thing you have to do is to change this line:
_camera camSetTarget [X, Y, Z]
to
_camera camSetTarget unitname.
BUT if you want the camera to follow the special unit every where he goes you have to write down this
#loop
? (ANY CONDITION YOU WANT for example) NOT (alive dumb) : goto "nextcamera"
_camera camSetTarget the-unit-you-want-to-chase
_camera camSetRelPos [X, Y, Z]
_camera camCommit 0
@camcommitted _camera
goto "loop"
That code will do everything easier, if you ahve any other doubt, just ask ;)
Cheers OFP_f3d3