So When i go under the percentage of mana or health the bot will sit before my target is dead and the mob will continue hitting me and the bot will just spam sit. So how can i set it so the bot will sit only when the mob is dead?[/u]
I wrote this Plugin, didn't test it tho, to make it start/stop working type: //sitmode
you should start it at point where you want your char to sit.
LUA Programming
Stand_When_HP_Percentage_Is_Bigger_Than = 60 ;
Stand_When_MP_Percentage_Is_Bigger_Than = 60 ;
Sit_When_MP_Percentage_Is_Lower_Than = 30 ;
Sit_When_HP_Percentage_Is_Lower_Than = 30 ;
---------
MoveStamp = GetTime();
Status = false;
SitStatus = false;
function OnCreate()
this:RegisterCommand("sitmode", CommandChatType.CHAT_ALLY, CommandAccessLevel.ACCESS_ME);
end;
function OnCommand_sitmode(vCommandChatType, vNick, vCommandParam)
activate()
end;
function activate()
if (Status == false) then
FarmPoint = GetMe():GetLocation();
Status = true ;
ShowToClient("Auto Sit/Stand","Auto Sit is now Activated.");
else
Status = false;
ShowToClient("Auto Sit/Stand","Auto Sit is now Deactivated.");
--SetPause(true);
end;
end;
function OnLTick1s()
if (Status == true) then
if (GetMe():IsSiting() == true) and (MoveStamp +10000 < GetTime()) and (GetMe():GetMpPercent()> Stand_When_MP_Percentage_Is_Bigger_Than) and (GetMe():GetHpPercent()> Stand_When_HP_Percentage_Is_Bigger_Than) then
MoveStamp = GetTime();
Command("/Stand");
ShowToClient("Auto Sit/Stand","Rested Enough, Time to PewPew.");
SetPause(false);
SitStatus = false;
elseif (IsAllMobsUntargettingMe() == false) then
SetPause(false);
SitStatus = false;
elseif (IsAllMobsUntargettingMe() == true) and ((GetMe():GetMpPercent() < Sit_When_MP_Percentage_Is_Lower_Than) or (GetMe():GetHpPercent() < Sit_When_HP_Percentage_Is_Lower_Than)) and (SitStatus == false) then
SetPause(true);
ClearTargets()
CancelTarget(false);
MoveToNoWait(GetMe():GetLocation());
SitStatus = true;
elseif (GetMe():IsInCombat() == false) and (MoveStamp +10000 < GetTime()) and (GetDistanceVector(FarmPoint,GetMe():GetLocation()) >= 400) and
(GetDistanceVector(FarmPoint,GetMe():GetLocation()) < 8000) and (SitStatus == true) and (GetMe():IsSiting() == false) then
MoveStamp = GetTime();
m = 200;
loc = FarmPoint;
lX = loc.X + math.random(-m, m);
lY = loc.Y + math.random(-m, m);
MoveToNoWait(lX, lY, loc.Z);
SetPause(true);
elseif (SitStatus == true) and (GetMe():IsSiting() == false) and (MoveStamp +10000 < GetTime()) and (GetDistanceVector(FarmPoint,GetMe():GetLocation()) < 400) and (GetMe():IsInCombat() == false) then
Command("/Sit");
ShowToClient("Auto Sit/Stand","Sitting to Rest.");
SetPause(true);
MoveStamp = GetTime();
end;
end;
end;
function IsAllMobsUntargettingMe()
local MobList = GetMonsterList();
for Mob in MobList.list do
if (Mob:GetTarget() == GetMe():GetId()) then
if not ((Mob:GetId() == GetMe():GetTarget()) and (Mob:IsAlikeDeath() == true)) then
return false;
end;
end;
end;
return true;
end;
I updated it, i will be testing it in next days aswell.
When i type //sitmode nothing appears in chat. Also just to make sure all i had to do with use the ecript.exe and copy paste what you wrote.
do you see the plugin name in the plugin window when you check it?
//CFG > PLUGINS
you should see the file you copied, if it appears with yellow color then i mistyped smth, otherwise it should work.
(12-29-2011 00:50 AM)amiroooo Wrote: [ -> ]do you see the plugin name in the plugin window when you check it?
//CFG > PLUGINS
you should see the file you copied, if it appears with yellow color then i mistyped smth, otherwise it should work.
yes its there in white, but still nothing with i type //sitmode
I just tried it and it worked.
Any way to make it get the values for sitting / standing from the bot already set parameters? Or are those nil when the sit/stand is not enabled?
(I know only premiums can access the 'read config' function, just wanted to know if those are set already or are nil, if you know)
(GetMe():IsSiting() == true/false)
the plugin I made is meant to substitute the l2tower sit feature so you have to turn it off first.