战网中国
标题:
私服踢桶问题的简单解决
[打印本页]
作者:
白色曼陀螺
时间:
2016-3-31 16:59
标题:
私服踢桶问题的简单解决
本帖最后由 白色曼陀螺 于 2016-6-27 15:29 编辑
function NTTM_KickBox()
{
var _box;
var _boxid = [3222,3260,3256,3236,3301];
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
方法比较暴力,可能不一定100%成功,先试试看吧。
作者:
iamiori
时间:
2016-3-31 17:35
[code brush:cpp;toolbar:false;]var _boxid = [3222, 3260, 3256,3236];
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[0] = [1,localstring_id1, x1, y1, 2,localstring_id2, x2, y2];
//checkitemsdata[0] = [1,3260, 1001, 2001, 2, 3260, 2000,2000, 3, 3260, 3000, 3000];
//比如checkitemsdata[0] = [1,3260, 1001, 2001] 意思是类型1, 桶的名字是3260, 坐标是1001, 2001, 这样,这个地图type就为1
howtomovepath[0][type-1] = [点位x1,点位y1,范围半径r1, 点位x2,点位y2,范围半径r2];
//howtomovepath[0][0] = [x,y,r]; type1的踢桶过路点位和范围
//howtomovepath[0][1] = [x,y,r]; type2的踢桶过路点位和范围
//act2
checkitemsdata[1] = []; //这个是设置每种type的随机地型的独特的桶
howtomovepath[1][0] = []; //这个是第1个type的路线
howtomovepath[1][1] = []; //这个是第2个type的路线
//act3
checkitemsdata[2] = [];
howtomovepath[2][0] = [];
howtomovepath[2][1] = [];
//act4
checkitemsdata[3] = [];
howtomovepath[3][0] = [];
howtomovepath[3][1] = [];
//act5
checkitemsdata[4] = [];
howtomovepath[4][0] = [];
howtomovepath[4][1] = [];
*/
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 < 1)
return false;
_fire = new coord(_fireobject[0].roomx*5 + _fireobject[0].x, _fireobject[0].roomy*5 + _fireobject[0].y);
}
if(testdisplay)
displayer();
var checktype = IORI_CheckType();
if(howtomovepath[me.act-1][checktype-1].lenth >= 3 && checktype > 0)
{
for (var m=0; m< howtomovepath[me.act-1][checktype-1].lenth; m+=3)
{
titongdongzuo(howtomovepath[me.act-1][checktype-1][m], howtomovepath[me.act-1][checktype-1][m+1], howtomovepath[me.act-1][checktype-1][m+2]);
}
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<_boxid.length ; i++)
{
_box = NTC_FindUnit(NTC_UNIT_OBJECT, GetLocaleString(_boxid<i>));
if (_box){
do{
if(GetDistance(fixx+_box.x, fixx+_box.y, me.x, me.y ) < 5)
{
//if(_displaydebug)
Print(\"Barrel: id=\" + _boxid<i> + \" 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<_boxid.length ; i++)
{
_box = NTC_FindUnit(NTC_UNIT_OBJECT, GetLocaleString(_boxid<i>));
if (_box){
do{
if(GetDistance(fixx+_box.x, fixx+_box.y, _nowx, _nowy ) < _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[me.act - 1].length < 4){
Print(\"请正确配置本act的checkitemsdata\");
return 0;
}
var fixx , fixy;
if(me.act != 1)
{
fixx = 0;
fixy = 0;
}
else
{
fixx = _fire.x;
fixy = _fire.y;
}
for ( var p = 0; p < checkitemsdata[me.act - 1].length; p+=4)
{
checkboxids = NTC_FindUnit(NTC_UNIT_OBJECT, GetLocaleString(checkitemsdata[me.act - 1][p+1]));
if(checkboxids)
{
do
{
if(checkboxids.mode != 2 && checkboxids.x == fixx+checkitemsdata[me.act - 1][p+2] && fixy+checkboxids.y == checkitemsdata[me.act - 1][p+3] )
return checkitemsdata[me.act - 1][p];
}
while (checkboxids.GetNext());
}
}
Print(\"本type并无记录\");
return 0;
}[/code]
作者:
iamiori
时间:
2016-3-31 17:37
以上代码是想当然写着的, 有可能多处会有笔误, 自行修正吧.做为bots目录里的一个场所脚本来跑.
配合我的八神bot, 请用美国线路更新. 按home后, 在act1下会显示fix.x和fix.y坐标的
开始,显示身边的桶坐标,照抄
填写,,
然后再del暂停,
一串home回来的坐标。照填,搞定一个type
...
退出房间,进游戏,刷出第二个type,重复做
作者:
yang_lz
时间:
2016-4-1 10:56
大大的福利啊,感谢版主,去测试一下先
作者:
yang_lz
时间:
2016-4-1 10:56
大大的福利
作者:
iamiori
时间:
2016-4-2 11:24
已经更新到服务器...也实测过. 2016-04-01版本
作者:
yang_lz
时间:
2016-4-2 16:47
不行啊@ 白色曼陀螺 直接红字报错了
作者:
trade
时间:
2020-4-10 15:20
谢谢分享,技术贴学习了
作者:
D2-ft
时间:
2020-12-3 00:20
厉害了
作者:
idi
时间:
2021-12-30 08:52
都适合啥bot啊?
欢迎光临 战网中国 (http://battlecn.net/)
Powered by Discuz! X3.1