L2Tower Discord Let's keep the community alive with discord. Discussions about plugins and scripts L2Tower Discord

Thread Closed 
 
Thread Rating:
  • 7 Vote(s) - 2.86 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Try to write Script for PK
Author Message
TheBl4ckPhoenix Offline
(^.^)
****

Posts: 1,887
Joined: Mar 2012
Reputation: 601
Version: 1.4.3.143
Post: #11
RE: Try to write Script for PK

    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;

02-14-2013 19:06 PM
Find all posts by this user
holty Offline
Restrainer of Glory
*

Posts: 243
Joined: Oct 2012
Reputation: 13
Version: 1.4.1.112
Post: #12
RE: Try to write Script for PK

What is the command for pet attk?
02-14-2013 20:41 PM
Find all posts by this user
TheBl4ckPhoenix Offline
(^.^)
****

Posts: 1,887
Joined: Mar 2012
Reputation: 601
Version: 1.4.3.143
Post: #13
RE: Try to write Script for PK

If you hit, your pets will hit too ( option by /cfg)
02-14-2013 21:41 PM
Find all posts by this user
MtnDew Offline
VIP Member
***

Posts: 500
Joined: Mar 2012
Reputation: 110
Version: 1.4.2.141
Post: #14
RE: Try to write Script for PK

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

+1 or +2 me if I helped you or you think I'm an ass. Tongue
02-17-2013 22:51 PM
Find all posts by this user
TheBl4ckPhoenix Offline
(^.^)
****

Posts: 1,887
Joined: Mar 2012
Reputation: 601
Version: 1.4.3.143
Post: #15
RE: Try to write Script for PK

(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
02-17-2013 23:00 PM
Find all posts by this user
MtnDew Offline
VIP Member
***

Posts: 500
Joined: Mar 2012
Reputation: 110
Version: 1.4.2.141
Post: #16
RE: Try to write Script for PK

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.

+1 or +2 me if I helped you or you think I'm an ass. Tongue
02-18-2013 00:15 AM
Find all posts by this user
Hebdzik Offline
Tester

Posts: 1,235
Joined: Aug 2011
Reputation: 265
Version: 1.4.3.143
Post: #17
RE: Try to write Script for PK

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;


Warning hammer!!! Use Search before you post something
If i hellp you, you can thx me by +1 Reputation
[Image: U63SU]
(This post was last modified: 02-18-2013 12:04 PM by Hebdzik.)
02-18-2013 08:59 AM
Find all posts by this user
Mobius Offline
VIP Member
***

Posts: 136
Joined: Jan 2012
Reputation: 40
Version: 1.4.2.135
Post: #18
RE: Try to write Script for PK

    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;


+2 if i help you :-)
(This post was last modified: 02-18-2013 10:16 AM by Mobius.)
02-18-2013 10:15 AM
Find all posts by this user
TheBl4ckPhoenix Offline
(^.^)
****

Posts: 1,887
Joined: Mar 2012
Reputation: 601
Version: 1.4.3.143
Post: #19
RE: Try to write Script for PK

(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
Find all posts by this user
MtnDew Offline
VIP Member
***

Posts: 500
Joined: Mar 2012
Reputation: 110
Version: 1.4.2.141
Post: #20
RE: Try to write Script for PK

(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.

+1 or +2 me if I helped you or you think I'm an ass. Tongue
(This post was last modified: 02-18-2013 11:23 AM by MtnDew.)
02-18-2013 11:00 AM
Find all posts by this user
Thread Closed 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Where did you guys learn to write scripts? jamesisawesom 2 4,293 07-30-2014 16:21 PM
Last Post: eustach3
  Newspapers - what others write about us ... ClockMan 9 36,117 12-15-2013 17:17 PM
Last Post: bogdanel
Bug Sorry if I do not write in that branch BalanaRRR 2 2,257 03-25-2013 23:29 PM
Last Post: Forsakendeamon
  help me write a script lowbob 5 4,045 07-24-2012 23:07 PM
Last Post: iglaras22



User(s) browsing this thread: 1 Guest(s)