OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: greg147 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
-
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"}]
//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";
};
-
Thanks
For that example, where would I put 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
-
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 (http://www.ofpec.com/forum/index.php?topic=29139.0)
Hope this helps.
-
ups, change exec by execVM
-
Got it working, thanks for the help lads