PK in a specific location x y

leloush

New member
Messages
269
Points
0
Location
in front of my laptop =)
Emulator
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

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

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

 
Last edited by a moderator:
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!

 
Last edited by a moderator:
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
default_biggrin.png


@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? 

 
Last edited by a moderator:
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

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

 
@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
default_biggrin.png


 
Last edited by a moderator:
@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.

 
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.

 
WalkingBad said:
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:

Code:
prontera	mapflag	pvp
 
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.

 
Last edited by a moderator:
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

 
Last edited by a moderator:
Yet another error of scripting without testing
default_tongue.png


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.

 
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.

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

 
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?

 
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.

 
Back
Top