OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: JasonO on 10 Apr 2007, 17:28:45
-
Hi,
When I get the aircraft to drop a bomb, how would I go about creating a camera to target it? I could do the camera business ok, just need a variable of what to target.
This is what I have so far
init.sqs
_unit = plane1
_unit addeventhandler ["FIRED",{_this exec "cam.sqs"}]
exit
cam.sqs
hint format ["%1\n%2\n%3\n%4",(_this select 0),(_this select 1),(_this select 2),(_this select 3)]
_cam = "camera" camcreate getpos (_this select 3)
_cam cameraeffect ["internal", "back"]
_i = 0
#loop
_cam camPrepareTarget (_this select 0)
_cam camPrepareRelPos [5,5,2]
_cam camPrepareFOV 1.1
_cam camCommitPrepared 0
~0.01
_i = _i + 1
?_i > 300 : goto "end"
goto "loop"
#end
_cam cameraeffect ["terminate", "back"]
camdestroy _cam
exit
The hint displays 4 lines, the top line is the vehicle, and the bottom 3 is the same.
The cam.sqs I have there targets the plane ok, but if I change the (_this select 0) to any of the others (that I have used in my hint box), I get an error.
(http://i6.photobucket.com/albums/y202/JasonOlsen/bombcamproblem-1.jpg)
Does anyone know how I can get it so the camera targets the bomb thats dropped?
Thanks in advance.
-
The info returned from the event handler may give the type of ammo, but does not return the object that is the ammo. In your script try using the (getPos _this select 0)Â nearestObject (_this select 4) command to hook the bomb itself to a variable name. Then use that variable in your camera commands.
-
Thanks a lot peanut! :good:
_bomb = nearestObject [_this select 0, _this select 4]
Targeting _bomb worked.
Once again thanks for your help :yes:
-
Jason, do you have a demo of that script? I'd like to see it in action. ;)
TCM
-
Yeh sure.
I've attached it below. Change the plane unit to anything you want, and play around with the script to get a different position etc with the bomb. Also once the scripts start the bomb is dropped in slow motion, when it blows up it returns to normal and camera ends.
http://www.youtube.com/watch?v=8YtMzAnKONI (http://www.youtube.com/watch?v=8YtMzAnKONI)
A little video I made to improve my Sony Vegas skills. The script has a few seconds of fame in that.
-
I suggest that you prepare the bomb cam script for the resource beta testing part of the forum. There might be others interested in the script and you will get more feedback on it there.
-
That script rocks!� :good:
I have one question about it....
Is it possible to have the camera slowly zoom out after impact and destruction so that you can view the bodies and debris flying everywhere?
I also want to use this script for an AA spec... but the the stinger hits the heli... I want the cam to focus on the heli as it spirals down to it's death!
Any ideas?!
Thanks in advance.
-
A camera focus is easy, just do something like:
_camera camPrepareTarget helicopter;
and look it as long as you want.
Probably good to read: topic 1 (http://www.ofpec.com/forum/index.php?topic=29056.0), topic 2 (http://www.ofpec.com/forum/index.php?topic=29058.0).
-
How would i go about getting an AI to drop a bomb so veiw it droping from the ground?
-
Quite easy,
bomb = "Bo_GBU12_LGB" createVehicle [getPos player select 0, getPos player select 1, 100]
And dont forget to look up :D
-
Wouldn't that make them drop straight down? Would it not be possible to give them momentum?
guess i could just fly the harrier over the target and tweak that snippet to drop bombs over the targets, might look a bit crap but should work
with my method ive just found, Using triggers telling the plane to drop the bombs manually
eg
plane1 fire 'BombLauncher';
The bombs seem to drop quite randomly, but looks quite good
cheers for that :)
-
Or you could check the velocity of the plane and use setVelocity to give the same speed to the bomb. I suggest yours though as long as it works fine.