Jump to content
Sign in to follow this  
jed89

Assign handle to missile

Recommended Posts

Is there a way to assign a handle to a missile that was fired by an AI vehicle?

I know, that I could basically assign a handle to a missile since it's treated as a vehicle and can also be manually created by using "handle = missileType createVehicle spawnPosition", which also assigns a handle in the process. I want to do this, so I can interact with that missile, in my particular case attach a camera to it. Just faking that the missile is really being fired by the vehicle won't do it here, since you'll clearly see it while doing so. Any help is appreciated, even if it's just an approach on solving the problem.

Share this post


Link to post
Share on other sites

Try this: http://killzonekid.com/arma-scripting-tutorials-a-simple-bullet-cam/

names the projectile _missile. I have personally dismantled this script to get speed and position of projectiles.

For starters you can just add this (minus the //comment) to the init field of a unit in editor. Also can change "player" to "this" so that it applies to the unit only.

//Original code by Killzone Kid
player addEventHandler ["Fired", {
   _null = _this spawn {
       _missile = _this select 6;
       _cam = "camera" camCreate (position player); 
       _cam cameraEffect ["External", "Back"];
       waitUntil {
           if (isNull _missile) exitWith {true};
           _cam camSetTarget _missile;
           _cam camSetRelPos [0,-3,0];
           _cam camCommit 0;
       };
       sleep 0.4;      
       _cam cameraEffect ["Terminate", "Back"];
       camDestroy _cam;
   };
}];

Also check out his other tutorials, very useful.

Edited by Benargee

Share this post


Link to post
Share on other sites

Thanks, that's exactly what I was searching for. I've tried eventhandlers myself, but I somehow tried using "IncomingMissile" instead of "Fired"... Why do it easy if there's a more complicated approach (that doesn't work)?

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  

×