Welcome, Guest Thursday 24th April 2014, 06:48:36
   Home   Help Search Login Register  

OFPEC Forum

Author Topic: Bullet Cam  (Read 765 times)
0 Members and 1 Guest are viewing this topic.
greg147
Contributing Member
**
Offline Offline


WWW
« on: 16 May 2007, 15: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
Logged

Royal Air Assault Battalion - [L/Cpl] Greg
RAAB
Mandoble
Editors Depot
Administrator
*****
Offline Offline



WWW
« Reply #1 on: 16 May 2007, 17: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:
//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";
};
Logged

greg147
Contributing Member
**
Offline Offline


WWW
« Reply #2 on: 16 May 2007, 18:00:19 »

Thanks

For that example, where would I put
Code:
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
Logged

Royal Air Assault Battalion - [L/Cpl] Greg
RAAB
JasonO
OFPEC Patron
****
Offline Offline


Oh no...


WWW
« Reply #3 on: 16 May 2007, 18: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.
Logged

Mandoble
Editors Depot
Administrator
*****
Offline Offline



WWW
« Reply #4 on: 16 May 2007, 19:40:54 »

ups, change exec by execVM
Logged

greg147
Contributing Member
**
Offline Offline


WWW
« Reply #5 on: 16 May 2007, 23:45:43 »

Got it working, thanks for the help lads
Logged

Royal Air Assault Battalion - [L/Cpl] Greg
RAAB
Pages: [1]   Go Up
  Send this topicPrint  
 
Jump to: