chops 111 Posted May 22, 2005 This script acts like a CCIP bombsight, automatically calculating the Impact Point and moving accordingly, using Rastavovich's orginal CCIP script. You get a view of the ground where the bomb will land, X marks the spot, from under the plane. It uses Hardrocks/Vektorboson's keystroke script. "V" camera on "Q" Fire "C" camera off. I'm hoping to get some help/feedback from more talented scripters (ie anybody), as I've got a few ideas for this, such as adding a cutrsc to simulate a MFD and adapting the script so that the camera "targets" the planes current target. Have a look at it at OFPEC Thanks Share this post Link to post Share on other sites
General Barron 0 Posted May 26, 2005 Cool, I'll have to check it out. I really loved Rastavovich's original script, so it will be interesting to see what you have added/changed. Unfortunately, I have no idea how a real bombsight works, so I wouldn't be able to offer you any ideas. Share this post Link to post Share on other sites
UNN 0 Posted May 27, 2005 Hi, It's a great idea to link a camera up with the bombcam script, but I think it would be hard for a player to line up with the target? Perhaps some way to shift the aircraft left and right slightly, might help? But anyway I managed to get it down to this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">; Bombcam/ccip script by Chops v1.0 23 May 2005 ; Credits to Hardrock, Vektorboson and Rastavovich _ccip = "helihempty" camcreate [0,0,0] bombcam = "camera" camcreate [0,0,0] bombcam cameraeffect ["internal", "back"] showcinemaborder false bombcam CamSetFOV 0.1 titlecut ["X","Plain",1] #loop ;#-----------------------------------------------------------------------------# ;# Calculation of the verticalspeed and horizontalspeed    # ;# To get better results I take the averange value of two heightchecks.    # ;#-----------------------------------------------------------------------------# _V=Velocity _This _verticalspeed=_V Select 2 _horizontalspeed =Sqrt(((_V Select 0)^2) + ((_V Select 1)^2)); _Pos=getpos _this _heightold = _Pos select 2 _morerange = 0 ;#-----------------------------------------------------------------------------# ;# Calculation of bomb's droptime if it would be released right now. If the   # ;# plane is climbing the falling-time  has another value.    # ;#-----------------------------------------------------------------------------# ;hint format ["%3 %2 %1", _verticalspeed, _horizontalspeed * 3.6, _correction] ? _verticalspeed <= 0 : goto "sink" ;#-----------------------------------------------------------------------------# ;# Case: plane is climbing. Calculation of extra-range.    # ;#-----------------------------------------------------------------------------# _Speed=speed _this _morerange = (_Speed / 3.6)^2 * sin(2 * acos(_verticalspeed * 3.6 / _Speed))/ (2 * 10) _verticalspeed = -_verticalspeed ;#-----------------------------------------------------------------------------# ;# Case: plane is sinking or maintaining height.    # ;#-----------------------------------------------------------------------------# #sink _verticalspeed = sqrt((_verticalspeed)^2) _droptime = (-_verticalspeed + sqrt((_verticalspeed)^2 + 2 * 10 * _heightold)) / (2 * 10) _IPdistance = 2.1 * (_morerange + _horizontalspeed * _droptime) ;#-----------------------------------------------------------------------------# ;# Set the target-waypoint on the correct position in front of the plane    # ;#-----------------------------------------------------------------------------# _Dir=getdir _this _ccip setPos [((_Pos select 0)+ _IPdistance *  sin (_Dir)),((_Pos select 1)+ _IPdistance *  cos (_Dir))] _Pos=getpos player bombcam camsettarget _ccip bombcam camsetpos [_Pos select 0, _Pos select 1, (_Pos select 2) -2] bombcam camcommit 0 goto "loop" Apart from the changes to how he calculates horizontal and vertical speeds, I just removed the multiple calls to getpos,getDir and speed. Why he chose to calculate horizontal and vertical speeds the way he did, I'm not sure. He must have had a good reason? But this way you get what appears to pretty much the same result, only smoother. Although I have not tested it beyond the mission you supplied. Really, it needs to be tested by the AI under real mission conditions. But it's a start Cant say much about how he calculates _morerange and _droptime e.t.c My maths is learnt second hand, so if someone could explain those parts P.S There are a few things with CCIPCam.sqs to, you really need to get rid of the global variable bombcam. You can link both scripts together with local array pointers or combine them into one script. Plus every time you press the V button, I think you launch another version of bombcarmera.sqs. Before anyone mentions I have no pause in the loop, camcommit appears to handle this. I ended up with three copies of bombcam running just to keep the X visible until I reached the target, with no obvious lag. Share this post Link to post Share on other sites
General Barron 0 Posted May 31, 2005 Quote[/b] ]Why he chose to calculate horizontal and vertical speeds the way he did, I'm not sure. He must have had a good reason? That script was written for v1.46, which was before the "velocity" command was implemented. -------- Alright, I tried this script out, and it worked pretty well. I actually find this camera view much easier to target with that Rastovich's original WP method, although you do have to make sure you are lined up and ready to pass over the target. Here are my beefs with the script, though. For one, there is an annoying delay between when you press a key and when it activates/deactivates the bombsight. This isn't your fault, of course; it's Hardrock's fault for putting a 0.5 second delay between checks. However, you could easily lower this delay to something much smaller for quicker results. The X is pretty ugly, although I know you are going to make a cut resource to replace it. I also don't like having my "Q" key fire the weapon--I use that a lot when flying. Last, the camera is sometimes pretty choppy. That should be fixed if you use UNN's modification. However, he really should put a delay in there. And no, "camcommit" is not a delay. I would suggest the smallest delay you can possibly have: @true Anyway, I think this script would work much better without the keyboard detection. I don't mind the "V" key, but I do mind having to use the "Q" key to fire. My suggestion: use an ACTION to start the script, and then have a DIALOG that lets you fire and exit the sight (via buttons). This would eliminate the problem of running multiple scripts, as well as the problem of the script runnning when you are outside of the plane (only add the action when the player gets in the plane). Using a dialog would actually let you do some other cool stuff as well. First off, you could have a slider that would let the player adjust the "zoom" setting of the sight. You could also have a text display showing some stuff like distance to target/altitude/speed/bombs left/etc. Ooooh.... that would all be SO cool! Share this post Link to post Share on other sites
Blanco 0 Posted May 31, 2005 Can you adjust your direction when a dialog is active? Share this post Link to post Share on other sites
chops 111 Posted May 31, 2005 Well first things first, thanks a lot for your help UNN, your version posted above, does make the script run much more smoothly (but you already knew that ) Thanks a lot for your comments and suggestions General Barron, I have reduced the delay times in the keystroke script and added @true to the camera script. I've uploaded a slightly improved version (1.1) to OFPEC Quote[/b] ]Using a dialog would actually let you do some other cool stuff as well. First off, you could have a slider that would let the player adjust the "zoom" setting of the sight. You could also have a text display showing some stuff like distance to target/altitude/speed/bombs left/etc. I've just downloaded that dialog making program from OFPEC, with a view to implementing your suggestions. Quote[/b] ]Ooooh.... that would all be SO cool! I hope it will be I also hope this dialog business is far easier than it appears Share this post Link to post Share on other sites
chops 111 Posted June 29, 2005 Using a dialog would actually let you do some other cool stuff as well. First off, you could have a slider that would let the player adjust the "zoom" setting of the sight. You could also have a text display showing some stuff like distance to target/altitude/speed/bombs left/etc.Ooooh.... that would all be SO cool! Well, I think it is Here are a few screenshots... Slider at the top of screen is zoomed all the way out. You can just see a bomb about to hit... Theres a mapclick function that makes the camera target the mapclicked spot. The TARG function forces the camera to target the nearest object (only works in water or desert, so far) and displayes the distance to the target and the targets type in the top left corner. You can see Altitude, Speed and Heading are displayed along the bottom and number of bombs remaining at the top right. I've been trying to get a few extra things to work with missiles and there's a chopper version pretty much complete... The HUD background is a picture of Footmunch's execllent F16. Should be all finished soon Share this post Link to post Share on other sites
[aps]gnat 28 Posted June 29, 2005 Impressive dude !! Could look real nice inside a B-52 !! Share this post Link to post Share on other sites
UNN 0 Posted June 29, 2005 Nice  Did you add anything to get the AI to target a predefined position or vehicle? Cheers Share this post Link to post Share on other sites
General Barron 0 Posted June 30, 2005 Very nice looking. I'll be looking forward to downloading when you finish. Â I don't know about being able to 'target' objects with the camera though. Do real bombsights do that? And what would be the point, since the bombs only go one direction? Oh, and a dot or something in the exact center of the sight would also be nice (if it isn't there already; don't see one in the pics). Seems like it would make the sight much easier to use . Share this post Link to post Share on other sites
-HUNTER- 1 Posted June 30, 2005 this would be sweet if you could have a laser pointing in the same spot as the bombsight is... So you could use the thing for Laser Guided bombing like Gulf war I Share this post Link to post Share on other sites
UNN 0 Posted June 30, 2005 Quote[/b] ]this would be sweet if you could have a laser pointing in the same spot as the bombsight is... I don't see why not, if you already know the position of the vehicle thanks to nearest object. Then just create a Laser Target at the same spot. Share this post Link to post Share on other sites
Metal Heart 0 Posted June 30, 2005 Looks sweet. This line isn't needed: _verticalspeed = sqrt((_verticalspeed)^2) because: sqrt(x^2) = x --> x = x --> x Share this post Link to post Share on other sites
DBR_ONIX 0 Posted June 30, 2005 So you could use the thing for Laser Guided bombing like Gulf war I Didn't the GBU's have "bomb camera", which were used then? Maybe this could be impemented, like a little cutscene that follows the bomb to the target, then cuts out and goes back the normal targeting view. Anyway, looks extremely impressive, nice work - Ben Share this post Link to post Share on other sites
vektorboson 8 Posted June 30, 2005 Looks sweet.This line isn't needed: _verticalspeed = sqrt((_verticalspeed)^2) because: sqrt(x^2) = x --> x = x --> x Wrong: Example: x = -1 sqrt( (-1)^2 ) = sqrt( 1 ) = 1 Therefore: sqrt(x^2) = |x| = abs(x) Therefore it'd be better to write _verticalspeed = abs(_verticalspeed) Share this post Link to post Share on other sites
Metal Heart 0 Posted June 30, 2005 I stand corrected, but... Oh never mind... I was wrong again. Share this post Link to post Share on other sites
chops 111 Posted July 22, 2005 Sorry about that... rant removed. It's at OFPEC, about 2/3 of the way down the page. Share this post Link to post Share on other sites
chops 111 Posted July 26, 2005 Firstly I must submit my humble apologies to all of those who were exposed to my previous rant. I have imposed a 4 can posting limit on myself. No more drunken diatribes. Secondly here is some more useful information about this dialogue, taken form the read me.... Final version about 2.0 or something like that. 22 Jul 2005 I added a dialogue with a few bells and whistles, so to speak. Thanks to General Barron for his great Cutrsc/Titlersc Tutorial, and to Vektorboson for his Spy Satellite script, which offered a lot of clues and examples, both available at WWW.OFPEC.COM and included in this zip file. See updated instructions below. Oh and in Apache test, "FIRE" fires the cannon, click "TARG" then exit the dialogue, mapclick near the boats, tell your gunner to target the target with the yellow box around it (right mouse click), then restart the dialogue. Hitting the fire button will fire the cannon on the selected target. You can zoom right in and watch the rounds impact. ##########################INSTRUCTIONS############################### You start flying towards the desert island, you should be pretty much lined up with a T80 tank (slowing to about 300 helps)... Pressing "V" turns on the bombsight/camera/ccip whatever you want to call it, I guess its an MFD, sort of "FIRE" drops a bomb, usually between the cross hairs, if your speed is under 300. You must have bombs selected as your weapon, before you activate the dialoge. "FIRE TC" As above, plus it locks the camera on the the position where the bomb will impact. "RESET" Returns the camera to target the impact point. "RECON" Exits the dialogue and waits for a single mapclick. Once you've clicked a spot, reactivate the dialogue and the camera should now target the spot clicked on the map. "TARG" Is used to target the nearest object to the the currently targeted "RECON" position. Only works for boats and infantry, on Desert Island, I assume. HItting the "Esc" key exits the dialogue. The T80 tank will show up on your radar, which helps you get lined up. There are also two groups of infantry (which dont show up) to practice this script on. They're both marked on the map. Thank you kind people. Share this post Link to post Share on other sites