中国虚拟军事网(VME)- 专注于武装突袭系列虚拟军事游戏

 找回密码
 加入VME

QQ登录

只需一步,快速开始

搜索
查看: 13764|回复: 32

[教程] 新人的子弹视角教程,希望对大家有所帮助

  [复制链接]
发表于 2011-8-21 22:14:24 | 显示全部楼层 |阅读模式
    本人是新手菜鸟,在一次偶然的机会看到了虎子哥制作的视频所以开始玩武装突袭,感觉真的是一款不错的游戏。有一次看到虎子哥视频里狙击后的子弹视角感觉很炫很棒,所以也想自己弄一个。在网上参照了很多的帖子,由于是新手,对脚本什么都不是很懂,一开始不是很顺利,后来看了虎子哥的教学视频,自己不断摸索,终于搞成了。所以想发个给菜鸟们看得贴,分享下,让大家少走点弯路。废话少说,现在开始:

  这次主要还是以虎子哥制作的教学视频为主,顺带一点补充,把几个好贴的精华都集中起来,争取让新人们看完这贴直接就能用上子弹视角。
     


    这里感谢虎子哥的视频,真的对新人们很有帮助。视频中虎子哥把一些脚本代码直接预先准备了,这里我就把我自己找来的脚码贴上来,这样配合视频大家就能直接用上了。

PLAYER预设值:
  1. this addEventHandler ["fired",{_this execVM "cam.sqf"}]
复制代码
观察员预设值:
  1. BD_BulletCam = compile preprocessFileLineNumbers "cam.sqf"; BDKS_DisableBulletCam = false
复制代码
触发器:
  1. BDKS_DisableBulletCam = !BDKS_DisableBulletCam
复制代码
以上这些是预设值的代码,下面是子弹视角的脚本代码,把这些代码直接复制到记事本保存名为cam.sqf就是视频中的子弹时间脚本了(补充下:其中_accTime = 0.1是设置时间快慢的,数值大,时间短;还有在子弹飞行中按小键盘0也就是光学瞄准键可以退出子弹视角):
  1. // Bullet Cam Script
  2. // v1.1
  3. // cam.sqf
  4. // Big Dawg KS
  5. // 7/13/09
  6. //
  7. // Call via Fired EH, ex:
  8. //   this addEventHandler ["fired",{_this execVM "cam.sqf"}]
  9. //
  10. // To exit the camera ingame (while in flight), press the key for ironsights/optics
  11. //
  12. // To add supported weapons, add MUZZLE classnames to _list (note: classnames are CASE SENSITIVE)
  13. //
  14. // To disable bullet cam, set BDKS_DisableBulletCam = true
  15. //
  16. // To disable blur effects, set BDKS_BulletCamNoBlur = true
  17. //
  18. // To disable particle effects, set BDKS_BulletCamNoParticleFX = true
  19. //
  20. // To change FOV (zoom), change the value of BDKS_BulletCamFOV (default 0.1). Ex:
  21. //   BDKS_BulletCamFOV = 0.3
  22. //
  23. // To change time acceleration, change the value of BDKS_BulletCamAccTime (default 0.5). Ex:
  24. //   BDKS_BulletCamAccTime = 0.2
  25. // (Note: AccTime only works in Singleplayer)
  26. //
  27. // To make another unit's (other than local player) bullet cam show for the
  28. // local player, set unit variable BDKS_ShowBulletCamToPlayer = true, ex:
  29. //   if(local Spotter)then{Sniper setVariable ["BDKS_ShowBulletCamToPlayer",true]}
  30. //------------------------------------------------------------------------------------------------

  31. _projectile = nearestObject [_this select 0,_this select 4];

  32. if(call {if(isNil "BDKS_DisableBulletCam")then{true}else{!BDKS_DisableBulletCam}})then{

  33. if((_this select 0) == vehicle player || call {if(isNil {(_this select 0) getVariable "BDKS_ShowBulletCamToPlayer"})then{false}else{(_this select 0) getVariable "BDKS_ShowBulletCamToPlayer"}})then{

  34. // Add more weapons here
  35. _list = ["M40A3","m107","M24","M4SPR","SVD","SVD_CAMO","ksvk","DMR","huntingrifle","SMAW","Javelin","SidewinderLaucher_F35","BombLauncherF35"];

  36. _type = getText (configFile >> "CfgAmmo" >> (_this select 4) >> "simulation");
  37. _relPos = [0,-13,0.1];
  38. _fov = 0.1;
  39. if(!isNil "BDKS_BulletCamFOV")then{_fov = BDKS_BulletCamFOV};
  40. if(_type == "shotMissile" || _type == "shotRocket")then{_relPos = [0,-13,2.2]; _fov = 0.5};

  41. _disablePP = false;
  42. if(call {if(isNil "BDKS_BulletCamNoBlur")then{false}else{BDKS_DisableBulletCam}})then{_disablePP = true};

  43. _accTime = 0.1;
  44. if(!isNil "BDKS_BulletCamAccTime")then{_accTime = BDKS_BulletCamAccTime};

  45. _enableParticles = true;
  46. if(call {if(isNil "BDKS_BulletCamNoParticleFX")then{false}else{BDKS_BulletCamNoParticleFX}})then{_enableParticles = false};

  47. if((_this select 2) in _list && !(isNull _projectile))then{
  48.         setAccTime _accTime;
  49.         _camera = "camera" camCreate (getPos _projectile);
  50.         _camera cameraEffect ["INTERNAL","BACK"];
  51.         showCinemaBorder false;
  52.         cutText ["","BLACK IN",0.2];
  53.         _cancel = false;

  54.         if(_enableParticles && _type == "ShotBullet")then{
  55.                 _pShape = ["\ca\Data\ParticleEffects\Universal\Universal.p3d", 16, 13, 3, 0];
  56.                 _pSize = [0.01,0.1];
  57.                 _pColor = [[1,1,1,0.08],[1,1,1,0.16],[1,1,1,0.03],[1,1,1,0]];

  58.                 _pSource = "#particlesource" createVehicleLocal (getPos _projectile);
  59.                 _pSource attachTo [_projectile,[0,0,0]];
  60.                 _pSource setParticleParams [_pShape,"","Billboard",1,0.3,[0,0,0],[0,0,0],0,1,0.79,0.18,_pSize,_pColor,[1000],100,0.01,"","",_projectile,360];
  61.                 _pSource setDropInterval 0.001;
  62.         };

  63.         while{alive _projectile && alive _camera && !_cancel}do{
  64.                 _camera camSetTarget _projectile;
  65.                 _camera camSetRelPos _relPos;
  66.                 _camera camSetFOV _fov;
  67.                 _camera camSetFocus [600,2];
  68.                 _camera camCommit 0;

  69.                 "RadialBlur" ppEffectAdjust [0.02,0.02,0.1,0.1];
  70.                 "RadialBlur" ppEffectCommit 0.01;
  71.                 if(!_disablePP)then{"RadialBlur" ppEffectEnable true};

  72.                 if(inputAction "optics" != 0)then{_cancel = true};

  73.                 sleep 0.001;
  74.         };
  75.         if(alive _camera && !_cancel)then{
  76.                 _camera camSetFocus [-(_relPos select 1),1];
  77.                 _camera camSetFOV (_fov * 1.6);
  78.                 _camera camCommit 1.5;

  79.                 "RadialBlur" ppEffectAdjust [0,0,1,1];
  80.                 "RadialBlur" ppEffectCommit 0.7;

  81.                 sleep 1.39;
  82.         };
  83.         cutText ["","BLACK OUT",0.1];
  84.         sleep 0.11;
  85.         setAccTime 1;
  86.         "RadialBlur" ppEffectEnable false;
  87.         _camera cameraEffect ["TERMINATE","BACK"];
  88.         camDestroy _camera;
  89.         if(_enableParticles)then{deleteVehicle _pSource};
  90.         cutText ["","BLACK IN",0.6];
  91. };

  92. };

  93. };
复制代码
希望这个帖子对一些新玩家们有帮助,最后再一次向虎子哥致敬,谢谢你为大家制作了这么多优秀的教学视频!!!

 楼主| 发表于 2011-8-21 22:16:37 | 显示全部楼层
{:soso_e100:}自己先顶一下!!

评分

参与人数 1威望 +1 收起 理由
rasy + 1 原创内容

查看全部评分

发表于 2011-8-21 22:27:49 | 显示全部楼层
这个我还是头一次知道,居然有击穿和跳弹
发表于 2011-8-22 11:05:30 | 显示全部楼层
是不是把最后一个列表的脚步1-112放在cam.sqf文件档里面·用笔记本打开。
发表于 2011-8-22 11:59:37 | 显示全部楼层
很好,顶起,研究研究
 楼主| 发表于 2011-8-22 22:52:52 | 显示全部楼层
被加精了啊,开心!
发表于 2011-8-23 00:41:06 | 显示全部楼层
我试了试这个版本的脚本,不知道什么原因就是不管用,于是在坛子里找到了另外一个1.2版本的,结果这个是可以用的。具体什么原因不清楚,贴上来让高手看看(如果有和我一样情况的朋友,不妨试试这个版本)

// Bullet Cam Script
// v1.2
// cam.sqf
// Big Dawg KS
// 2/14/11
//
// Call via Fired EH, ex:
//   this addEventHandler ["fired",{_this call compile preprocessFileLineNumbers "cam.sqf"}]
//
// To exit the camera ingame (while in flight), press the key for ironsights/optics
//
// To add supported weapons, add MUZZLE classnames to _list (note: classnames are CASE SENSITIVE)
//
// To disable bullet cam, set BDKS_DisableBulletCam = true
//
// To disable blur effects, set BDKS_BulletCamNoBlur = true
//
// To disable particle effects, set BDKS_BulletCamNoParticleFX = true
//
// To change FOV (zoom), change the value of BDKS_BulletCamFOV (default 0.05). Ex:
//   BDKS_BulletCamFOV = 0.3
//
// To change time acceleration, change the value of BDKS_BulletCamAccTime (default 0.5). Ex:
//   BDKS_BulletCamAccTime = 0.2
// (Note: AccTime only works in Singleplayer)
//
// To make another unit's (other than local player) bullet cam show for the
// local player, set unit variable BDKS_ShowBulletCamToPlayer = true, ex:
//   if(local Spotter)then{Sniper setVariable ["BDKS_ShowBulletCamToPlayer",true]}
//------------------------------------------------------------------------------------------------

_projectile = nearestObject [_this select 0,_this select 4];
if(count _this >= 7)then{
        _projectile = _this select 6;
};

if(call {if(isNil "BDKS_DisableBulletCam")then{true}else{!BDKS_DisableBulletCam}})then{

if((_this select 0) == vehicle player || call {if(isNil {(_this select 0) getVariable "BDKS_ShowBulletCamToPlayer"})then{false}else{(_this select 0) getVariable "BDKS_ShowBulletCamToPlayer"}})then{

// Add more weapons here
_list = ["M40A3","m107","M24","M4SPR","SVD","SVD_CAMO","ksvk","DMR","huntingrifle","SMAW","Javelin","SidewinderLaucher_F35","BombLauncherF35"];

_type = getText (configFile >> "CfgAmmo" >> (_this select 4) >> "simulation");
_relPos = [0,-13,0.05];
_fov = 0.05;
if(!isNil "BDKS_BulletCamFOV")then{_fov = BDKS_BulletCamFOV};
if(_type == "shotMissile" || _type == "shotRocket")then{_relPos = [0,-13,2.2]; _fov = 0.5};

_disablePP = false;
if(call {if(isNil "BDKS_BulletCamNoBlur")then{false}else{BDKS_DisableBulletCam}})then{_disablePP = true};

_accTime = 0.1;
if(!isNil "BDKS_BulletCamAccTime")then{_accTime = BDKS_BulletCamAccTime};

_enableParticles = true;
if(call {if(isNil "BDKS_BulletCamNoParticleFX")then{false}else{BDKS_BulletCamNoParticleFX}})then{_enableParticles = false};

if((_this select 2) in _list && !(isNull _projectile))then{
        setAccTime _accTime;
        _camera = "camera" camCreate (getPosATL _projectile);
        _camera cameraEffect ["INTERNAL","BACK"];
        showCinemaBorder false;
        cutText ["","BLACK IN",0.2];
        _pSource = objNull;

        if(_enableParticles && _type == "ShotBullet")then{
                _pShape = ["\ca\Data\ParticleEffects\Universal\Universal.p3d", 16, 13, 3, 0];
                _pSize = [0.01,0.05];
                _pColor = [[1,1,1,0.08],[1,1,1,0.16],[1,1,1,0.03],[1,1,1,0]];

                _pSource = "#particlesource" createVehicleLocal (getPos _projectile);
                _pSource attachTo [_projectile,[0,0,0]];
                _pSource setParticleParams [_pShape,"","Billboard",1,0.3,[0,0,0],[0,0,0],0,1,0.79,0.18,_pSize,_pColor,[1000],100,0.01,"","",_projectile,360];
                _pSource setDropInterval 0.001;
        };

        [_projectile,_camera,_relPos,_fov,_pSource,_disablePP] spawn {

        _projectile = _this select 0;
        _camera = _this select 1;
        _relPos = _this select 2;
        _fov = _this select 3;
        _pSource = _this select 4;
        _disablePP = _this select 5;

        _cancel = false;

        while{alive _projectile && alive _camera && !_cancel}do{
                _camera camSetTarget _projectile;
                _camera camSetRelPos _relPos;
                _camera camSetFOV _fov;
                _camera camSetFocus [600,2];
                _camera camCommit 0;

                "RadialBlur" ppEffectAdjust [0.02,0.02,0.1,0.1];
                "RadialBlur" ppEffectCommit 0.01;
                if(!_disablePP)then{"RadialBlur" ppEffectEnable true};

                if(inputAction "optics" != 0)then{_cancel = true};

                sleep 0.001;
        };
        if(alive _camera && !_cancel)then{
                _camera camSetFocus [-(_relPos select 1),1];
                _camera camSetFOV (_fov * 1.6);
                _camera camCommit 1.5;

                "RadialBlur" ppEffectAdjust [0,0,1,1];
                "RadialBlur" ppEffectCommit 0.7;

                sleep 1.39;
        };
        cutText ["","BLACK OUT",0.1];
        sleep 0.11;
        setAccTime 1;
        "RadialBlur" ppEffectEnable false;
        _camera cameraEffect ["TERMINATE","BACK"];
        camDestroy _camera;
        if(!isNull _pSource)then{deleteVehicle _pSource};
        cutText ["","BLACK IN",0.6];

        };
};

};

};
发表于 2011-8-23 19:43:02 | 显示全部楼层
是啊,楼主的脚本不能用
发表于 2011-8-23 19:43:48 | 显示全部楼层
sanmao2007 发表于 2011-8-23 00:41
我试了试这个版本的脚本,不知道什么原因就是不管用,于是在坛子里找到了另外一个1.2版本的,结果这个是可以 ...

能用了,但是没反弹效果啊
发表于 2011-8-23 19:59:36 | 显示全部楼层
JDLSNIPER 发表于 2011-8-23 19:43
能用了,但是没反弹效果啊

能做出虎子哥的那种反弹效果吗?楼主的那个我也用不了
发表于 2011-8-23 20:53:06 | 显示全部楼层
JDLSNIPER 发表于 2011-8-23 19:59
能做出虎子哥的那种反弹效果吗?楼主的那个我也用不了

反弹效果要看子弹的射击角度,应该可以实现
发表于 2011-8-23 21:43:08 | 显示全部楼层
试试看了
发表于 2011-8-24 08:07:42 | 显示全部楼层
还是没做出击穿和反弹效果,能指点一下吗
发表于 2011-8-27 17:21:54 | 显示全部楼层
结合虎子哥的视频和你的代码还有sanmao2007 的脚本,我终于成功了,在此感谢虎子哥,atlantisydney ,sanmao2007 。
发表于 2011-10-3 21:16:00 | 显示全部楼层
本帖最后由 xian875 于 2011-10-3 21:26 编辑
sanmao2007 发表于 2011-8-23 00:41
我试了试这个版本的脚本,不知道什么原因就是不管用,于是在坛子里找到了另外一个1.2版本的,结果这个是可以 ...


1.1版本有bug,有时可以有时又不行!这个不错,可用!!好过瘾!!!可以看到有些人中枪后的表情,有的闭眼,有的死不瞑目。。。。。。





本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入VME

x
您需要登录后才可以回帖 登录 | 加入VME

本版积分规则

小黑屋|中国虚拟军事网

GMT+8, 2024-4-19 13:51

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表