Jump to content
  • 0
leloush

PK in a specific location x y

Question

i heard about this before..

 

 

is it possible to make pk in a same map but in a specific x y coor. lets say 4x4 in the main town ? if someone enter or step by someone he will be in a pk state and will become vulnerable to the attacks by someone also in the same 4x4 coordinate?

 

 

 

thanks in advance

Share this post


Link to post
Share on other sites

29 answers to this question

Recommended Posts

  • 0

Try this one.

 

NOTES:

  • You'll possibly NEED to shift+click people in order to hit them, there's no other way that I know for doing this. Maybe a massive duel inside the square?
  • Obviously, usage of the @killable status in your script means your users won't be able to use it for themselves in any normal situation.
  • The parameters are listed there in UPPERCASE LETTERS. You should change them throughout all the script in order to make the script to work and to be parsed correctly.
  • Script is untested, however it doesn't yield any parse errors provided you follow last note.

NPC_MAP,X,Y	script	killable	-1,X_EVENT,Y_EVENT,{OnTouch:	if (!@killable) {		@killable = 1; // Variable for keeping track of the status		atcommand "@killable"; // Don't remember if it needed a parameter, I think it doesn't		addtimer 1000, strnpcinfo(3)+"OnKillable"; // Will check after a second	}	end;OnKillable:	getmapxy(.@map$, .@x, .@y, 0);	if ((.@map$ != NPC_MAP || // Outside of the map		.@x < X - X_EVENT || .@x < X + X_EVENT || // Out of the area of effect in X side		.@y < Y - Y_EVENT || .@y < Y + Y_EVENT)) { // Out of the area of effect in Y side			@killable = 0;			atcommand "@killable"; // Don't remember if it needed a parameter, I think it doesn't		}	else addtimercount 1000, strnpcinfo(3)+"OnKillable"; // Will check again after a second until player goes out of the square	end;}

 

Wish you a happy new year!

Share this post


Link to post
Share on other sites
  • 0

This is so exploitable, but I believe yes.

 

Let me elaborate:

An ontouch NPC is on that square that sets @killable (the atcommand) on the users that step inside and attach, for example, a 1 second timer on them.

Whenever the timer runs out, also check the position of the player. If it's outside of the square then unset the killable status, else keep it on (don't do nothing).

Share this post


Link to post
Share on other sites
  • 0

This is so exploitable, but I believe yes.

 

Let me elaborate:

An ontouch NPC is on that square that sets @killable (the atcommand) on the users that step inside and attach, for example, a 1 second timer on them.

Whenever the timer runs out, also check the position of the player. If it's outside of the square then unset the killable status, else keep it on (don't do nothing).

thanks for the explanation.. well 

 

any other way just to execute something like this? or can u give me an example or idea on waht to do.. and ill do the rest..

Edited by leloush

Share this post


Link to post
Share on other sites
  • 0

Try this one.

 

NOTES:

  • You'll possibly NEED to shift+click people in order to hit them, there's no other way that I know for doing this. Maybe a massive duel inside the square?
  • Obviously, usage of the @killable status in your script means your users won't be able to use it for themselves in any normal situation.
  • The parameters are listed there in UPPERCASE LETTERS. You should change them throughout all the script in order to make the script to work and to be parsed correctly.
  • Script is untested, however it doesn't yield any parse errors provided you follow last note.

NPC_MAP,X,Y	script	killable	-1,X_EVENT,Y_EVENT,{OnTouch:	if (!@killable) {		@killable = 1; // Variable for keeping track of the status		atcommand "@killable"; // Don't remember if it needed a parameter, I think it doesn't		addtimer 1000, strnpcinfo(3)+"OnKillable"; // Will check after a second	}	end;OnKillable:	getmapxy(.@map$, .@x, .@y, 0);	if ((.@map$ != NPC_MAP || // Outside of the map		.@x < X - X_EVENT || .@x < X + X_EVENT || // Out of the area of effect in X side		.@y < Y - Y_EVENT || .@y < Y + Y_EVENT)) { // Out of the area of effect in Y side			@killable = 0;			atcommand "@killable"; // Don't remember if it needed a parameter, I think it doesn't		}	else addtimercount 1000, strnpcinfo(3)+"OnKillable"; // Will check again after a second until player goes out of the square	end;}

 

Wish you a happy new year!

thank you so much jabote..

 

ill try this now.. 

 

 

and yeah i forgot.. Happy new year too :D

 

 

 

@edit

 

uhm thanks it works jabote.. but it seems that the @killable commands will be difficult to use since u need to hold shift 1st to attack. however there is a good side in the @killable in the way of "the target player is not able to hit anyone i mean it cannot be abuse by killing the other ppl outside the cursed coordination.. how bout @pk ? @pk command is a custom command? am i right? 

Edited by leloush

Share this post


Link to post
Share on other sites
  • 0

Try this one.

 

NOTES:

  • You'll possibly NEED to shift+click people in order to hit them, there's no other way that I know for doing this. Maybe a massive duel inside the square?
  • Obviously, usage of the @killable status in your script means your users won't be able to use it for themselves in any normal situation.
  • The parameters are listed there in UPPERCASE LETTERS. You should change them throughout all the script in order to make the script to work and to be parsed correctly.
  • Script is untested, however it doesn't yield any parse errors provided you follow last note.

NPC_MAP,X,Y	script	killable	-1,X_EVENT,Y_EVENT,{OnTouch:	if (!@killable) {		@killable = 1; // Variable for keeping track of the status		atcommand "@killable"; // Don't remember if it needed a parameter, I think it doesn't		addtimer 1000, strnpcinfo(3)+"OnKillable"; // Will check after a second	}	end;OnKillable:	getmapxy(.@map$, .@x, .@y, 0);	if ((.@map$ != NPC_MAP || // Outside of the map		.@x < X - X_EVENT || .@x < X + X_EVENT || // Out of the area of effect in X side		.@y < Y - Y_EVENT || .@y < Y + Y_EVENT)) { // Out of the area of effect in Y side			@killable = 0;			atcommand "@killable"; // Don't remember if it needed a parameter, I think it doesn't		}	else addtimercount 1000, strnpcinfo(3)+"OnKillable"; // Will check again after a second until player goes out of the square	end;}

 

Wish you a happy new year!

 

 

Hello Can u put a MAP on this please?

 

like make prontera as a sample.. hehhe

Share this post


Link to post
Share on other sites
  • 0

@leloush: I don't remember any other way of doing that different to @killable, so please tell me if you can know and test that (just replace the atcommand sentences with their appropriate one). Problem with it is that you can be hit from people outside of the square.

 

@karazu: for making it work, just replace all parameters on the script with valid values.

  • NPC_MAP for a valid map name;
  • X and Y for valid x,y coordinates inside the map;
  • X_EVENT and Y_EVENT for valid trigger area values.

Share this post


Link to post
Share on other sites
  • 0

@jabote ok topic closed.. ill try to modify this or change this just to make it work properly to what i want to happen. and ill come back here..

 

overall thank you so much jabote :D

Edited by leloush

Share this post


Link to post
Share on other sites
  • 0

 

@leloush: I don't remember any other way of doing that different to @killable, so please tell me if you can know and test that (just replace the atcommand sentences with their appropriate one). Problem with it is that you can be hit from people outside of the square.

 

@karazu: for making it work, just replace all parameters on the script with valid values.

  • NPC_MAP for a valid map name;
  • X and Y for valid x,y coordinates inside the map;
  • X_EVENT and Y_EVENT for valid trigger area values.

I understand about the 

 

1 and 2

 

but I dont know about the 3rd one.

Share this post


Link to post
Share on other sites
  • 0

X_EVENT and Y_EVENT are the number of cells of distance to the NPC in which the NPC will consider as being touched.

 

For example, if X_EVENT is 3 and Y_EVENT is 2, the NPC will consider as being touched if you step on any of the crosses in the following diagram (the o is the NPC position:

 

xxxxxxx xxxxxxx xxxoxxx xxxxxxxxxxxxxx

 


Any of these positions will trigger the NPC OnTouch event, including the center position.

Share this post


Link to post
Share on other sites
  • 0

 

X_EVENT and Y_EVENT are the number of cells of distance to the NPC in which the NPC will consider as being touched.

 

For example, if X_EVENT is 3 and Y_EVENT is 2, the NPC will consider as being touched if you step on any of the crosses in the following diagram (the o is the NPC position:

 

xxxxxxx xxxxxxx xxxoxxx xxxxxxxxxxxxxx

 

 

Any of these positions will trigger the NPC OnTouch event, including the center position.

sir jabote i need your help im kinda interested in this script.. but im having some problem

NPC_MAP = prontera

x and y = my NPC Position which is 156,171

i really need your help ..... 

 

[Error]: npc_parse_script: Invalid placement format for a script in file '0.txt', line '1'. Skipping the rest of file...

* w1=prontera,156,171

* w2=script

* w3=killable

* w4=-1,155_EVENT,172_EVENT,{ 

 

X_EVENT and Y_EVENT should be integers: P.Ex if you want X_EVENT and Y_EVENT to be respectively 4 and 5, your script npc would be like this:

prontera,156,171	script	killable	-1,4,5,{

 

 

P.S.: If you want all map to be PK, just enable PVP on the city:

prontera	mapflag	pvp

Share this post


Link to post
Share on other sites
  • 0

Can't get what you want.

 

Think of it this way:

 

X_EVENT is the amount of HORIZONTAL cells away from the NPC you want it to work;

and Y_EVENT is the amount of VERTICAL cells away from the NPC you want it to work.

 

On an extreme case in which X_EVENT is 8 and Y_EVENT is 1, the trigger area of the NPC will be like this:

 

XXXXXXXXXXXXXXXXX 1 cellXXXXXXXXOXXXXXXXX <- CENTERXXXXXXXXXXXXXXXXX 1 cell8 cells ^ 8 cells      CENTER

You just need 2 numbers, one for each. Touch trigger NPC's only work with a rectangle-shaped triggering area.

 

Hope I made it a bit clearer.

 

P.S.: In case you want PK in a full map please remember you can use a mapflag on it.

P.P.S.: remember to also replace the uppercase parameters inside of the script, you should do it if you want it to work.

Share this post


Link to post
Share on other sites
  • 0

LoL, I was missing NPC orientation all the time.

 

P.S.: You haven't changed the parameters inside the NPC. I'll do this for you since I see you're getting lost

 

    prontera,155,155,0	script	killable	-1,8,8,{    OnTouch:    if (!@killable) {    @killable = 1; // Variable for keeping track of the status    atcommand "@killable"; // Don't remember if it needed a parameter, I think it doesn't    addtimer 1000, strnpcinfo(3)+"OnKillable"; // Will check after a second    }    end;         OnKillable:    getmapxy(.@map$, .@x, .@y, 0);    if (.@map$ != "prontera" || // Outside of the map    .@x < (155 - 8) || .@x < (155 + 8) || // Out of the area of effect in X side    .@y < (155 - 8) || .@y < (155 + 8) ) { // Out of the area of effect in Y side    @killable = 0;    atcommand "@killable"; // Don't remember if it needed a parameter, I think it doesn't    }    else addtimercount 1000, strnpcinfo(3)+"OnKillable"; // Will check again after a second until player goes out of the square    end;    }

This script passes parsing, but maybe you'll need to edit the effect radius of the NPC to adjust to the killable square.

 

P.S.: I reccommend you reading this section of the scripting documentation: https://github.com/HerculesWS/Hercules/blob/master/doc/script_commands.txt#L226

Share this post


Link to post
Share on other sites
  • 0

Yet another error of scripting without testing :P

 

    prontera,155,155,0	script	killable	-1,8,8,{    OnTouch:    if (!@killable) {    @killable = 1; // Variable for keeping track of the status    atcommand "@killable"; // Don't remember if it needed a parameter, I think it doesn't    addtimer 1000, strnpcinfo(3)+"::OnKillable"; // Will check after a second    }    end;         OnKillable:    getmapxy(.@map$, .@x, .@y, 0);    if (.@map$ != "prontera" || // Outside of the map    .@x < (155 - 8) || .@x < (155 + 8) || // Out of the area of effect in X side    .@y < (155 - 8) || .@y < (155 + 8) ) { // Out of the area of effect in Y side    @killable = 0;    atcommand "@killable"; // Don't remember if it needed a parameter, I think it doesn't    }    else addtimercount 1000, strnpcinfo(3)+"::OnKillable"; // Will check again after a second until player goes out of the square    end;    }

 

Changed all instances from strnpcinfo(3)+"OnKillable" to strnpcinfo(3)+"::OnKillable".

 

Try it out now.

Share this post


Link to post
Share on other sites
  • 0

So it works now?

 

BTW sorry for the errors I didn't spot. That was a rough draft but never had actual time to test it more than a basic check.

Share this post


Link to post
Share on other sites
  • 0

not yet working sir jaBote.. the script is not cotrolling the @killable ... when i enter the PK Area the @killable will activate and in a second it will automatically disable..what happen is i cant attack the opponent...

Share this post


Link to post
Share on other sites
  • 0

NOTES:

  • You'll possibly NEED to shift+click people in order to hit them, there's no other way that I know for doing this. Maybe a massive duel inside the square?

Have you tried that?

Share this post


Link to post
Share on other sites
  • 0

Mhmmm...

 

Could you please give me the exact coordinates of the center and the 4 corners of that square?

 

Seems that it isn't being well calculated.

Share this post


Link to post
Share on other sites
  • 0

Center > 155,204

Lower Left > 160,199

Lower Right > 151,199

Upper Right > 151,208

Upper Left > 160,208

 

if there's something wrong with my spot.. i will change it ...

Share this post


Link to post
Share on other sites
  • 0

LoL, the center of the script is in 155,155 and it works in an 8x8 area from that center. You've got your problem here :P

 

NP, changing script to fit it:

prontera,155,204,0	script	killable	-1,5,5,{OnTouch:	if (!@killable) {		@killable = 1; // Variable for keeping track of the status		atcommand "@killable"; // Don't remember if it needed a parameter, I think it doesn't		addtimer 100, strnpcinfo(3)+"::OnKillable"; // Will check after a second	}	end;OnKillable:	getmapxy(.@map$, .@x, .@y, 0);	if ( (.@map$ != "prontera" || // Outside of the map	  .@x < (155 - 5) || .@x < (155 + 5) || // Out of the area of effect in X side	  .@y < (204 - 5) || .@y < (204 + 5) ) && // Out of the area of effect in Y side	  @killable) { 		@killable = 0;		atcommand "@killable"; // Don't remember if it needed a parameter, I think it doesn't	}	else addtimercount 1000, strnpcinfo(3)+"::OnKillable"; // Will check again after a second until player goes out of the square	end;}

Share this post


Link to post
Share on other sites
  • 0

Oh bummer, just spotted yet another (serious) fault on the script. I'm feeling useless now.

 

prontera,155,204,0	script	killable	-1,5,5,{OnTouch:	if (!@killable) {		@killable = 1; // Variable for keeping track of the status		atcommand "@killable"; // Don't remember if it needed a parameter, I think it doesn't		addtimer 100, strnpcinfo(3)+"::OnKillable"; // Will check after a second	}	end;OnKillable:	getmapxy(.@map$, .@x, .@y, 0);	if ( (.@map$ != "prontera" || // Outside of the map	  .@x < (155 - 5) || .@x > (155 + 5) || // Out of the area of effect in X side	  .@y < (204 - 5) || .@y > (204 + 5) ) && // Out of the area of effect in Y side	  @killable) { 		@killable = 0;		atcommand "@killable"; // Don't remember if it needed a parameter, I think it doesn't	}	else addtimercount 1000, strnpcinfo(3)+"::OnKillable"; // Will check again after a second until player goes out of the square	end;}

 

Mhmmm... Try?

(me crosses fingers)

 

P.S.: Not sure that diff patch will work since it's quite outdated right now, but would give it a try on a separate emulator folder so that you can get rid of it if it doesn't do its job right.

Share this post


Link to post
Share on other sites
  • 0

Oh bummer, just spotted yet another (serious) fault on the script. I'm feeling useless now.

 

prontera,155,204,0	script	killable	-1,5,5,{OnTouch:	if (!@killable) {		@killable = 1; // Variable for keeping track of the status		atcommand "@killable"; // Don't remember if it needed a parameter, I think it doesn't		addtimer 100, strnpcinfo(3)+"::OnKillable"; // Will check after a second	}	end;OnKillable:	getmapxy(.@map$, .@x, .@y, 0);	if ( (.@map$ != "prontera" || // Outside of the map	  .@x < (155 - 5) || .@x > (155 + 5) || // Out of the area of effect in X side	  .@y < (204 - 5) || .@y > (204 + 5) ) && // Out of the area of effect in Y side	  @killable) { 		@killable = 0;		atcommand "@killable"; // Don't remember if it needed a parameter, I think it doesn't	}	else addtimercount 1000, strnpcinfo(3)+"::OnKillable"; // Will check again after a second until player goes out of the square	end;}

 

Mhmmm... Try?

(me crosses fingers)

 

P.S.: Not sure that diff patch will work since it's quite outdated right now, but would give it a try on a separate emulator folder so that you can get rid of it if it doesn't do its job right.

 

i got this sir... "YOU'RE NOT USELESS"... don't ever say that  :(  :(  im the one who is useless here LOL

2vv3qs7.jpg

EDIT: i change the location in a wide area and also the parameters inside the script...

Edited by WalkingBad

Share this post


Link to post
Share on other sites
  • 0

This time it isn't my fault but documentation's :P 

 

conflicting line of code:

else addtimercount 1000, strnpcinfo(3)+"::OnKillable"; // Will check again after a second until player goes out of the square

 

What documentation says:

 

addtimercount <ticks>,"NPC::OnLabel";

 

What the code says:

BUILDIN(addtimercount){const char *event;int tick;TBL_PC* sd;event=script_getstr(st, 2);tick=script_getnum(st,3);sd = script->rid2sd(st);if( sd == NULL )return true;script->check_event(st, event);pc->addeventtimercount(sd,event,tick);return true;}

(If you can't read it, it just wants the event first, then the amount of ticks).

 

I'll report this as a bug just after I make this reply. Common sense is that the order in which the script command wants it will be reversed to match the other script command's. You can change it if you want it working now, but be wary it may change over time to match the other command.

 

Fixed line of code (at least until we do something regarding that):

else addtimercount strnpcinfo(3)+"::OnKillable",1000; // Will check again after a second until player goes out of the square

Share this post


Link to post
Share on other sites
  • 0

i think i have to wait for the update till they fix that bug or wait till someone make a source mod for cell_pvp ... hmm anyway thanks a lot for helping me sir jaBote more power to you and to the Hercules Team :)  :)  :)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.