leloush 7 Posted December 30, 2013 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 Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted December 30, 2013 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). Quote Share this post Link to post Share on other sites
0 leloush 7 Posted December 31, 2013 (edited) 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 December 31, 2013 by leloush Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted December 31, 2013 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! 1 leloush reacted to this Quote Share this post Link to post Share on other sites
0 leloush 7 Posted January 1, 2014 (edited) 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 @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 January 1, 2014 by leloush Quote Share this post Link to post Share on other sites
0 karazu 33 Posted January 1, 2014 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 Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted January 1, 2014 @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. 1 leloush reacted to this Quote Share this post Link to post Share on other sites
0 leloush 7 Posted January 1, 2014 (edited) @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 Edited January 1, 2014 by leloush Quote Share this post Link to post Share on other sites
0 karazu 33 Posted January 1, 2014 @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. Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted January 1, 2014 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. Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted June 4, 2014 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 Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted June 4, 2014 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. Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted June 4, 2014 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 Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted June 5, 2014 Yet another error of scripting without testing 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. Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted June 5, 2014 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. Quote Share this post Link to post Share on other sites
0 WalkingBad 0 Posted June 5, 2014 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... Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted June 5, 2014 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? Quote Share this post Link to post Share on other sites
0 WalkingBad 0 Posted June 5, 2014 here sir jaBote please watch this... https://www.youtube.com/watch?v=vB6x5fgTwCg&feature=youtu.be Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted June 5, 2014 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. Quote Share this post Link to post Share on other sites
0 WalkingBad 0 Posted June 5, 2014 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 ... Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted June 5, 2014 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 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;} Quote Share this post Link to post Share on other sites
0 WalkingBad 0 Posted June 5, 2014 still the same problem sir jaBote.. even if i try it in a wide area the problem is still the same.. the killable is immediately disabled.. i found this topic sir jaBote http://herc.ws/board/topic/4589-pk-area/ do you think this one gonna work with Hercules? Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted June 6, 2014 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. Quote Share this post Link to post Share on other sites
0 WalkingBad 0 Posted June 6, 2014 (edited) 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 EDIT: i change the location in a wide area and also the parameters inside the script... Edited June 6, 2014 by WalkingBad Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted June 6, 2014 This time it isn't my fault but documentation's 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 Quote Share this post Link to post Share on other sites
0 WalkingBad 0 Posted June 6, 2014 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 Quote Share this post Link to post Share on other sites
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