Advertisement

Author Topic: Bullet Cam  (Read 794 times)

0 Members and 1 Guest are viewing this topic.

Offline greg147

  • Contributing Member
  • **
    • Royal Air Assault Battalion
Bullet Cam
« on: 16 May 2007, 16:28:48 »
Hi all,

I'm trying to get a bullet cam to work on a single shot from a sniper rifle. I've taken a look at Kronzky's Portable Target Range, which uses this feature, but I have no idea how it works. I'm unfamiliar with the .sqf format aswell.

So does anyone know how to get this working in ArmA?

Thanks
Royal Air Assault Battalion - [L/Cpl] Greg
RAAB

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Bullet Cam
« Reply #1 on: 16 May 2007, 18:32:12 »
Same as in ofp: eventhandler fired getting the nearestobject of the type of ammo inside the event handler code and then removing the event handler so it works only for first bullet fired. Once you get the bullet object, just create a camera to follow it or use bullet switchCamera "EXTERNAL" and wait til isNull bullet.

For example:
bullethandler = player addEventHandler ["fired", {[_this] exec "getbullet.sqf"}]

Code: [Select]
//getbullet.sqf
_unit = _this select 0;
_type = _this select 4;
_unit removeEventHandler bullethandler;
_bullet = nearestObject  [_unit, _type];
if (!isNull _bullet) then
{
   _bullet switchCamera "EXTERNAL";
   waitUntil{isNull _bullet};
   player switchCamera "INTERNAL";
};

Offline greg147

  • Contributing Member
  • **
    • Royal Air Assault Battalion
Re: Bullet Cam
« Reply #2 on: 16 May 2007, 19:00:19 »
Thanks

For that example, where would I put
Code: [Select]
bullethandler = player addEventHandler ["fired", {[_this] exec "getbullet.sqf"}]
I'm getting an error when trying it:

'_bullet = |#|nearestObject  |_unit, |type];'
Error Type Array, expected Number
Royal Air Assault Battalion - [L/Cpl] Greg
RAAB

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Bullet Cam
« Reply #3 on: 16 May 2007, 19:53:41 »
I asked a similar question a while ago to target the bomb of an aircraft. It also works for anything that fires.

http://www.ofpec.com/forum/index.php?topic=29139.0

Hope this helps.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Bullet Cam
« Reply #4 on: 16 May 2007, 20:40:54 »
ups, change exec by execVM

Offline greg147

  • Contributing Member
  • **
    • Royal Air Assault Battalion
Re: Bullet Cam
« Reply #5 on: 17 May 2007, 00:45:43 »
Got it working, thanks for the help lads
Royal Air Assault Battalion - [L/Cpl] Greg
RAAB