Hey Muddy, thanks for all your hard work going in to this. I've been using it for about a week now and am having great results. Of course, this is not without hiccups, but I've got through most of them.
Anyway, I just wanted to contribute back a bit. The NTCows.ntj file does not properly work. The whole semicolon problem is detailed out in other threads, so I won't go over fixing that. However, items are not picked up unless you have instant-pick enabled in your config. So, I have went ahead and fixed a few things in the script to make it better. I searched everywhere and could not find this already having been done, which is why I am posting it here for everyone. The only thing I have to note is that the CheckSelfSafe functionality never worked either (the way the original code is written the safety is always 0, so never check), but I have been unable to fix that. So, I just commented it out and if someone can get that working it would be cool.
Just copy and paste the modified functions in NTCows.ntj:
Add this line to your character config and alter the settings as desired:
Anyway, I just wanted to contribute back a bit. The NTCows.ntj file does not properly work. The whole semicolon problem is detailed out in other threads, so I won't go over fixing that. However, items are not picked up unless you have instant-pick enabled in your config. So, I have went ahead and fixed a few things in the script to make it better. I searched everywhere and could not find this already having been done, which is why I am posting it here for everyone. The only thing I have to note is that the CheckSelfSafe functionality never worked either (the way the original code is written the safety is always 0, so never check), but I have been unable to fix that. So, I just commented it out and if someone can get that working it would be cool.
Just copy and paste the modified functions in NTCows.ntj:
Code:
function NTR_MoveTo(areaId, x, y, retry, isClearPath)
{
if (x == me.x && y == me.y)
return true;
if (arguments.length < 4)
retry = 3;
if (arguments.length < 5)
isClearPath = false;
var j;
var _path;
var _preX, _preY;
_path = GetPath(areaId, me.x, me.y, x, y, true);
if (!_path)
return false;
for (var i = 0; i < _path.length; i++)
{
if (NTR_CheckCowKing() || NTR_CheckSafe(_path[i][0], _path[i][1], 15))
{
for (j = 0; j < retry; j++)
{
if (NTM_MoveTo(me.areaid, _path[i][0], _path[i][1]))
break;
}
if (j >= retry)
return false;
}
if (isClearPath && !NTR_CheckCowKing())
{
_preX = me.x;
_preY = me.y;
if(!MWR_ClearPosition(30, MWConfig_CowPickItems, /* MWConfig_SafeLevel, */ MWConfig_CowOpenChests, MWConfig_CowFindItem))
return false;
NTP_DoPrecast();
if (me.x != _preX || me.y != _preY)
{
if (!NTM_MoveTo(me.areaid, _preX, _preY))
return false;
}
}
}
return true;
}
Code:
function MWR_ClearPosition(range, pickitem, /* safelevel, */ openchests, usefinditem)
{
var _orgx, _orgy;
var _skiplist;
var _attackcount = 0;
var _target;
var _distance, _mingid, _mindistance;
var _result;
_orgx = me.x;
_orgy = me.y;
for(var i = 0; i < 3; i++)
{
_skiplist = new Array();
while(_attackcount < (i+1)*100)
{
if(NTR_CheckCowKing())
return false;
_mindistance = 1E6;
_target = NTC_FindUnit(NTC_UNIT_MONSTER);
if(_target)
{
do
{
if(_skiplist.indexOf(_target.gid) < 0)
{
if(_target.IsAttackable())
{
if(GetDistance(_orgx, _orgy, _target.x, _target.y) <= range && NTA_IsValidMonster(_target))
{
_distance = GetDistance(me, _target);
if(_distance < _mindistance)
{
_mingid = _target.gid;
_mindistance = _distance;
}
}
}
else
_skiplist.push(_target.gid);
}
} while(_target.GetNext());
}
if(_mindistance < 1E6)
{
_target = NTC_FindUnit(NTC_UNIT_MONSTER, _mingid, 1);
if(_target)
{
if(MWConfig_ShowOverheadStatus)
Say("!Attacking " + _target.name + " (" + (_target.hp * 100 / _target.hpmax).toFixed(0) + "%)");
_result = NTA_Attack(_target, (_attackcount % 30) == 0);
if(MWConfig_ShowOverheadStatus)
Say("!Attacking " + _target.name + " (" + (_target.hp * 100 / _target.hpmax).toFixed(0) + "%)");
switch(_result)
{
case 1:
_skiplist.push(_mingid);
break;
case 2:
case 3:
if(MWConfig_PickItemsInstantly && (_target.hp <= 0 || _target.mode == 0 || _target.mode == 12))
NTSI_PickItems();
_attackcount++;
break;
default:
_attackcount = 1E6;
}
}
}
else
break;
}
}
if(_attackcount > 2)
{
switch(me.classid)
{
case NTC_CHAR_CLASS_PALADIN:
if(parseInt(me.hp * 100 / me.hpmax) < NTConfig_UseRedemptionHP || parseInt(me.mp * 100 / me.mpmax) < NTConfig_UseRedemptionMP)
{
if(NTC_PutSkill(124, NTC_HAND_RIGHT))
NTC_PingDelay(1000);
}
break;
case NTC_CHAR_CLASS_BARBARIAN:
if(usefinditem && !NTR_CheckCowKing())
MWL_FindItem(MWConfig_FindItemRange);
break;
case NTC_CHAR_CLASS_NECROMANCER:
if(!NTR_CheckCowKing())
MWA_RaiseMinions();
break;
}
}
if(pickitem && _attackcount > 0)
NTSI_PickItems();
if(openchests && !NTR_CheckCowKing())
MWL_OpenNearbyChests(MWConfig_OpenChestsRange);
if(MWConfig_ActivateNearbyShrines)
MWL_ActivateNearbyShrines();
/* This doesn't even get executed with the original script; we never check for safety -- requires implementation
switch(safelevel)
{
case 1:
return NTTMGR_CheckSafe(0x00, NTConfig_CheckMercSafe&0x01);
case 2:
return NTTMGR_CheckSafe(NTConfig_CheckSelfSafe, NTConfig_CheckMercSafe);
} */
if(MWConfig_IdentAfterPickup)
MWL_IDItemsAfterPickup();
return true;
}
Code:
MWConfig_Script.push(["NTCows.ntj", 10]); MWConfig_CowPickItems = true; MWConfig_CowOpenChests = true; MWConfig_CowFindItem = false; /* CowPickItems: Pick up items (overrides global pick items)? | CowOpenChests: Open chests (overrides global open chests)? | CowFindItem: Use find item (overrides global find item)? */