Sunzuki 1 Posted June 22, 2014 Can someone convert this? http://rathena.org/board/topic/71297-autoattack/ Index: src/map/atcommand.c===================================================================--- src/map/atcommand.c (revision 17103)+++ src/map/atcommand.c (working copy)@@ -8563,10 +8563,66 @@ } return 0; }+static int buildin_autoattack_sub(struct block_list *bl,va_list ap)+{+ int *target_id=va_arg(ap,int *);+ *target_id = bl->id;+ return 1;+}+void autoattack_motion(struct map_session_data* sd)+{+ int i, target_id;+ for(i=0;i<=9;i++)+ {+ target_id=0;+ map_foreachinarea(buildin_autoattack_sub, sd->bl.m, sd->bl.x-i, sd->bl.y-i, sd->bl.x+i, sd->bl.y+i, BL_MOB, &target_id);+ if(target_id)+ {+ unit_attack(&sd->bl,target_id,1);+ break; + }+ target_id=0;+ }+ if(!target_id)+ {+ unit_walktoxy(&sd->bl,sd->bl.x+(rand()%2==0?-1:1)*(rand()%10),sd->bl.y+(rand()%2==0?-1:1)*(rand()%10),0);+ }+ return;+}+int autoattack_timer(int tid, unsigned int tick, int id, intptr_t data)+{+ struct map_session_data *sd=NULL; + sd=map_id2sd(id);+ if(sd==NULL)+ return 0;+ if(sd->sc.option & OPTION_AUTOATTACK)+ {+ autoattack_motion(sd);+ add_timer(gettick()+2000,autoattack_timer,sd->bl.id,0);+ }+ return 0;+}+ACMD_FUNC(autoattack)+{+ nullpo_retr(-1, sd);+ if (sd->sc.option & OPTION_AUTOATTACK)+ {+ clif_displaymessage(fd, "Auto-attack OFF");+ sd->sc.option &= ~OPTION_AUTOATTACK;+ unit_stop_attack(&sd->bl);+ }else+ {+ clif_displaymessage(fd, "Auto-attack ON");+ sd->sc.option |= OPTION_AUTOATTACK;+ add_timer(gettick()+200,autoattack_timer,sd->bl.id,0);+ }+ clif_changeoption(&sd->bl);+ return 0;+} ACMD_FUNC(accinfo) { char query[NAME_LENGTH];-+ if (!message || !*message || strlen(message) > NAME_LENGTH ) { clif_displaymessage(fd, msg_txt(1365)); // Usage: @accinfo/@accountinfo <account_id/char name> clif_displaymessage(fd, msg_txt(1366)); // You may search partial name by making use of '%' in the search, ex. "@accinfo %Mario%" lists all characters whose name contains "Mario".@@ -8828,6 +8884,7 @@ * Command reference list, place the base of your commands here **/ AtCommandInfo atcommand_base[] = {+ ACMD_DEF(autoattack), ACMD_DEF2("warp", mapmove), ACMD_DEF(where), ACMD_DEF(jumpto),Index: src/map/status.h===================================================================--- src/map/status.h (revision 17103)+++ src/map/status.h (working copy)@@ -1489,6 +1489,7 @@ // compound constants OPTION_DRAGON = OPTION_DRAGON1|OPTION_DRAGON2|OPTION_DRAGON3|OPTION_DRAGON4|OPTION_DRAGON5, OPTION_MASK = ~OPTION_INVISIBLE,+ OPTION_AUTOATTACK = 0x10000000, }; //Defines for the manner system [Skotlex] thanks to you Quote Share this post Link to post Share on other sites
0 Mhalicot 392 Posted June 22, 2014 Autoattack is available in Hercules Plugins, no need to modify your source code just to add it.. try this [AtCommand] autoatk. Quote Share this post Link to post Share on other sites
0 Sunzuki 1 Posted June 22, 2014 (edited) after recompile it says im missing msvcr110d.dll on my pc. then the server says: HPM:plugin_load: failed to load 'plugins/autoattack.dll', skipping... I extracted it all into hercules and the file does exist at this path 1> C: Program Files (x86) MSBuild Microsoft.Cpp v4.0 Microsoft.CppBuild.targets (990.5): warning MSB8012: TargetPath (Z: RO Hercules-master vcproj-9 .. plugins plugin-sample.dll) does not correspond to the Output File property value (Z: RO Hercules-master plugins sample.dll) of linker. The project will therefore may not be created properly. Thus, this problem can be resolved, the property values for $ (OutDir), $ (TargetName) and $ (TargetExt) must comply with the in% (Link.OutputFile) specified value. Edited June 22, 2014 by Sunzuki Quote Share this post Link to post Share on other sites
0 Sunzuki 1 Posted June 23, 2014 so can anyone kindly convert it to a source edit? my hercules doesn't support plugins Quote Share this post Link to post Share on other sites
Can someone convert this?
http://rathena.org/board/topic/71297-autoattack/
thanks to you
Share this post
Link to post
Share on other sites