Jump to content

AnnieRuru

Script Developers
  • Content Count

    1677
  • Joined

  • Last visited

  • Days Won

    245

Everything posted by AnnieRuru

  1. no, don't use setcell, that will glitch the client always use setwall prontera,158,182,6 script barricade 101,{ if ( has_instance2( "guild_vs2" ) >= 0 ) { warp has_instance( "guild_vs2" ), 0,0; end; } .@pid = getcharid(1); if ( !.@pid ) { mes "form a party 1st"; close; } getpartymember .@pid, 1; getpartymember .@pid, 2; if ( ( .@ins = instance_create( "test barricade", .@pid ) ) < 0 ) { mes "error : "+ .@ins; close; } if ( instance_attachmap( "guild_vs2", .@ins, 1, .@pid +"wall" ) == "" ) { mes "error : 5"; instance_destroy .@ins; close; } instance_set_timeout 30, 0, .@ins; instance_init .@ins; instance_attach .@ins; switch ( rand(4) ) { default: warp has_instance( "guild_vs2" ), 50, 90; break; case 1: warp has_instance( "guild_vs2" ), 50, 9; break; case 2: warp has_instance( "guild_vs2" ), 9, 50; break; case 3: warp has_instance( "guild_vs2" ), 90, 50; break; } end;}guild_vs2,0,0,0 script djfksdhfjkds -1,{OnInstanceInit: setwall has_instance( "guild_vs2" ), 46,87, 8, 6, 0, "inst_"+ has_instance2( "guild_vs2" ) +"_barricade_1"; setwall has_instance( "guild_vs2" ), 87,53, 8, 4, 0, "inst_"+ has_instance2( "guild_vs2" ) +"_barricade_2"; setwall has_instance( "guild_vs2" ), 46,12, 8, 6, 0, "inst_"+ has_instance2( "guild_vs2" ) +"_barricade_3"; setwall has_instance( "guild_vs2" ), 12,53, 8, 4, 0, "inst_"+ has_instance2( "guild_vs2" ) +"_barricade_4"; sleep 10000; delwall "inst_"+ has_instance2( "guild_vs2" ) +"_barricade_1"; delwall "inst_"+ has_instance2( "guild_vs2" ) +"_barricade_2"; delwall "inst_"+ has_instance2( "guild_vs2" ) +"_barricade_3"; delwall "inst_"+ has_instance2( "guild_vs2" ) +"_barricade_4"; end;}
  2. LOL check properly please http://upaste.me/34ce110099fd24b02 Posted on the 7th March, 2014 at 10:57:59version 1.1 is fixed the 'uint16 m;' into 'int16 m;' for the map indexwhich was already fixed before post#5 (11 March) before he mentioned about that
  3. com'on ... rathena added this ages ago ... and we still don't have ? why ? http://rathena.org/board/topic/78308-getguildmember/?p=244554 any guild based event definitely need this command don't have to use *query_sql anymore prontera,152,187,5 script dsasda2 100,{.@nb = query_sql( "select name, online from `char` where guild_id = "+ getcharid(2), .@name$, .@online );for ( .@i = 0; .@i < .@nb; .@i++ )dispbottom .@i +". "+ .@name$[.@i] +" -> "+( ( .@online[.@i] )? "online" : "offline" );end;} should be change into prontera,150,187,5 script dsasda 100,{getguildmember getcharid(2), 0;getguildmember getcharid(2), 1;getguildmember getcharid(2), 2;for ( .@i = 0; .@i < $@guildmembercount; .@i++ )dispbottom .@i +". "+ $@guildmembername$[.@i] +" -> "+( ( isloggedin( $@guildmemberaid[.@i] , $@guildmembercid[.@i] ) )? "online" : "offline" );end;} pull request => https://github.com/HerculesWS/Hercules/pull/335
  4. try this patch src/map/clif.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)diff --git a/src/map/clif.c b/src/map/clif.cindex d9acf07..42790b9 100644--- a/src/map/clif.c+++ b/src/map/clif.c@@ -9110,6 +9110,20 @@ bool clif_process_message(struct map_session_data *sd, int format, char **name_, *namelen_ = namelen; *message_ = message; *messagelen_ = messagelen;++ if ( sd->chatID ) {+ if ( stristr( message, ":" ) ) {+ struct chat_data *cd = (struct chat_data *)map->id2bl(sd->chatID);+ int i;+ for ( i = 0; i < cd->users; i++ ) {+ if ( stristr( message, cd->usersd[i]->status.name ) ) {+ clif->colormes( fd, COLOR_RED, "You can't impersonate others in a chatroom !" );+ return false; + }+ }+ }+ }+ return true; } plugin#include <stdio.h>#include <stdlib.h>#include <string.h>#include "../map/pc.h"#include "../map/clif.h"#include "../map/chat.h"#include "../common/HPMi.h"#include "../common/socket.h"#include "../common/HPMDataCheck.h" // should always be the last file included! (if you don't make it last, it'll intentionally break compile time)HPExport struct hplugin_info pinfo = { "chatroom_impersonate", // Plugin name SERVER_TYPE_MAP,// Which server types this plugin works with? "0.1", // Plugin version HPM_VERSION, // HPM Version (don't change, macro is automatically updated)};bool clif_process_message_spaces( int retVal, struct map_session_data *sd, int format, char **name_, size_t *namelen_, char **message_, size_t *messagelen_) { if ( retVal == true && sd->chatID ) { char* message = (char*)RFIFOP( sd->fd ,4) + strnlen(sd->status.name, NAME_LENGTH-1) + 3; if ( stristr( message, ":" ) ) { struct chat_data *cd = (struct chat_data *)map->id2bl(sd->chatID); int i; for ( i = 0; i < cd->users; i++ ) { if ( stristr( message, cd->usersd[i]->status.name ) ) { clif->colormes( sd->fd, COLOR_RED, "You can't impersonate others in a chatroom !" ); return false; } } } } return true;}HPExport void plugin_init (void) { map = GET_SYMBOL("map"); clif = GET_SYMBOL("clif"); session = GET_SYMBOL("session"); strlib = GET_SYMBOL("strlib"); addHookPost("clif->process_message", clif_process_message_spaces);}
  5. @Lumina like I said, don't use Notepad++, manually type in Microsoft Windows Notepad classic one although, I got a better idea since in a chatroom, to impersonate other has to type long sentence and then [space] then follow by Name : how about we restrict them by not typing like this if ( sscanf( "%s : ", sd->name ) ) so if they type something like "EnnyRuru : " the script will detect it and stop it just for my personal reference ... getwaitingroomlist pc_getwaitingroomlist
  6. oh ? I thought I write this for fun without knowing what this actually does#include <stdio.h>#include <stdlib.h>#include <string.h>#include "../map/pc.h"#include "../map/clif.h"#include "../common/HPMi.h"#include "../common/socket.h"#include "../common/HPMDataCheck.h" // should always be the last file included! (if you don't make it last, it'll intentionally break compile time)HPExport struct hplugin_info pinfo = { "max_3_space", // Plugin name SERVER_TYPE_MAP,// Which server types this plugin works with? "0.1", // Plugin version HPM_VERSION, // HPM Version (don't change, macro is automatically updated)};bool clif_process_message_spaces( int retVal, struct map_session_data *sd, int format, char **name_, size_t *namelen_, char **message_, size_t *messagelen_) { if ( retVal == true ) { char* message = (char*)RFIFOP( sd->fd ,4) + strnlen(sd->status.name, NAME_LENGTH-1) + 3; if ( stristr( message, " " ) != NULL ) { clif->message( sd->fd, "Alt+03232 ? You must be joking, right ? Don't do that !" ); return false; } if ( stristr( message, " " ) != NULL ) { clif->message( sd->fd, "You're only allowed to do max 3 spaces in a row." ); return false; } } return true;}HPExport void plugin_init (void) { clif = GET_SYMBOL("clif"); session = GET_SYMBOL("session"); strlib = GET_SYMBOL("strlib"); addHookPost("clif->process_message", clif_process_message_spaces);}ok this is trickyif ( stristr( message, " " ) != NULL ) {this is not a spaceI Alt+03232 it and Notepad++ doesn't work has to use Windows Notepad, and manually type in Alt+03232 only works hmm ... I upload the file then max_3_space.c
  7. willingly to pay ? omg, I can send this as a birthday gift patch src/map/clif.c | 5 +++++ 1 file changed, 5 insertions(+)diff --git a/src/map/clif.c b/src/map/clif.cindex d9acf07..ede1a52 100644--- a/src/map/clif.c+++ b/src/map/clif.c@@ -9110,6 +9110,11 @@ bool clif_process_message(struct map_session_data *sd, int format, char **name_, *namelen_ = namelen; *message_ = message; *messagelen_ = messagelen;++ if ( stristr( message, " " ) != NULL ) {+ clif_displaymessage( fd, "You're only allowed to do max 3 spaces in a row." );+ return false;+ } return true; } plugin#include <stdio.h>#include <stdlib.h>#include <string.h>#include "../map/pc.h"#include "../map/clif.h"#include "../common/HPMi.h"#include "../common/socket.h"#include "../common/HPMDataCheck.h" // should always be the last file included! (if you don't make it last, it'll intentionally break compile time)HPExport struct hplugin_info pinfo = { "max_3_space", // Plugin name SERVER_TYPE_MAP,// Which server types this plugin works with? "0.1", // Plugin version HPM_VERSION, // HPM Version (don't change, macro is automatically updated)};bool clif_process_message_spaces( int retVal, struct map_session_data *sd, int format, char **name_, size_t *namelen_, char **message_, size_t *messagelen_) { if ( retVal == true ) { if ( stristr( (char*)RFIFOP( sd->fd ,4) + strnlen(sd->status.name, NAME_LENGTH-1) + 3, " " ) != NULL ) { clif->message( sd->fd, "You're only allowed to do max 3 spaces in a row." ); return false; } } return true;}HPExport void plugin_init (void) { clif = GET_SYMBOL("clif"); session = GET_SYMBOL("session"); strlib = GET_SYMBOL("strlib"); addHookPost("clif->process_message", clif_process_message_spaces);}
  8. there is a difference for *has_instance and *has_instance2 has_instance return the map names, so has to check with 'if ( has_instance( "guild_vs2" ) == "" )' has_instance2 return the instance ID, so has to check with 'if ( has_instance2( "guild_vs2" ) == -1 )' and if there's an instance running for the player, at the bottom right down corner there should be a small window indicating instance were running ... I believe for the Raid instance, just add these line if ( has_instance2( "guild_vs2" ) >= 0 ) { warp has_instance( "guild_vs2" ), 0,0; end; }and you can go in again ... haven't test. . . ouch !I forgot a check if there is no party, you can't rent the room for party, same for guild fix the previous script
  9. wow ... already trying to use plugin on the 1st day o.o it actually took me about 1~2 weeks for me to understand what is plugin when I 1st came LOL ok ... you actually enter the final phase when writing a plugin which is testing for map-server to crash the final step is search for every commands that has '->' in your script, having ... script->rid2sdpc->equipitemmap->id2sditemdb->existsthen just add them into the plugin_init function as thisHPExport void plugin_init (void) { script = GET_SYMBOL("script"); pc = GET_SYMBOL("pc"); map = GET_SYMBOL("map"); itemdb = GET_SYMBOL("itemdb"); addScriptCommand( "equip2", "viiiiii?", equip2);}.. . and although already tested working in my test server too prontera,156,184,5 script kjdhfksjfs 100,{ getitem2 1201, 1,1,0,0, 0,0,0,0; equip2 1201, 0,0, 0,0,0,0; sleep2 1000; getitem2 1201, 1,1,0,0, 0,0,0,4001; equip2 1201, 0,0, 0,0,0,4001; end;}your command keep spamming the npc coordinate in console, because you did a 'return 0;' in rathena, commands are return by return SCRIPT_CMD_SUCCESS; (0) return SCRIPT_CMD_FAILURE; (1) in hercules, note that its actually opposite return true; (1) return false; (0) so change that 'return 0;' into 'return true;' http://upaste.me/4b092e
  10. yes, it wasn't document, that's why I'm suggesting this this is what I have in mind before commiting http://upaste.me/0f5a70 though, feels like there's no responds, might get rejected =/
  11. I've always wanted to suggest this add this into dbconst.txt COLOR_Aqua 0x00FFFFCOLOR_Black 0x000000COLOR_Blue 0x0000FFCOLOR_Gray 0x808080COLOR_Green 0x008000COLOR_Lime 0x00FF00COLOR_Maroon 0x800000COLOR_Navy 0x000080COLOR_Olive 0x808000COLOR_Orange 0xFFA500COLOR_Purple 0x800080COLOR_Red 0xFF0000COLOR_Silver 0xC0C0C0COLOR_Teal 0x008080COLOR_White 0xFFFFFFCOLOR_Yellow 0xFFFF00COLOR_Pink 0xFFC0CBCOLOR_Chocolate 0xD2691ECOLOR_Cyan 0x00FFFFCOLOR_Gold 0xFFD700COLOR_Violet 0xEE82EE then when you script, you can just refer to constant file to get your color no numbers ... and it also tells you which color for the announcement prontera,162,180,5 script aasdf 100,{ announce "test color", bc_all, COLOR_Aqua; announce "test color", bc_all, COLOR_Black; announce "test color", bc_all, COLOR_Blue;// announce "test color", bc_all, COLOR_Fuchsia; // not working announce "test color", bc_all, COLOR_Gray; announce "test color", bc_all, COLOR_Green; announce "test color", bc_all, COLOR_Lime; announce "test color", bc_all, COLOR_Maroon; announce "test color", bc_all, COLOR_Navy; announce "test color", bc_all, COLOR_Olive; announce "test color", bc_all, COLOR_Orange; announce "test color", bc_all, COLOR_Purple; announce "test color", bc_all, COLOR_Red; announce "test color", bc_all, COLOR_Silver; announce "test color", bc_all, COLOR_Teal; announce "test color", bc_all, COLOR_White; announce "test color", bc_all, COLOR_Yellow; announce "test color", bc_all, COLOR_Pink; announce "test color", bc_all, COLOR_Chocolate; announce "test color", bc_all, COLOR_Cyan; announce "test color", bc_all, COLOR_Gold; announce "test color", bc_all, COLOR_Violet; end;} MAGIC ! . . . . Add all of these ? http://www.w3schools.com/html/html_colornames.asp maybe too many ? or just a few that frequently use enough ? edit: I think just 17 colors enough ? I mean 18, plus Pink
  12. unfortunately ... hercules' clif->colormes is badly coded if you really need it, you have to create another one ==> 'clif->colormes2' src/map/clif.c | 15 +++++++++++++++ src/map/clif.h | 1 + 2 files changed, 16 insertions(+)diff --git a/src/map/clif.c b/src/map/clif.cindex d9acf07..146e7a3 100644--- a/src/map/clif.c+++ b/src/map/clif.c@@ -8385,6 +8385,20 @@ int clif_colormes(int fd, enum clif_colors color, const char* msg) { return 0; } +int clif_colormes2(int fd, unsigned int color, const char* msg) {+ size_t msg_len = strlen(msg) + 1;++ WFIFOHEAD(fd,msg_len + 12);+ WFIFOW(fd,0) = 0x2C1;+ WFIFOW(fd,2) = msg_len + 12;+ WFIFOL(fd,4) = 0;+ WFIFOL(fd,8) = (color & 0x0000FF) << 16 | (color & 0x00FF00) | (color & 0xFF0000) >> 16;;+ safestrncpy((char*)WFIFOP(fd,12), msg, msg_len);+ WFIFOSET(fd, msg_len + 12);++ return 0;+}+ /// Monster/NPC color chat [SnakeDrak] (ZC_NPC_CHAT). /// 02c1 <packet len>.W <id>.L <color>.L <message>.?B void clif_messagecolor(struct block_list* bl, unsigned int color, const char* msg) {@@ -18835,6 +18849,7 @@ void clif_defaults(void) { clif->messageln = clif_displaymessage2; clif->messages = clif_displaymessage_sprintf; clif->colormes = clif_colormes;+ clif->colormes2 = clif_colormes2; clif->process_message = clif_process_message; clif->wisexin = clif_wisexin; clif->wisall = clif_wisall;diff --git a/src/map/clif.h b/src/map/clif.hindex e4de51a..291997d 100644--- a/src/map/clif.h+++ b/src/map/clif.h@@ -817,6 +817,7 @@ struct clif_interface { /* message+s(printf) */ void (*messages) (const int fd, const char *mes, ...) __attribute__((format(printf, 2, 3))); int (*colormes) (int fd, enum clif_colors color, const char* msg);+ int (*colormes2) (int fd, unsigned int color, const char* msg); bool (*process_message) (struct map_session_data *sd, int format, char **name_, size_t *namelen_, char **message_, size_t *messagelen_); void (*wisexin) (struct map_session_data *sd,int type,int flag); void (*wisall) (struct map_session_data *sd,int type,int flag);then you can do as the formatclif->colormes2( sd->fd, <color code>, "<message>" );example likeclif->colormes2( sd->fd, 0xFF0000, "Red Light" );
  13. since our developers are ... not implementing dispbottom and message with colors http://herc.ws/board/topic/3899-suggestion-displaybottom-message-colors/?p=28345 I think I just make a release for this Download: 1.2 Plugin tested with prontera,162,180,5 script asdf 100,{ dispbottomcolor "test color", 0xFF0000; dispbottomcolor "test color", 0x00FF00; dispbottomcolor "test color", 0x0000FF; dispbottomcolor "test color", 0xFFFFFF, 2000000; end;}PS: there is a reason that this couldn't be in the officialbecause hercules' clif->colormes is ... badly coded ... changing that function also means change a lot of lines having clif->colormes, which is all over the places
  14. AnnieRuru

    Enchanter

    problem ... there is "Atk_Speed1" and "Atk_Speed2", but there is no "Atk_Speed3" prontera,156,179,5 script Enchanter 100,{// rentitem Cotton_Shirt_, 10; mes "select which equipment to enchant"; next; .@s = select ( "Armor - "+( ( getequipisequiped( EQI_ARMOR ) )? "^0000FF["+ getequipname( EQI_ARMOR ) +"]" : "^FF0000 (none)" )+"^000000", "Garment - "+( ( getequipisequiped( EQI_GARMENT ) )? "^0000FF["+ getequipname( EQI_GARMENT ) +"]" : "^FF0000 (none)" )+"^000000", "Shield - "+( ( getequipisequiped( EQI_HAND_L ) && getiteminfo( getequipid( EQI_HAND_L ), 2 ) == IT_ARMOR )? "^0000FF["+ getequipname( EQI_HAND_L ) +"]" : "^FF0000 (none)" )+"^000000", "Shoes - "+( ( getequipisequiped( EQI_SHOES ) )? "^0000FF["+ getequipname( EQI_SHOES ) +"]" : "^FF0000 (none)" )+"^000000" ); .@pos = .pos[.@s]; if ( getequipcardid( .@pos, 3 ) ) { mes "this item has been enchanted"; close; } .@eq = getequipid( .@pos ); mes "select the type of enchant"; next; .@type = select( .enc_menu$ ) -1; mes "select the level of enchantment"; mes "level 1 has 30% chance of success"; mes "level 2 has 20% chance of success"; mes "level 3 has 10% chance of success"; next; .@level = select( "1", "2", "3" ); mes "Are you sure you want to insert level "+ .@level +" "+ .enc$[.@type] +" into your "+ getitemname( .@eq ) +" ?"; mes "The fee is 250,000z and 3 Poring Coin"; next; if ( select( "Yes", "No" ) == 2 ) close;// counter check ... in case player change the equipment if ( getequipid( .@pos ) != .@eq ) { mes "what the hell ... you changed the item !"; close; } if ( getequipcardid( .@pos, 3 ) ) { mes "what the hell ... this item has been enchanted !"; close; } if ( Zeny < 250000 ) { mes "You don't have enough Zeny"; close; } if ( countitem( Poring_Coin ) < 3 ) { mes "You don't have enough Poring Coin"; close; } Zeny -= 250000; delitem Poring_Coin, 3; .@refine = getequiprefinerycnt( .@pos ); .@card0 = getequipcardid( .@pos, 0 ); .@card1 = getequipcardid( .@pos, 1 ); .@card2 = getequipcardid( .@pos, 2 ); if ( rand(100) < .rate[ .@level ] ) { delitem2 .@eq, 1, 1, .@refine, 0, .@card0, .@card1, .@card2, 0; getitem2 .@eq, 1, 1, .@refine, 0, .@card0, .@card1, .@card2, getd( ".enc"+ .@level +"["+ .@type +"]" ); mes "It's a success !"; } else mes "It's a failure ..."; close;OnInit: .material = Poring_Coin; setarray .pos[1], EQI_ARMOR, EQI_GARMENT, EQI_HAND_L, EQI_SHOES; setarray .enc$, "Str", "Int", "Dex", "Agi", "Vit", "Luk", "Atk", "Matk", "HP"; setarray .enc1, Strength1, Inteligence1, Dexterity1, Agility1, Vitality1, Luck1, Atk1, Matk1, HP100; setarray .enc2, Strength2, Inteligence2, Dexterity2, Agility2, Vitality2, Luck2, Atk2, Matk2, HP200; setarray .enc3, Strength3, Inteligence3, Dexterity3, Agility3, Vitality3, Luck3, Atk3, Matk3, HP300; setarray .rate[1], 30, 20, 10; .enc_menu$ = implode( .enc$, ":" ); end;}I think this script quite dangerous ... there is not script command for checking the equipment is bounded or rentedwithout the checks, player can use this script to change bounded or rented equipment into permanent trade-able equipment
  15. yes, official hercules instance script doesn't change much prontera,155,180,0 script Party Room 123,{ if ( has_instance2( "1@cata" ) >= 0 ) { warp has_instance( "1@cata" ), 0,0; end; } mes "renting a room for party"; next; if ( ( .@ins = instance_create( "Rent a Room", getcharid(1) ) ) < 0 ) { mes "error : "+ .@ins; close; } if ( instance_attachmap( "1@cata", .@ins ) == "" ) { mes "error : 5"; instance_destroy .@ins; close; } instance_set_timeout 30, 0, .@ins; instance_init .@ins; instance_attach .@ins; warp has_instance( "1@cata" ), 0,0; end;}I'm sure you'll feel familiar with the old system but look at this ... instance guild room ... yummy ~ prontera,158,180,0 script Guild Room 123,{ if ( has_instance2( "guild_vs2" ) >= 0 ) { warp has_instance( "guild_vs2" ), 0,0; end; } mes "renting a room for guild"; next; if ( ( .@ins = instance_create( "Rent a Room", getcharid(2), IOT_GUILD ) ) < 0 ) { mes "error : "+ .@ins; close; } if ( instance_attachmap( "guild_vs2", .@ins, 1, getcharid(2)+"room" ) == "" ) { mes "error : 5"; instance_destroy .@ins; close; } instance_set_timeout 30, 0, .@ins; instance_init .@ins; instance_attach .@ins; warp has_instance( "guild_vs2" ), 0,0; end;} unfortunately, many src edit from rathena are not compatible with herculesif you can read the source code, hercules source code parse faster than rathena example like rathena : clif_message hercules : clif->message so all your source edit has to be rewritten fortunately, we have plugin system ... http://herc.ws/board/topic/549- so you just need to code it once, and can forget about it
  16. ok for the instance script private mvp room issit ? prontera,155,180,0 script Rent a Room 123,{ mes "do you want to rent a room for yourself, party or guild ?"; for ( .@i = 1; .@i <= 3; .@i++ ) if ( has_instance2( "06guild_0"+ .@i ) >= 0 ) mes "You have rented a room for "+ .type$[.@i]; next; .@s = select( "Party", "Guild", "Account" ); if ( has_instance2( "06guild_0"+ .@s ) >= 0 ) { warp has_instance( "06guild_0"+ .@s ), 0,0; end; } if ( !getcharid(.@s) ) { mes "You must form a "+ .type$[.@s] +" to rent this room"; close; } if ( ( .@ins = instance_create( "Rent a Room", getcharid(.@s), .IOT[.@s] ) ) < 0 ) { mes "error : "+ .@ins; close; } if ( instance_attachmap( "06guild_0"+ .@s, .@ins, 1, .@s +"FYC"+ getcharid(.@s) ) == "" ) { mes "error : 5"; instance_destroy .@ins; close; } instance_set_timeout 30, 0, .@ins; instance_init .@ins; instance_attach .@ins; warp has_instance( "06guild_0"+ .@s ), 0,0; end;OnInit: setarray .IOT[1], IOT_PARTY, IOT_GUILD, IOT_CHAR; setarray .type$[1], "Party", "Guild", "Account"; end;}guild_vs2,49,49,0 script FYC_instance_npc 100,{ if ( !mobcount( strcharinfo(3), instance_npcname( strnpcinfo(0) )+"::Ondead" ) ) monster has_instance( "guild_vs2" ), 49,49, "--ja--", 1002, 1, instance_npcname( strnpcinfo(0) )+"::Ondead"; end;Ondead: dispbottom "oh yeah"; end;}guild_vs2 mapflag nosave SavePointguild_vs2 mapflag nowarpguild_vs2 mapflag nowarptoguild_vs2 mapflag noteleportguild_vs2 mapflag nomemoguild_vs2 mapflag nopenaltyguild_vs2 mapflag nobranchguild_vs2 mapflag noicewallIOT_CHAR actually attached to account IDalthough the name has _CHAR but its not char_id ... hahaha dunno why Ind make it account-base anyway but its quite comfortable to script using account_id raid instance issit ? http://herc.ws/board/topic/4652-raid-instances/?p=30524 that's because that map uses guild_vs2die twice ... sounds like you enable pvp mapflag ? cause I can't reproduce the problem right now on my latest hercules
  17. ok, now explain the VVS and the elemental weapon part they are store in card1 field so just focus there let's give an example getitem2 1201, 1,1,0,0, 255, 1281, getcharid(0) % pow(2,16), getcharid(0) / pow(2,16);1281 = you'll get Very Strong Ice elemental Knifegetitem2 1201, 1,1,0,0, 255, 2564, getcharid(0) % pow(2,16), getcharid(0) / pow(2,16);2564 = you'll get Very Very Strong Wind elemental Knife to get the VS or VVS or VVVS, it is a 1280*x 128? = Very Strong 256? = Very Very Strong 384? = Very Very Very Strong to get elemental, it is a remainder of 10 ???0 = neutral ???1 = Ice ???2 = Earth ???3 = Fire ???4 = Wind something like this prontera,156,185,6 script ksdjhfksjf 100,{ .@card1 = getequipcardid( EQI_HAND_R, 1 ); switch ( .@card1 / 10 ) { default: break; case 128: dispbottom "Very Strong"; break; case 256: dispbottom "Very Very Strong"; break; case 384: dispbottom "Very Very Very Strong"; break; } if ( query_sql( "select name from `char` where char_id = "+( getequipcardid( EQI_HAND_R, 3 ) * pow(2,16) + getequipcardid( EQI_HAND_R, 2 ) ), .@name$ ) )// if ( query_sql( "select name from `char` where char_id = "+( ( getequipcardid( EQI_HAND_R, 3 ) << 16 ) | getequipcardid( EQI_HAND_R, 2 ) ), .@name$ ) ) // both do the same dispbottom .@name$; switch ( .@card1 % 10 ) { default: break; case 1: dispbottom "Ice"; break; case 2: dispbottom "Earth"; break; case 3: dispbottom "Fire"; break; case 4: dispbottom "Wind"; break; } dispbottom getequipname(EQI_HAND_R); end;}
  18. if you want to ask question just open a topic, no need to shy all these questions has been asked before on eathena if it isn't down right now, I can just give you the links now I have to explain all over again 1. no, my example follows exactly the script_commands.txt there's no different with these 2 codes prontera,155,184,5 script sample#1 100,{.@charid = getcharid(0);getitem2 1601, 1, 1, 0,0, 255, 0, .@charid % pow(2,16), .@charid / pow(2,16); // <-- minegetitem2 1601, 1, 1, 0,0, 255, 0, .@charid & 65535, .@charid >> 16; // <-- script commands.txtend;} both sentence will gives you same item . . ok how to explain this ... if your character has char_id of 150000 when you click the above script and look in the SQL table select nameid, card0, card1, card2, card3 from inventory where char_id = 150000; return -> 1601,255,0,18928,2 the card2 field - 18928 is actually the remainder of 216 -> .@charid % pow(2,16) the card3 field - 2 is actually the division of 216 -> .@charid / pow(2,16) so my sentence is just exactly match what I said you can also try this prontera,157,184,5 script sample#2 100,{mes "enter a player name";next;input .@input$;if ( !query_sql( "select char_id, name from `char` where name = '"+ escape_sql( .@input$ ) +"'", .@cid, .@name$ ) ) { // if there is no row return from the querymes "player not found";close;}mes "you get "+ .@name$ +"'s Rod";getitem2 1601, 1, 1, 0,0, 255, 0, .@cid % pow(2,16), .@cid / pow(2,16);close;} . . ok so now you understand that card2 is remainder and card3 is division of char_id now why do script_commands.txt use binary operations its because computer actually process faster with just 0 and 1 since we are small we were taught in mathematics, that numbers are in 1,2,3,4,5,6,7,8,9,10 this is actually base 10 operations example ... every time you update your server using new client, you change PACKETVER 20140115 21040115 I can play it with the script like this prontera,159,184,5 script sample#3 100,{mes PACKETVER +""; // return 20140115mes "Year = "+ PACKETVER / 10000; // return 2014mes "Month = "+ PACKETVER / 100 % 100; // return 1 ( 01, the zero is omitted )mes "Day = "+ PACKETVER % 100; // return 15close;} . . Part 2 : here comes bit-shifting operations I assumed that you already know what is binary numbers let say, I give a number -> 10101010 if you divide 101010 by 1, you'll get 101010 if you divide 101010 by 10, you'll get 10101 if you divide 101010 by 100, you'll get 1010 if you divide 101010 by 1000, you'll get 101 if you divide 101010 by 10000, you'll get 10 if you divide 101010 by 100000, you'll get 1 prontera,161,184,5 script sample#4 100,{.@num = 101010;dispbottom .@num / 1 +""; // return 101010dispbottom .@num / 10 +""; // return 10101dispbottom .@num / 100 +""; // return 1010dispbottom .@num / 1000 +""; // return 101dispbottom .@num / 10000 +""; // return 10dispbottom .@num / 100000 +""; // return 1end;} same as if you divide 101010 by 100, you'll get 101010 if you divide 101010 by 101, you'll get 10101 if you divide 101010 by 102, you'll get 1010 if you divide 101010 by 103, you'll get 101 if you divide 101010 by 104, you'll get 10 if you divide 101010 by 105, you'll get 1 prontera,163,184,5 script sample#5 100,{.@num = 101010;dispbottom .@num / pow( 10, 0 )+""; // return 101010dispbottom .@num / pow( 10, 1 ) +""; // return 10101dispbottom .@num / pow( 10, 2 ) +""; // return 1010dispbottom .@num / pow( 10, 3 ) +""; // return 101dispbottom .@num / pow( 10, 4 ) +""; // return 10dispbottom .@num / pow( 10, 5 ) +""; // return 1end;} -> 10101010 / 100 = 10101010 -> 10101010 / 101 = 1010110 -> 10101010 / 102 = 101010 -> 10101010 / 103 = 10110 -> 10101010 / 104 = 1010 -> 10101010 / 105 = 110 and now, let's say I give a number 1010102, which is 4210 prontera,166,184,5 script sample#6 100,{.@num = 42;dispbottom ( .@num >> 0 )+""; // return 42dispbottom ( .@num >> 1 )+""; // return 21dispbottom ( .@num >> 2 )+""; // return 10dispbottom ( .@num >> 3 )+""; // return 5dispbottom ( .@num >> 4 )+""; // return 2dispbottom ( .@num >> 5 )+""; // return 1end;}prontera,168,184,5 script sample#7 100,{.@num = 42;dispbottom .@num / pow( 2, 0 )+""; // return 42dispbottom .@num / pow( 2, 1 )+""; // return 21dispbottom .@num / pow( 2, 2 )+""; // return 10dispbottom .@num / pow( 2, 3 )+""; // return 5dispbottom .@num / pow( 2, 4 )+""; // return 2dispbottom .@num / pow( 2, 5 )+""; // return 1end;} both scripts do the same -> 42 / 20 = 42 -> 42 / 21 = 21 -> 42 / 22 = 10 -> 42 / 23 = 5 -> 42 / 24 = 2 -> 42 / 25 = 1 equal to -> 1010102 / 102 = 1010102 = 4210 -> 1010102 / 102 = 101012 = 2110 -> 1010102 / 102 = 10102 = 1010 -> 1010102 / 102 = 1012 = 510 -> 1010102 / 102 = 102 = 210 -> 1010102 / 102 = 12 = 110 so, you'll noticed a pattern in base 10, to decrease the digits by removing the last digit, you do number / 10 Example => 10101010 / 10 = 1010110 in base 2, to decrease the last bit, you do right shift number >> 1 Example => 1010102 >> 1 = 101012 => 4210 >> 1 = 2110 its the same when opposite in base 10, to increase the digits by adding zero at the back, you do number * 10 Example => 10101010 * 10 = 101010010 in base 2, to increase the bits by adding zero, you do left shift number << 1 Example => 1010102 << 1 = 10101002 => 4210 << 1 = 8410 another example ... if I want cut 10101010 into half in base 10 (decimal) operations, we do prontera,150,180,5 script sample#8 100,{.@num = 101010;dispbottom .@num / 1000 +""; // return 101dispbottom .@num % 1000 +""; // return 10 ( 010, zero is omitted )end;} if I want to cut 1010102 into half in base 2 (binary) operations, 2 ways in athena script engine prontera,152,180,5 script sample#9 100,{.@num = 42;dispbottom .@num / pow(2,3) +""; // return 5 -> 101 base 2dispbottom .@num % pow(2,3) +""; // return 2 -> 010 base 2end;} prontera,154,180,5 script sample#10 100,{.@num = 42;dispbottom ( .@num >> 3 )+""; // return 5 -> 101 base 2dispbottom ( .@num & ( (1<<3) -1 ) )+""; // return 2 -> 010 base 2end;} although both script do the same thing, but the computer will compute 2nd sample, which using binary shift faster because computer prefer to calculate numbers in binary form so revise back ... getitem2 1601, 1, 1, 0,0, 255, 0, .@charid % pow(2,16), .@charid / pow(2,16); // <-- minegetitem2 1601, 1, 1, 0,0, 255, 0, .@charid & 65535, .@charid >> 16; // <-- script commands.txt if you go look at sql-files https://github.com/HerculesWS/Hercules/blob/master/sql-files/main.sql#L104 the card fields are using smallint, which is 216 since 150000 is higher than 32768, that's why it is being split 150000 % pow(2,16) as card2 field 150000 / pow(2,16) as card3 field .... actually binary shifting operation has another uses ... to store more information using lesser variables ... which is part 3 ... damn eathena forum down really wasting my time writing again however this post takes me almost 1 hour to write so meh ... some other time then
  19. no, I put 16 | .announceannounce "blahblah",16|.announce;16 is bc_blueremove the 16 and you can put color code btw, I have no idea why .announcekill was defaulted to off, it has to turn on set .announcekill, 0; // announce who pawn who's head : 0 - off, 1 - on
  20. just mirror ... in-case dota_pvpladder.2.9.txt dotasoundeffect_2.rar actually I want to drop this script just ... I have no idea it can become so popular ... that "replace into" was slower than "update" statement, I learned that only after 3 years completed this script I was using 'replace into' just because I wanted to squeeze that accessing 12 times query_sql into just 4 times and ultramage also proposed to make the table make a huge 'update' every 1 minute to safe further memory however if changing 'replace into' into 'update' might need to update the whole script and I have no motivation to improve this script, I rather focus on battleground scripts
  21. of course I have, I'm the author .... but some google search, somebody already mirror my file http://pastebin.com/Ynze1S7P http://tbro-ph.com/rAFreeFiles/NPC Scripts/ now I look back at this script ... that I made 6 years ago ... a lot of places can be improved and I remember that I left out the "modify a value" option, which was took out from 2.7 though, I can guarantee this script still works in latest hercules
  22. change query_sql "SELECT `last_mac` FROM `login` WHERE `account_id`="+getcharid(3),.@lastmac1$;query_sql "SELECT `last_mac` FROM `login` WHERE `account_id`="+.@accid,.@lastmac2$;if(.@lastmac1$==.@lastmac2$) { into if ( query_sql( "select 1 from totaltime where last_mac = ( select last_mac from login where account_id = "+ getcharid(3) +" ) and account_id != "+ getcharid(3), .@dummy ) ) { --edited-- . . btw this kind of script uses way too many query_sql in a single npc click its better that you optimized the SQL query, like I did above ( squeezing 2 Sql_handle into 1), otherwise this script might produce lag when used on a live server example like the one below query_sql "SELECT `time` FROM `totaltime` WHERE `account_id`="+.@accid,.@rtime;//gets the time of the recruiterquery_sql "SELECT `time` FROM `totaltime` WHERE `account_id`="+getcharid(3),.@rtime2;//gets the the of the newbieif (.@rtime2>=.@rtime) //compare both times change into query_sql "select ( select time from totaltime where account_id = "+ getcharid(3) +" ) - ( select time from totaltime where account_id = "+ .@accid +" )", .@time_diff;if ( .@time_diff > 0 ) //compare both times ... if positive numbers
  23. I remember I made it once and mine ... search for every single piece in the inventory, you don't have to equip it to be listed http://rathena.org/board/topic/91508-multi-item-refine/ I just done reading some official refiner scripts and ... I just found out its best to refine the weapon or armor into +7 with normal refiner then go to MightyHammer to get it into +10 then go to Basta to get it into +20 3 of them using different types of material, might be tricky is this 100% success rate ? I can only make this if it is 100% success rate
  24. I feel like I have to say thiswhere is your script ? and which part of the script doesn't work ? if you don't show it, nobody is interest in helping
×
×
  • Create New...

Important Information

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