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

 找回密码
 加入VME

QQ登录

只需一步,快速开始

搜索
查看: 2843|回复: 10

求脚本:重机枪射手被杀,附近的ai自动顶上去

[复制链接]
发表于 2011-11-17 23:37:57 | 显示全部楼层 |阅读模式
static类武器(大口径机枪和自动榴弹发射器)配合若干步兵组成小队,可以在防守中取得很好的效果,但static武器的炮手经常被打死,导致威力巨大的武器无人操作。

求一个脚本,让AI小队检测到本队内有人死在static类武器的炮手位置上时,会自动叫一个本队的士兵顶上去。就像闪点的解放模组里面一样。
发表于 2011-11-18 11:24:58 | 显示全部楼层
in,assignAsGunner,nearestObjects ,
 楼主| 发表于 2011-11-19 00:23:39 | 显示全部楼层
piko 发表于 2011-11-18 11:24
in,assignAsGunner,nearestObjects ,

nearestObjects不分敌我,混战起来万一ai跑到敌人那边去了咋办。

怎样判断是否是本队士兵阵亡后空出来的机枪,我让AI小队只派人登上属于自己小队的机枪。
发表于 2011-11-19 02:00:09 | 显示全部楼层

#getin
~2
_man=nearestObject [_this, "SoldierWB"]
? !(alive _this) : exit
if !(alive _man) then {deleteVehicle _man}
if(count(crew a)<1) then{_man assignAsGunner _this,[_man] orderGetIn true,hint format["%1",_man]}
goto "getin"
 楼主| 发表于 2011-11-20 09:10:03 | 显示全部楼层
piko 发表于 2011-11-19 02:00
#getin
~2
_man=nearestObject [_this, "SoldierWB"]

if(count(crew a)<1) 里面的a是什么?应该打错了,是_this吧。

这段脚本是让离没有人的重机枪_this最近的一个西方阵营士兵进入机枪,虽然和我提出的要求有点不一样,但还是有用的,谢啦。
发表于 2011-11-20 12:02:24 | 显示全部楼层
这个要求好像不难,正好无聊在玩编辑器,我去写个....
发表于 2011-11-20 13:19:45 | 显示全部楼层
经过几次调整稍微测试了下,似乎没发现bug.

_unit = _this select 0;
if(!(_unit isKindOf "StaticWeapon")) exitWith {hint "fan_gunner.sqf for StaticWeapon only";};
waitUntil {!(isNull gunner _unit)};
_victim = gunner _unit;
_nearUnits = units group _victim;

while {(alive _unit) && (count magazines _unit) > 0 && (count _nearUnits) > 0} do
{
  if (isNull gunner _unit) then
     {
      {if((!alive _x)||(vehicle _x != _x))then{_nearUnits = _nearUnits - [_x];};}forEach _nearUnits;
      _nearUnit = if ((count _nearUnits) > 1) then {_nearUnits select 1} else {_nearUnits select 0};
      _nearUnit assignAsGunner _unit;
      [_nearUnit] orderGetIn true;
      sleep 2 ;
      } else { sleep 2 ;};
// hint Format["%1\n%2\n%3 ",gunner _unit,_nearUnits,magazines _unit];
};
if(true) exitWith {};   

评分

参与人数 1威望 +1 收起 理由
FFUR2007SLX2_5 + 1 帮助战友

查看全部评分

 楼主| 发表于 2011-11-20 23:18:42 | 显示全部楼层
fan 发表于 2011-11-20 13:19
经过几次调整稍微测试了下,似乎没发现bug.

_unit = _this select 0;

我试过了,确实有用 谢谢了
发表于 2013-10-12 10:04:56 | 显示全部楼层
复杂了吧。
我想先弄个空的机枪,然后设定个士兵进入机枪。(士兵 moveingunner 机枪)
然后判定这个士兵死亡后,(not (alive 士兵))下一个有名字的士兵进入机枪。(下一个有名字的士兵 moveingunner 机枪)
,,,哈哈哈,笨方法,见笑。
发表于 2013-10-13 12:23:58 | 显示全部楼层
完全看不懂,都是大神呐
发表于 2015-6-24 16:22:29 | 显示全部楼层
fan 发表于 2011-11-20 13:19
经过几次调整稍微测试了下,似乎没发现bug.

_unit = _this select 0;

这重机枪人员补充的脚本不错
您需要登录后才可以回帖 登录 | 加入VME

本版积分规则

小黑屋|中国虚拟军事网

GMT+8, 2024-4-20 09:14

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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