Jump to content

@AutoAttack


goddameit

Recommended Posts


  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  770
  • Reputation:   69
  • Joined:  02/10/12
  • Last Seen:  

sir help

 

i got error when compile

 

i use last Svn Rathena 17198

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  770
  • Reputation:   69
  • Joined:  02/10/12
  • Last Seen:  

Manual update it

sir, i was try manual diff..

but still got error

 

can you help me to diff my scr files???

 

im newbie about source code

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  770
  • Reputation:   69
  • Joined:  02/10/12
  • Last Seen:  

Manual update it

sir, i was try manual diff..

but still got error

 

can you help me to diff my scr files???

 

im newbie about source code

update

 

i fix it  thx sir hahaha

Link to comment
Share on other sites

  • 3 weeks later...

  • Group:  Members
  • Topic Count:  39
  • Topics Per Day:  0.01
  • Content Count:  386
  • Reputation:   15
  • Joined:  11/17/11
  • Last Seen:  

idea =)

@autoattack <attack skill name>,<heal item id>

 

Suggestion.

Place a timer in this command.

example: You can only use this command for a certain amount of time and it automatically turns off after that.. and you can only use it after 1 hour or so..

 

 

It would be also nice if item that consume within 1 hour, and also suggestion if the player click a certain area the 'AutoAttack' command will be stop e.g AutoAttack has been stopped.

 

@autoattack <skillname atleast 1-3 skills be use><lvl> , <healing item> <required item in order to autoattack>

i'd be happy if this suggestion would possible to implement.

Thank you.

Link to comment
Share on other sites

  • 1 month later...

  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  446
  • Reputation:   229
  • Joined:  03/20/12
  • Last Seen:  

err, successfully diffed but when monster is around 9x9, the character stops moving instead of attacking.

 

Sorry, fixed already. Packet was the problem. I used OPTION_AUTOATTACK   = 0x40000000, instead


PS:

Will it be possible that when PM-ed by player, it will automatically reply: Person is currently using @autoattack command. This is to determine @autoattack from botters.

 

In-addition, I hope when the player logs out, the @autoattack command also stop

Edited by MrVandalBus
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.00
  • Content Count:  59
  • Reputation:   19
  • Joined:  01/03/13
  • Last Seen:  

I've got an error:

 

When i use @autoattack my char start to move but when he find a mob he stop and dont try to attack it.

 

Does anyone know how to solve this problem?

 

Thanks.

 

Update:

 

I solved the problem by changing the ~/src/map/status.h line 1517:

 

	OPTION_MOUNTING  = 0x10000000,
	OPTION_AUTOATTACK   = 0x10000000, 

As you can see the problem was that they had the same number.

 

So I changed it to 0x40000000:

 

	OPTION_MOUNTING  = 0x10000000,
	OPTION_AUTOATTACK   = 0x40000000,
Edited by Nanashi
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  60
  • Topics Per Day:  0.01
  • Content Count:  562
  • Reputation:   219
  • Joined:  11/22/11
  • Last Seen:  

mark this to first post, thx for report.
Link to comment
Share on other sites

  • 2 weeks later...

  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  770
  • Reputation:   69
  • Joined:  02/10/12
  • Last Seen:  

I've got an error:

 

When i use @autoattack my char start to move but when he find a mob he stop and dont try to attack it.

 

Does anyone know how to solve this problem?

 

Thanks.

 

Update:

 

I solved the problem by changing the ~/src/map/status.h line 1517:

 

	OPTION_MOUNTING  = 0x10000000,
	OPTION_AUTOATTACK   = 0x10000000, 

As you can see the problem was that they had the same number.

 

So I changed it to 0x40000000:

 

	OPTION_MOUNTING  = 0x10000000,
	OPTION_AUTOATTACK   = 0x40000000,

hi i was change like that but still get error when use autoattack

can't attack any monster any help me??

Link to comment
Share on other sites

  • 4 weeks later...

  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  770
  • Reputation:   69
  • Joined:  02/10/12
  • Last Seen:  

bump

Link to comment
Share on other sites

  • 2 months later...

  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  134
  • Reputation:   4
  • Joined:  09/28/12
  • Last Seen:  

Hi rAthena

 

Same with me cant attack.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  134
  • Reputation:   4
  • Joined:  09/28/12
  • Last Seen:  

anyone can help me?

 

Hi rAthena

 

Same with me cant attack.

 

Anyone can help me 

Link to comment
Share on other sites

  • 4 months later...

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.00
  • Content Count:  125
  • Reputation:   7
  • Joined:  11/19/11
  • Last Seen:  

any option to attack via spell like for wizards or skills like bash or bowling bash

Link to comment
Share on other sites

  • 2 years later...

  • Group:  Members
  • Topic Count:  152
  • Topics Per Day:  0.04
  • Content Count:  459
  • Reputation:   6
  • Joined:  06/29/12
  • Last Seen:  

For those who cant apply patch, you need to do it manually.. I just tested and its working with clean rAthena and 2015 client.. But it would be nice if the script auto disable when player died and respawn.. And also be nice if we manage to display cutin when player activate the @autoattack command.. Nice release.. Love it!!

Link to comment
Share on other sites

  • 5 months later...

  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  7
  • Reputation:   0
  • Joined:  05/06/17
  • Last Seen:  

if you want to specify the MOB_ID, here is my MOD

 

static int buildin_autoattack_sub(struct block_list *bl, va_list ap) {
	int *target_id = va_arg(ap, int *);
	*target_id = bl->id;
	struct mob_data* *md2 = va_arg(ap, struct mob_data* *);
	*md2 = BL_CAST(BL_MOB, bl);
	return 1;
}

void autoattack_motion(struct map_session_data* sd, int mob_id){
	int i, target_id;
	struct mob_data* md2;
	
	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, &md2);
		if (target_id) {
			if (mob_id != 0 && mob_id == md2->mob_id) {
				unit_attack(&sd->bl, target_id, 1);
			} else if (mob_id == 0) {
				unit_attack(&sd->bl, target_id, 1);
			} else {
				target_id = 0;
			}
			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;
	int mob_id = (int *)data;
	sd = map_id2sd(id);

	if (sd == NULL)
		return 0;
	if (sd->sc.option & OPTION_AUTOATTACK) {
		autoattack_motion(sd, mob_id);
		add_timer(gettick() + 1000, autoattack_timer, sd->bl.id, (intptr_t)mob_id);
	}
	return 0;
}
ACMD_FUNC(autoattack) {
	nullpo_retr(-1, sd);
	int mob_id = 0;
	char monster[NAME_LENGTH];

	memset(monster, '\0', sizeof(monster));
	
	if (message || *message) {
		if (sscanf(message, "%23s", monster) > 0) {
			if ((mob_id = mobdb_searchname(monster)) == 0)
				mob_id = mobdb_checkid(atoi(monster));
			
			if (mob_id == 0) {
				clif_displaymessage(fd, msg_txt(sd, 40)); // Invalid monster ID or name.
				return -1;
			}
		}
	}

	if (sd->sc.option & OPTION_AUTOATTACK) {
		sd->sc.option &= ~OPTION_AUTOATTACK;
		unit_stop_attack(&sd->bl);
		clif_displaymessage(fd, "Has desactivado AutoAtaque");
	} else {
		sd->sc.option |= OPTION_AUTOATTACK;
		add_timer(gettick() + 200, autoattack_timer, sd->bl.id, (intptr_t)mob_id);
		clif_displaymessage(fd, "Has Activado AutoAtaque");
	}
	clif_changeoption(&sd->bl);
	return 0;
}

EDIT:

@autoattack - All
@autoattack poring - Only poring

@autoattack 1002 - Only poring

Edited by JuLiAnChz
Specified command
Link to comment
Share on other sites

  • 3 months later...

  • Group:  Members
  • Topic Count:  62
  • Topics Per Day:  0.02
  • Content Count:  296
  • Reputation:   4
  • Joined:  02/19/17
  • Last Seen:  

On 5/22/2017 at 9:24 PM, JuLiAnChz said:

if you want to specify the MOB_ID, here is my MOD

 


static int buildin_autoattack_sub(struct block_list *bl, va_list ap) {
	int *target_id = va_arg(ap, int *);
	*target_id = bl->id;
	struct mob_data* *md2 = va_arg(ap, struct mob_data* *);
	*md2 = BL_CAST(BL_MOB, bl);
	return 1;
}

void autoattack_motion(struct map_session_data* sd, int mob_id){
	int i, target_id;
	struct mob_data* md2;
	
	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, &md2);
		if (target_id) {
			if (mob_id != 0 && mob_id == md2->mob_id) {
				unit_attack(&sd->bl, target_id, 1);
			} else if (mob_id == 0) {
				unit_attack(&sd->bl, target_id, 1);
			} else {
				target_id = 0;
			}
			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;
	int mob_id = (int *)data;
	sd = map_id2sd(id);

	if (sd == NULL)
		return 0;
	if (sd->sc.option & OPTION_AUTOATTACK) {
		autoattack_motion(sd, mob_id);
		add_timer(gettick() + 1000, autoattack_timer, sd->bl.id, (intptr_t)mob_id);
	}
	return 0;
}
ACMD_FUNC(autoattack) {
	nullpo_retr(-1, sd);
	int mob_id = 0;
	char monster[NAME_LENGTH];

	memset(monster, '\0', sizeof(monster));
	
	if (message || *message) {
		if (sscanf(message, "%23s", monster) > 0) {
			if ((mob_id = mobdb_searchname(monster)) == 0)
				mob_id = mobdb_checkid(atoi(monster));
			
			if (mob_id == 0) {
				clif_displaymessage(fd, msg_txt(sd, 40)); // Invalid monster ID or name.
				return -1;
			}
		}
	}

	if (sd->sc.option & OPTION_AUTOATTACK) {
		sd->sc.option &= ~OPTION_AUTOATTACK;
		unit_stop_attack(&sd->bl);
		clif_displaymessage(fd, "Has desactivado AutoAtaque");
	} else {
		sd->sc.option |= OPTION_AUTOATTACK;
		add_timer(gettick() + 200, autoattack_timer, sd->bl.id, (intptr_t)mob_id);
		clif_displaymessage(fd, "Has Activado AutoAtaque");
	}
	clif_changeoption(&sd->bl);
	return 0;
}

EDIT:

@autoattack - All
@autoattack poring - Only poring

@autoattack 1002 - Only poring

how to add this commands?

@autoattack - All
@autoattack poring - Only poring

@autoattack 1002 - Only poring

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  7
  • Reputation:   0
  • Joined:  05/06/17
  • Last Seen:  

9 hours ago, skymia said:

how to add this commands?

@autoattack - All
@autoattack poring - Only poring

@autoattack 1002 - Only poring

Follow the patch, and set my changes. In the first page is the downloadable

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  62
  • Topics Per Day:  0.02
  • Content Count:  296
  • Reputation:   4
  • Joined:  02/19/17
  • Last Seen:  

1 hour ago, JuLiAnChz said:

Follow the patch, and set my changes. In the first page is the downloadable

im using now God patch

so i need to add your mod?

static int buildin_autoattack_sub(struct block_list *bl, va_list ap) {
	int *target_id = va_arg(ap, int *);
	*target_id = bl->id;
	struct mob_data* *md2 = va_arg(ap, struct mob_data* *);
	*md2 = BL_CAST(BL_MOB, bl);
	return 1;
}

void autoattack_motion(struct map_session_data* sd, int mob_id){
	int i, target_id;
	struct mob_data* md2;
	
	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, &md2);
		if (target_id) {
			if (mob_id != 0 && mob_id == md2->mob_id) {
				unit_attack(&sd->bl, target_id, 1);
			} else if (mob_id == 0) {
				unit_attack(&sd->bl, target_id, 1);
			} else {
				target_id = 0;
			}
			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;
	int mob_id = (int *)data;
	sd = map_id2sd(id);

	if (sd == NULL)
		return 0;
	if (sd->sc.option & OPTION_AUTOATTACK) {
		autoattack_motion(sd, mob_id);
		add_timer(gettick() + 1000, autoattack_timer, sd->bl.id, (intptr_t)mob_id);
	}
	return 0;
}
ACMD_FUNC(autoattack) {
	nullpo_retr(-1, sd);
	int mob_id = 0;
	char monster[NAME_LENGTH];

	memset(monster, '\0', sizeof(monster));
	
	if (message || *message) {
		if (sscanf(message, "%23s", monster) > 0) {
			if ((mob_id = mobdb_searchname(monster)) == 0)
				mob_id = mobdb_checkid(atoi(monster));
			
			if (mob_id == 0) {
				clif_displaymessage(fd, msg_txt(sd, 40)); // Invalid monster ID or name.
				return -1;
			}
		}
	}

	if (sd->sc.option & OPTION_AUTOATTACK) {
		sd->sc.option &= ~OPTION_AUTOATTACK;
		unit_stop_attack(&sd->bl);
		clif_displaymessage(fd, "Has desactivado AutoAtaque");
	} else {
		sd->sc.option |= OPTION_AUTOATTACK;
		add_timer(gettick() + 200, autoattack_timer, sd->bl.id, (intptr_t)mob_id);
		clif_displaymessage(fd, "Has Activado AutoAtaque");
	}
	clif_changeoption(&sd->bl);
	return 0;
}

 

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  7
  • Reputation:   0
  • Joined:  05/06/17
  • Last Seen:  

Yes, search in your code and modify corresponding.

If you cant, write me in p2

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  62
  • Topics Per Day:  0.02
  • Content Count:  296
  • Reputation:   4
  • Joined:  02/19/17
  • Last Seen:  

9 hours ago, JuLiAnChz said:

Yes, search in your code and modify corresponding.

If you cant, write me in p2

What do you mean write me in p2?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  7
  • Reputation:   0
  • Joined:  05/06/17
  • Last Seen:  

a private message

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  152
  • Topics Per Day:  0.04
  • Content Count:  459
  • Reputation:   6
  • Joined:  06/29/12
  • Last Seen:  

I no longer use @autoattack since it make my player crash.. Tried to fix it but no luck.. Also it have issue when in autoattack but when kicked-out from map, the player client crash..

Link to comment
Share on other sites

  • 3 weeks later...

  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  65
  • Reputation:   0
  • Joined:  12/10/14
  • Last Seen:  

Thanks but send error when traveling or teleport or when you go through a warp.

Edited by Xiao
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.01
  • Content Count:  98
  • Reputation:   74
  • Joined:  12/04/14
  • Last Seen:  

On 8/30/2017 at 1:44 PM, rakuzas said:

I no longer use @autoattack since it make my player crash.. Tried to fix it but no luck.. Also it have issue when in autoattack but when kicked-out from map, the player client crash..

 

try this: autoattack.diff

 

Edited by Keitenai
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  152
  • Topics Per Day:  0.04
  • Content Count:  459
  • Reputation:   6
  • Joined:  06/29/12
  • Last Seen:  

23 hours ago, Keitenai said:

 

try this:

autoattack.diff

Hmmm..

is this fixed player crashed when change map or teleport or force-kick from map (timed out)? 

Link to comment
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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

×
×
  • Create New...