Jump to content

Recommended Posts

Posted

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

  • 3 weeks later...
Posted

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.

  • 1 month later...
Posted (edited)

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
Posted (edited)

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
  • 2 weeks later...
Posted

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

  • 4 weeks later...
  • 2 months later...
  • 4 months later...
  • 2 years later...
Posted

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

  • 5 months later...
Posted (edited)

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
  • 3 months later...
Posted
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

Posted
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

Posted
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;
}

 

Posted

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

  • 3 weeks later...
Posted (edited)
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

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...