白色曼陀螺 发表于 2016-3-31 16:59:50

私服踢桶问题的简单解决

本帖最后由 白色曼陀螺 于 2016-6-27 15:29 编辑

function NTTM_KickBox()
{
    var _box;
    var _boxid = ;
      
      
    for (var i = 0; i<_boxid.length ; i++)
    {
      _box = NTC_FindUnit(NTC_UNIT_OBJECT,GetLocaleString(_boxid<i>));
      if (_box && _box.areaid==me.areaid){
            do{
                NTC_OpenChest(_box);
                Delay(100);
            }
            while (_box.GetNext());
      }
    }
}
第一步将上边函数添加到NTTownMove.ntl结尾。
第二步找到此文件的第一个函数NTTM_TownMove(spot),在此函数的开头大括号后边加一行NTTM_KickBox();

就像下边这样:
function NTTM_TownMove(spot)
{
      NTTM_KickBox();






白色曼陀螺 发表于 2016-3-31 17:00:33

方法比较暴力,可能不一定100%成功,先试试看吧。

iamiori 发表于 2016-3-31 17:35:55

var _boxid = ;
var _fireobject;
var _fire;
//var acttypelegth = new Array();
var checkitemsdata = new Array(5);
var checkboxids;
var howtomovepath = new Array(5);
var testdisplay = true;//正式使用时, 改成false;
/*
//进入游戏后,按暂停del或pause(暂时不要太快.脚本一开始,太快暂停会卡死), 按home即可显示人物所站立的x,y ps:act1填写fix.x和fix.y的值, 其它act直接用x,y, 这坐标是用来写过路点的
//通过按del来暂停或开始游戏, 会显示离自己5码以内的桶的坐标.
//小技巧, 进入房间后,把多余的桶踢掉,只剩下那个独有的桶.就只显示一个了
//localstring_id去SDK的localstring里面查.
//act1的设置
checkitemsdata = ;
//checkitemsdata = ;
//比如checkitemsdata = 意思是类型1, 桶的名字是3260, 坐标是1001, 2001, 这样,这个地图type就为1
howtomovepath = [点位x1,点位y1,范围半径r1,    点位x2,点位y2,范围半径r2];
//howtomovepath = ; type1的踢桶过路点位和范围
//howtomovepath = ; type2的踢桶过路点位和范围
      
      
//act2
checkitemsdata = [];    //这个是设置每种type的随机地型的独特的桶
howtomovepath = [];//这个是第1个type的路线
howtomovepath = [];//这个是第2个type的路线
      
//act3
checkitemsdata = [];
howtomovepath = [];
howtomovepath = [];
      
//act4
checkitemsdata = [];
howtomovepath = [];
howtomovepath = [];
      
//act5
checkitemsdata = [];
howtomovepath = [];
howtomovepath = [];
*/
      
function NTMain()
{
    //Include(\"libs/common/IoriCube.ntl\");
    Include(\"libs/common/NTCommon.ntl\");
    NTC_IncludeLibs();
    Include(\"libs/common/IoriAddAcc.ntl\");
    NTC_IncludeConfig(\"NTBot/char_configs\");
    NT_LoadConfig();
    NTSI_LoadNIPFiles(\"NTBot/item_configs\",false);
      
    me.maxgametime = 0;
    NTA_Initialize();
      
    NTTM_CheckAct();
    if(me.act == 1)
    {
      _fireobject = GetPresetUnits(me.areaid, NTC_UNIT_OBJECT, 39);
      
      if(!_fireobject || _fireobject.length &lt; 1)
            return false;
      _fire = new coord(_fireobject.roomx*5 + _fireobject.x, _fireobject.roomy*5 + _fireobject.y);
    }
    if(testdisplay)
      displayer();
      
    var checktype = IORI_CheckType();
    if(howtomovepath.lenth &gt;= 3 && checktype &gt; 0)
    {
      for (var m=0; m&lt; howtomovepath.lenth; m+=3)
      {
            titongdongzuo(howtomovepath, howtomovepath, howtomovepath);
      }
      Print(\"over titong\");
    }
    else
    {
      Print(\"路径参数howtomovepathk[\" + (me.act-1) + \"][\" + (checktype-1) + \"]设置不正确\");
      Delay(10000);
    }
    Delay(3000); //3秒延时
    NTC_SendMsgToScript(\"NTBotGame.ntj\", \"SCRIPT_END\");
      
}
function displayer()
{
    if(me.act != 1)
    {
      fixx = 0;
      fixy = 0;
    }
    else
    {
      fixx = _fire.x;
      fixy = _fire.y;
    }
    for (var i = 0; i&lt;_boxid.length ; i++)
    {
      _box = NTC_FindUnit(NTC_UNIT_OBJECT,GetLocaleString(_boxid&lt;i&gt;));
      if (_box){
            do{
                if(GetDistance(fixx+_box.x, fixx+_box.y, me.x, me.y ) &lt; 5)
                {
                  //if(_displaydebug)
                  Print(\"Barrel: id=\" + _boxid&lt;i&gt; + \" x=\"+ _box.x + \", y=\" + _box.y + \"(fix.x=\"+ (_box.x - fixx) +\",fix.y=\"+ (_box.y - fixy));
                  Delay(100);
                }
            }
            while (_box.GetNext());
      }
    }
      
}
      
function titongdongzuo(_x, _y, _ra)
{
    if(me.act == 1)
      NTTM_TownMoveXY(_fire.x+_x, _fire.y+_y);
    else
      NTTM_TownMoveXY(_x, _y);
    var _nowx = me.x;
    var _nowy = me.y;
    var _box;
    var fixx , fixy;
    if(me.act != 1)
    {
      fixx = 0;
      fixy = 0;
    }
    else
    {
      fixx = _fire.x;
      fixy = _fire.y;
    }
    for (var i = 0; i&lt;_boxid.length ; i++)
    {
      _box = NTC_FindUnit(NTC_UNIT_OBJECT,GetLocaleString(_boxid&lt;i&gt;));
      if (_box){
            do{
                if(GetDistance(fixx+_box.x, fixx+_box.y, _nowx, _nowy ) &lt; _ra)
                {
                  if(me.act != 1)
                        Print(\"Barrel: x=\"+ _box.x + \", y=\" + _box.y);
                  else
                        Print(\"Barrel: fix.x=\"+ (_box.x-_fire.x) + \", fix.y=\" + (_box.y-_fire.y));
                  NTC_OpenChest(_box);
                  Delay(100);
                }
            }
            while (_box.GetNext());
      }
    }
}
      
function IORI_CheckType()
{
      if(checkitemsdata.length &lt; 4){
            Print(\"请正确配置本act的checkitemsdata\");
            return0;
      }
      var fixx , fixy;
      if(me.act != 1)
      {
            fixx = 0;
            fixy = 0;
      }
      else
      {
            fixx = _fire.x;
            fixy = _fire.y;
      }
      for ( var p = 0; p &lt; checkitemsdata.length; p+=4)
      {
            checkboxids = NTC_FindUnit(NTC_UNIT_OBJECT,GetLocaleString(checkitemsdata));
            if(checkboxids)
            {
                do
                {
                  if(checkboxids.mode != 2 && checkboxids.x == fixx+checkitemsdata && fixy+checkboxids.y == checkitemsdata )
                        return checkitemsdata;
                }
                while (checkboxids.GetNext());
            }
      }
      
      Print(\"本type并无记录\");
      return 0;
}

iamiori 发表于 2016-3-31 17:37:38

以上代码是想当然写着的, 有可能多处会有笔误, 自行修正吧.做为bots目录里的一个场所脚本来跑.

配合我的八神bot, 请用美国线路更新. 按home后, 在act1下会显示fix.x和fix.y坐标的



开始,显示身边的桶坐标,照抄
填写,,
然后再del暂停,



一串home回来的坐标。照填,搞定一个type
...
退出房间,进游戏,刷出第二个type,重复做

yang_lz 发表于 2016-4-1 10:56:25

大大的福利啊,感谢版主,去测试一下先

yang_lz 发表于 2016-4-1 10:56:53

大大的福利

iamiori 发表于 2016-4-2 11:24:51

已经更新到服务器...也实测过.2016-04-01版本

yang_lz 发表于 2016-4-2 16:47:09

不行啊@ 白色曼陀螺直接红字报错了

trade 发表于 2020-4-10 15:20:32

谢谢分享,技术贴学习了

D2-ft 发表于 2020-12-3 00:20:16

厉害了
页: [1] 2
查看完整版本: 私服踢桶问题的简单解决