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

 找回密码
 加入VME

QQ登录

只需一步,快速开始

搜索
查看: 2241|回复: 8

ACR洪水的编写与使用/如何退潮

[复制链接]
发表于 2012-8-4 14:53:08 | 显示全部楼层 |阅读模式
本帖最后由 FFUR2007SLX2_5 于 2012-8-4 15:09 编辑

ACR洪水的编写与使用

洪水的使用方法由BI forum MuzzleFlash提供的一段代码:

使用方法将代码复制到任意名的后缀为sqf文档中,比如为test.sqf. 并将其放入user任务中,进入游戏加载任务并在空白处新建一个Logic,在其初始化栏中输入fnc = [this,500] execVM "test.sqf";其中500为任意数字,意为洪水的范围。

附上图,大家随意,注,需要将你的游戏升级至1.62版本:
  1. private ["_aslHeight","_pond","_yPos","_xPos","_pondSize","_ponds","_centerPosASL","_size","_pondClass","_waterHeightASL","_lenTiles"];

  2. _pondSize = 52;

  3. _centerPosASL = _this select 0;
  4. if (typeName _centerPosASL == "OBJECT") then { _centerPosASL = getPosASL _centerPosASL; };
  5. _size = _this select 1;
  6. _aslHeight = if (count _this > 2) then {_this select 2} else {0.4};

  7. _ponds = [];
  8. _waterHeightASL = (_centerPosASL select 2) + _aslHeight;
  9. _lenTiles = ceil ((_size) / _pondSize);
  10. _ponds resize (_lenTiles * _lenTiles);
  11. _pondClass = "pond_ACR";

  12. _xPos = (_centerPosASL select 0) - (_lenTiles * _pondSize) / 2;
  13. for "_i" from 0 to (_lenTiles-1) do {
  14.     _yPos = (_centerPosASL select 1) - (_lenTiles * _pondSize) / 2;
  15.     for "_j" from 0 to (_lenTiles-1) do {
  16.         _pond = createVehicle [_pondClass, [0,0,0], [], 0, "NO_COLLIDE"];
  17.         _pond setDir 0;
  18.         _pond setPosASL [_xPos, _yPos, _waterHeightASL];
  19.         _yPos = _yPos + _pondSize;
  20.         //hint str (_i * _lenTiles + _j);
  21.         _ponds set [_i * _lenTiles + _j, _pond];
  22.     };
  23.     _xPos = _xPos + _pondSize;
  24. };

  25. _ponds  
复制代码
此方法的洪水高度是根据logic的高度而定的,目的是为了使用简单,当然你也可以再加一个_this select 2用来自定义高度,但不要太高,否则你要重新设定你的高度,不然你就能在水下任意行走,交火。

如果各位感兴趣的话可以设置潮汐,水平面上下沉浮。

如果大家懒得编辑就下载吧:

本帖子中包含更多资源

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

x
 楼主| 发表于 2012-8-4 15:08:20 | 显示全部楼层
本帖最后由 FFUR2007SLX2_5 于 2012-8-4 15:42 编辑

如何退潮?

在代码的最后部分这么写:
  1. private ["_aslHeight","_pond","_yPos","_xPos","_pondSize","_ponds","_centerPosASL","_size","_pondClass","_waterHeightASL","_lenTiles"];

  2. _pondSize = 52;

  3. _centerPosASL = _this select 0;
  4. if (typeName _centerPosASL == "OBJECT") then { _centerPosASL = getPosASL _centerPosASL; };
  5. _size = _this select 1;
  6. _aslHeight = if (count _this > 2) then {_this select 2} else {0.4};

  7. _ponds = [];
  8. _waterHeightASL = (_centerPosASL select 2) + _aslHeight;
  9. _lenTiles = ceil ((_size) / _pondSize);
  10. _ponds resize (_lenTiles * _lenTiles);
  11. _pondClass = "pond_ACR";

  12. _xPos = (_centerPosASL select 0) - (_lenTiles * _pondSize) / 2;
  13. for "_i" from 0 to (_lenTiles-1) do {
  14.     _yPos = (_centerPosASL select 1) - (_lenTiles * _pondSize) / 2;
  15.     for "_j" from 0 to (_lenTiles-1) do {
  16.         _pond = createVehicle [_pondClass, [0,0,0], [], 0, "NO_COLLIDE"];
  17.         _pond setDir 0;
  18.         _pond setPosASL [_xPos, _yPos, _waterHeightASL];
  19.         _yPos = _yPos + _pondSize;
  20.         //hint str (_i * _lenTiles + _j);
  21.         _ponds set [_i * _lenTiles + _j, _pond];
  22.     };
  23.     _xPos = _xPos + _pondSize;
  24. };

  25. while {_waterHeightASL > 0} do {
  26. sleep 60;
  27. _pond setPosASL [_xPos, _yPos, (_waterHeightASL - 0.1)];
  28. _waterHeightASL  = _waterHeightASL  - 0.1;
  29. };
  30. //每个1分钟水面降低0.1m,这可以随便写,也可以越涨越高。
  31. _ponds  
复制代码
每个1分钟水面降低0.1m,这可以随便写,也可以越涨越高.
发表于 2012-8-4 15:21:11 | 显示全部楼层
洪水是全地图状态的吗?没有洪水的边沿的?
发表于 2012-8-4 17:06:14 | 显示全部楼层
这样的话,AA3中河流应该可以实现了
发表于 2012-8-4 18:41:06 | 显示全部楼层
你这显卡实在是……
 楼主| 发表于 2012-8-4 19:10:38 | 显示全部楼层
Alex.XP 发表于 2012-8-4 18:41
你这显卡实在是……

显卡中的战斗机......
发表于 2012-8-5 12:49:10 | 显示全部楼层
战斗机中的轰炸机了
发表于 2012-8-6 14:11:19 | 显示全部楼层
所以哪兩個參數是指定水面高度跟實際高度???

想做一個颱風救災任務~!
 楼主| 发表于 2012-8-7 14:07:46 | 显示全部楼层
a8325811 发表于 2012-8-6 14:11
所以哪兩個參數是指定水面高度跟實際高度???

想做一個颱風救災任務~!

实际高度为Logic高度,如果Logic低于0.4m则默认水面最低为0.4m.

点评

謝謝~!那我知道該改哪個了  发表于 2012-8-8 17:32
您需要登录后才可以回帖 登录 | 加入VME

本版积分规则

小黑屋|中国虚拟军事网

GMT+8, 2024-5-17 20:18

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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