Jump to content
  • 0
Dissidia

get mob x and y position

Question

10 answers to this question

Recommended Posts

In ../src/map/mob.c find this function:

int mob_dead(struct mob_data *md, struct block_list *src, int type)

X:

md->bl.x

Y;

md->bl.y

  • Upvote 1
Link to comment
Share on other sites

I'm not at home so I couldn't test if it's actually working.

The following changes set the variables killed_x and killed_y when a monster (and player if you like) is killed. It works exactly like killedid, just with the coordinates instead of the id.

Find (src/map/map.h:308):

SP_KILLEDRID=122,

Add after:

SP_KILLED_X=123,
SP_KILLED_Y=124,

Find (src/map/pc.c:6035):

case SP_KILLEDRID:   val = sd->killedrid; break;

Add after:

case SP_KILLED_X:   val = sd->killed_x; break;
case SP_KILLED_Y:   val = sd->killed_y; break;

Find (src/map/pc.c:6177):

	case SP_KILLEDRID:
	sd->killedrid = val;
	return 1;

Add after:

	case SP_KILLED_X:
	sd->killed_x = val;
	return 1;
case SP_KILLED_Y:
	sd->killed_y = val;
	return 1;

Find (src/map/mob.c:2429):

	pc_setparam(mvp_sd, SP_KILLEDRID, md->class_);

Add after:

	pc_setparam(mvp_sd, SP_KILLED_X, md->bl.x);
pc_setparam(mvp_sd, SP_KILLED_Y, md->bl.y);

Find (src/map/pc.h:390):

	int killerrid, killedrid;

Add after:

	int killed_x, killed_y;

Find (db/const.txt:296):

killedrid	122	1

Add after:

killed_x	123	1
killed_y	124	1

(Edit:) Sets the variables for custom mob kill events and killed players as well.

Find (src/map/mob.c:2416):

				pc_setparam(sd, SP_KILLERRID, sd->bl.id);

Add after:

				pc_setparam(sd, SP_KILLED_X, sd->bl.x);
			pc_setparam(sd, SP_KILLED_Y, sd->bl.y);

Find (src/map/mob.c:2421):

				pc_setparam(mvp_sd, SP_KILLERRID, sd?sd->bl.id:0);

Add after:

				pc_setparam(mvp_sd, SP_KILLED_X, sd?sd->bl.x:0);
			pc_setparam(mvp_sd, SP_KILLED_Y, sd?sd->bl.y:0);

Find (src/map/pc.c:5719):

	pc_setparam(sd, SP_KILLERRID, src?src->id:0);

Add After:

	pc_setparam(sd, SP_KILLED_X, src?src->x:0);
pc_setparam(sd, SP_KILLED_Y, src?src->y:0);

(/Edit)

If you want to add the x and y coordinates for player kills as well:

Find (src/map/pc.c:5778):

		pc_setparam(ssd, SP_KILLEDRID, sd->bl.id);

Add after:

		pc_setparam(ssd, SP_KILLED_X, sd->bl.x);
	pc_setparam(ssd, SP_KILLED_Y, sd->bl.y);

Edited by Toshiro
  • Upvote 2
Link to comment
Share on other sites

This isnt possible without the old unit control commands or a new modification.

I've made a simple one, allowing to do:

OnNPCKillEvent:
dispBottom("You killed monster " + getMonsterInfo(killedRID, 0) + " @ " + killedRX + "/" + killedRY);
end;

€dit: Even if @Toshiro was faster - mine also works for player kills :o

killedrx_killedry.diff

  • Upvote 1
Link to comment
Share on other sites

This isnt possible without the old unit control commands or a new modification.

I've made a simple one, allowing to do:

OnNPCKillEvent:
dispBottom("You killed monster " + getMonsterInfo(killedRID, 0) + " @ " + killedRX + "/" + killedRY);
end;

€dit: Even if @Toshiro was faster - mine also works for player kills :o

You actually didn't add that the variables are set for the killing player, just for the player that was killed. But you added it for custom mob kill event which I previously forgot.

Updated my first post with additions for variables for the killed player and custom mob kill events.

Link to comment
Share on other sites

You actually didn't add that the variables are set for the killing player, just for the player that was killed.

Because if you are the killing player, your position can easily be fetched using getmapxy ^^ Only the target position, the killed player, needs to be attached, checked if still online & then getmapxy, bla.

Anyways, we should stay @ one modification to not confuse the poeple :S

I dont care if we use mine or yours.

Link to comment
Share on other sites

This would be useful for the Mob Tombstone system!

(Does anyone know how it is on official servers: does the tombstone appear at the x,y where the MVP died? or at the x,y where the player was standing?)

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
Answer this question...

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

Important Information

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