Bawths
Elpy
Posts: 3
Joined: Dec 2011
Reputation: 0
Version:
1.4.1.70
Sitting/resting before target is dead.
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]
12-28-2011 23:55 PM
amiroooo
Beta Tester
Posts: 1,270
Joined: Sep 2011
Reputation: 412
Version:
1.4.2.142
RE: Sitting/resting before target is dead.
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.
Attached File(s)
Sit On Command.lua (Size: 2.69 KB / Downloads: 94)
(This post was last modified: 01-12-2012 16:48 PM by amiroooo .)
12-29-2011 00:09 AM
Bawths
Elpy
Posts: 3
Joined: Dec 2011
Reputation: 0
Version:
1.4.1.70
RE: Sitting/resting before target is dead.
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.
12-29-2011 00:37 AM
amiroooo
Beta Tester
Posts: 1,270
Joined: Sep 2011
Reputation: 412
Version:
1.4.2.142
RE: Sitting/resting before target is dead.
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.
(This post was last modified: 12-29-2011 00:52 AM by amiroooo .)
12-29-2011 00:50 AM
Bawths
Elpy
Posts: 3
Joined: Dec 2011
Reputation: 0
Version:
1.4.1.70
RE: Sitting/resting before target is dead.
(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
12-29-2011 00:57 AM
amiroooo
Beta Tester
Posts: 1,270
Joined: Sep 2011
Reputation: 412
Version:
1.4.2.142
RE: Sitting/resting before target is dead.
I just tried it and it worked.
12-29-2011 01:05 AM
amiroooo
Beta Tester
Posts: 1,270
Joined: Sep 2011
Reputation: 412
Version:
1.4.2.142
RE: Sitting/resting before target is dead.
(GetMe():IsSiting() == true/false)
the plugin I made is meant to substitute the l2tower sit feature so you have to turn it off first.
12-29-2011 01:28 AM