stingfish74 0 Posted January 20, 2007 is it possible to have a camera follow a rocket fired from a AT launcher OR a vehicle AND follow the projectile in slow motion? if possible, please post a step by step instruction Share this post Link to post Share on other sites
Big Dawg KS 6 Posted January 20, 2007 (edited) Yes. unit addeventhandler ["fired",{_this execVM "cam.sqf"}] cam.sqf: _projectile = nearestobject [_this select 0,_this select 4]; _list = ["R_M136_AT","M_Javelin_AT","M_Stinger_AA","R_PG7V_AT","R_PG7VR_AT","M_Strela_AA","R_Hydra_HE","R_57mm_HE","R_80mm_HE","M_Sidewinder_AA","M_TOW_AT","M_AT5_AT","M_Hellfire_AT","M_Vikhr_AT"]; if((_this select 4) in _list)then{ setacctime 0.5; _camera = "camera" camCreate [0,0,0]; _camera cameraeffect ["internal", "back"]; while{alive _projectile && alive _camera}do{ _camera camSetTarget _projectile; _camera camSetRelPos [0,-13,1.2]; _camera camCommit 0; sleep 0.001; }; if(alive _camera)then{sleep 1}; _camera cameraeffect ["terminate", "back"]; camdestroy _camera; setacctime 1; }; Edited July 9, 2009 by Big Dawg KS 1 Share this post Link to post Share on other sites
stingfish74 0 Posted January 21, 2007 many thanks!!! works like a charm! Share this post Link to post Share on other sites
StryDa 0 Posted January 21, 2007 I can't get it to work... dont get an error but just dosent follow rockets etc. Share this post Link to post Share on other sites
kavoven 4 Posted January 21, 2007 Did you replace unit with the name of the fireing unit? Share this post Link to post Share on other sites
This kid 1 Posted January 21, 2007 Open Notepad and paste the code sample found in KyleSarnik's post. Then save it as cam.sqf. Remember to select "all files" when saving, or it will be saved as cam.sqf.txt instead. Put the cam.sqf in the same folder as your mission. Probably something like this: C:\Documents and Settings\Your Name\My Documents\ArmA\missions\Mission Name.Sara In the editor open your mission and add this to the unit's initialization field: unit addeventhandler ["fired",{_this execVM "cam.sqf"}] Be aware that the unit's name in this example is unit. You may name it anything you like, but don't forget to name it. Hope this helps! And a big thanks to KyleSarnik for this wonderfull code. I'm now able to add "bullet camera" to the player in a mission I'm working on. Great! 1 Share this post Link to post Share on other sites
StryDa 0 Posted January 21, 2007 Thanks works now Will this work with tank shells and bullets? Share this post Link to post Share on other sites
Deadfast 43 Posted January 21, 2007 It will work on everything you select in list. See this line of code: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_list = ["R_M136_AT","M_Javelin_AT","M_Stinger_AA","R_PG7V_AT","R_PG7VR_AT","M_Strela_AA","R_Hydra_HE","R_57mm_HE","R_80mm_HE","M_Sidewinder_AA","M_TOW_AT","M_AT5_AT","M_Hellfire_AT","M_Vikhr_AT"]; Add here the ammunition type that weapon uses. You'll find the class here. I've tried this nice script (big thanks to KyleSarnik) for following bullets, but I had some strange camera positions (it looked like underground or something). If someone find solution let me know Share this post Link to post Share on other sites
Big Dawg KS 6 Posted January 22, 2007 Ha, it worked? Man how's that for you, I just came up with it on the fly. Glad it works. Share this post Link to post Share on other sites
stingfish74 0 Posted January 22, 2007 just as a FYI... I added the ammo for the Dragunov sniper rifle. note that my weapons config is mod'ed and bullet deflection = 30%. using kyles script, i was able to see that bullets infact DO defelect multi times. i fired @ a building, camera followed the projectile, deflected off that building, hit another building deflecting AGAIN, into the ground. pretty neat Share this post Link to post Share on other sites
Control 0 Posted January 28, 2007 Superb, I was just dreaming off having some "Matrix effect" when I saw this topic, many thanx! Share this post Link to post Share on other sites
Shins 0 Posted January 28, 2007 works fine. There seems to be a bug tho, the first rockect fired sets a camera somewhere in the sea, Rockets fired after that work fine. Share this post Link to post Share on other sites
halodestroyed 0 Posted July 6, 2007 loving the script i do have a problem if i fire at a target benathe me E.G. a tank on a hill fires at a building below it the camera jumps to the sea instead of the shell but othrwise its fine. if anyone knows how to get rid of this problem id much apprecitate it. Share this post Link to post Share on other sites
ManDay 0 Posted July 6, 2007 didnt read anything. what about switchCamera? Share this post Link to post Share on other sites
-HUNTER- 1 Posted July 7, 2007 Going to try this right away, I wonder how it will work with 203 grenades... Share this post Link to post Share on other sites
ArmaVidz 0 Posted July 7, 2007 Ha, it worked? Man how's that for you, I just came up with it on the fly. Â Â Glad it works. Share this post Link to post Share on other sites
Maddmatt 1 Posted July 7, 2007 Modified version of KyleSarniks script, might fix some issues with the camera appearing at the sea. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _projectile = nearestobject [_this select 0,_this select 4]; _list = ["R_M136_AT","M_Javelin_AT","M_Stinger_AA","R_PG7V_AT","R_PG7VR_AT","M_Strela_AA", "R_Hydra_HE","R_57mm_HE","R_80mm_HE","M_Sidewinder_AA","M_TOW_AT","M_AT5_AT","M_Hellfire_AT","M_Vikhr_AT"]; if((_this select 4) in _list)then{ setacctime 0.5; _camera = "camera" camCreate (getpos _projectile); _camera cameraeffect ["internal", "back"]; while{alive _projectile && alive _camera}do{ _camera camSetTarget _projectile; _camera camSetRelPos [0,-13,1.2]; _camera camCommit 0; sleep 0.01; }; if(alive _camera)then{sleep 1}; _camera cameraeffect ["terminate", "back"]; camdestroy _camera; setacctime 1; }; Or this version if you want the camera to follow anything you fire, including bullets (also based on KyleSarnik's script): <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _projectile = nearestobject [_this select 0,_this select 4]; setacctime 0.2; _camera = "camera" camCreate (getpos _projectile); _camera cameraeffect ["internal", "back"]; while{alive _projectile && alive _camera}do { _camera camSetTarget _projectile; _camera camSetRelPos [0,-13,1.2]; _camera camCommit 0; sleep 0.01; }; if(alive _camera)then{sleep 1}; _camera cameraeffect ["terminate", "back"]; camdestroy _camera; setacctime 1; You can change the number after the 'setacctime' command at the start of the script to whatever you want to control the slow motion effect. 1 is normal time speed, 0.5 is half, 2 would be double ect. Don't change the second one at the end, that just sets it back to 1 when the script ends. Edit: Also remember this in the unit's init line:<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addeventhandler ["fired",{_this execVM "cam.sqf"}] And call the script file "cam.sqf". And of course it goes in the folder for your custom mission. Share this post Link to post Share on other sites
ArmaVidz 0 Posted September 7, 2007 MaddMatt, I just had a chance to test out the above script and it's awesome! Thank you. I changed a couple things most notably the setacctime and the sleep time which made the effect really smooth. This is the resulting script! <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _projectile = nearestobject [_this select 0,_this select 4]; setacctime 0.55; _camera = "camera" camCreate (getpos _projectile); _camera cameraeffect ["internal", "back"]; while{alive _projectile && alive _camera}do { _camera camSetTarget _projectile; _camera camSetRelPos [0,-13,1.2]; _camera camCommit 0; sleep 0.001; }; if(alive _camera)then{sleep 1}; _camera cameraeffect ["terminate", "back"]; camdestroy _camera; setacctime .97; exit I always use .97 acctime This script is perfect for target ranges! w00t Share this post Link to post Share on other sites
FelixK44 10 Posted July 1, 2010 (edited) --solved-- Edited July 2, 2010 by FelixK44 Share this post Link to post Share on other sites
Lionwayt 10 Posted September 18, 2010 (edited) I tried this word for word, made a text doc and saved it as cam.sqf/all files, put it in my documents folder of my custom mission. Opened the editor and added an AT Specialist added this in the initialize line <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addeventhandler ["fired",{_this execVM "cam.sqf"} To no avail... Error after error Missing; started it, Then there was Type Bool,Expected Nothing, Then there was something about a wrong number in something PFFT I dunno!!! What am I doing wrong?!? Well I think I figured part of it out but when the game loads and the first round is fired it now pops up the error Scripting cant load cam.sqf Im using version 1.18 the latest update dont know if that helps any Edited September 18, 2010 by Lionwayt Share this post Link to post Share on other sites