Lineage 2 Tower Forum

Full Version: Try to write Script for PK
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
    LUA Programming
ReputationPoint=0;
RangeLimit=500;
repeat 
Sleep(10000); 
Point=GetMe():GetLocation();
me=GetMe();
 
local playerlist = GetPlayerList();
for player in playerlist.list do
	if (player:GetReputation()<ReputationPoint)and
	   (GetDistanceVector(GetMe():GetLocation(),Point)<RangeLimit) then
 Target(player);
 Command("/attack");
 Sleep(10000);
 end;
 if (player:IsAlikeDeath())then
 end;end;
 until false;

What is the command for pet attk?
If you hit, your pets will hit too ( option by /cfg)
Okay so I tried this script at it works okay at first, but when a red comes into the area my toon targets it, tries to attack with /attack. and then I crit error out. Every time. wierd
(02-17-2013 22:51 PM)nadmaster101 Wrote: [ -> ]Okay so I tried this script at it works okay at first, but when a red comes into the area my toon targets it, tries to attack with /attack. and then I crit error out. Every time. wierd

O.o
I think it has something to do with the fact that the red hides behind a corner so my toon runs to the wall and keeps trying to attack, it also targets him while he is dead which is a pain in the ass.
try this, it may need fix since it is notepad edition
    LUA Programming
ReputationPoint = 0;
RangeLimit = 500;
repeat 
	Sleep(10000); 
	local Point = GetMe():GetLocation();
	local me = GetMe();
	local tg = GetTarget(); 
	local playerlist = GetPlayerList();
	for player in playerlist.list do
		if (player:GetReputation()<ReputationPoint)and 
		   (not player:IsAlikeDeath())and
		   (GetDistanceVector(GetMe():GetLocation(),Point) < RangeLimit) then
			if (tg == nil) or ((tg ~= nil) and (tg:GetId() ~= player:GetId()))then
				Target(player);
			end;
			if(tg ~= nil)and (tg:GetId() == player:GetId()) and (not player:IsAlikeDeath())then
				Action(2,false,true);
			end;
		end;
		if(player:IsAlikeDeath()) and (tg:GetId() == player:GetId())then
			ClearTargets();
			CancelTarget(false);
			CancelTarget(false);
			CancelTarget(false); 
		end;
		Sleep(5000);
	end;
 until false;

    LUA Programming
KillPKStatus = false;
 
function OnCreate()
	this:RegisterCommand("killpk", 
 
CommandChatType.CHAT_ALLY, CommandAccessLevel.ACCESS_ME);
end;
 
function OnCommand_killpk(vCommandChatType, vNick, 
 
vCommandParam)
	if (KillPKStatus == false) then
		KillPKStatus = true;
		ShowToClient("Kill PK","Matar Cualquier PK Cerca Activado.");
	else
		KillPKStatus = false;
		ShowToClient("Kill PK","Matar Cualquier PK Cerca Desactivado.");	
	end;
end;
 
function OnLTick1s()
if  (KillPKStatus == true) then
	local playerlist = GetPlayerList();
	local playerid = nil;
	for player in playerlist.list do
		if (player:IsMyPartyMember() == false) and (player:IsEnemy()) and (player:GetReputation() < 0) and (player:GetDistance() < 1600) and (player:IsFriend() == false) then
		playertarget = GetUserById(player:GetTarget());
		if (playertarget ~= nil) then
				if (playertarget:IsMyPartyMember()) or (playertarget:IsMe())  then
					playerid = player:GetId();
				end;				
			end;
	end;
end;
 
if (playerid ~= nil) then
		ClearTargets();
		TargetRaw(playerid);
		Action(2,false,true);
		if (GetMe():GetClass() == 145) then
		Action(22,false,true);
	end;
	end;
end;
end;

(02-18-2013 10:15 AM)Mobius Wrote: [ -> ]
    LUA Programming
KillPKStatus = false;
 
function OnCreate()
	this:RegisterCommand("killpk", 
 
CommandChatType.CHAT_ALLY, CommandAccessLevel.ACCESS_ME);
end;
 
function OnCommand_killpk(vCommandChatType, vNick, 
 
vCommandParam)
	if (KillPKStatus == false) then
 KillPKStatus = true;
 ShowToClient("Kill PK","Matar Cualquier PK Cerca Activado.");
	else
 KillPKStatus = false;
 ShowToClient("Kill PK","Matar Cualquier PK Cerca Desactivado.");	
	end;
end;
 
function OnLTick1s()
if (KillPKStatus == true) then
	local playerlist = GetPlayerList();
	local playerid = nil;
	for player in playerlist.list do
 if (player:IsMyPartyMember() == false) and (player:IsEnemy()) and (player:GetReputation() < 0) and (player:GetDistance() < 1600) and (player:IsFriend() == false) then
 playertarget = GetUserById(player:GetTarget());
 if (playertarget ~= nil) then
 if (playertarget:IsMyPartyMember()) or (playertarget:IsMe()) then
 playerid = player:GetId();
 end; 
 end;
	end;
end;
 
if (playerid ~= nil) then
 ClearTargets();
 TargetRaw(playerid);
 Action(2,false,true);
 if (GetMe():GetClass() == 145) then
 Action(22,false,true);
	end;
	end;
end;
end;


Nice1, but i disagree about Range Distance... It should be less then 1000 i think..
(02-18-2013 10:35 AM)TheBl4ckPhoenix Wrote: [ -> ]Nice1, but i disagree about Range Distance... It should be less then 1000 i think..

I think 1000 is about perfect cuz alot of people use archers and foeh as pk toons to the distance needs to be kinda big. I'm guessing the one the mobius wrote is a plugin and not a script. I'll try them all to see what happens.

okay well the plugin doesn't work at all, my client crash imediatly when i type /killpk and Hebdzik for some reason i keeps giving me a "No such operator defined" error.
Pages: 1 2 3
Reference URL's