Jump to content
  • 0

Change position for setunittitle and name centered


Question

Posted

Hey there~

I want to switch the order of the name and title, but after a few hours, I give up. So, it would be nice if you could help me out with my problem.
Here is my problem: When you use 'setunittitle', the title appears above the NPC name. As an example:

image.png.b2b25890e0f88239c3ccd31599a52b89.png

But I want the title beneath the name, like here:
image.png.aec626d4ff84b327e498b9dec3f3d703.png

"I know I could simply use the name in 'setunittitle' and change the NPC name to the title name,
but, well... that's not the intended use, is it?" 😄

In clif.cpp, the section where the name and title are defined is located:
void clif_name( struct block_list* src, struct block_list *bl, send_target target ){

                case BL_HOM:
		case BL_MER:
		case BL_PET:
		case BL_NPC:
		case BL_ELEM: {
			PACKET_ZC_ACK_REQNAMEALL_NPC packet = { 0 };

			packet.packet_id = HEADER_ZC_ACK_REQNAMEALL_NPC;
			packet.gid = bl->id;

			switch (bl->type) {
				case BL_HOM:
					memcpy(packet.name, ((TBL_HOM *)bl)->homunculus.name, NAME_LENGTH);
					break;
				case BL_MER:
					memcpy(packet.name, ((TBL_MER *)bl)->db->name.c_str(), NAME_LENGTH);
					break;
				case BL_PET:
					safestrncpy(packet.name, ((TBL_PET *)bl)->pet.name, NAME_LENGTH);
					break;
				case BL_NPC:
					safestrncpy(packet.name, ((TBL_NPC *)bl)->name, NAME_LENGTH);
					break;
				case BL_ELEM:
					safestrncpy(packet.name, ((TBL_ELEM *)bl)->db->name.c_str(), NAME_LENGTH);
					break;
			}

#if PACKETVER_MAIN_NUM >= 20180207 || PACKETVER_RE_NUM >= 20171129 || PACKETVER_ZERO_NUM >= 20171130
			unit_data *ud = unit_bl2ud(bl);

			if (ud != nullptr) {
				memcpy(packet.title, ud->title, NAME_LENGTH);
				packet.groupId = ud->group_id;
			}
#endif

			clif_send(&packet, sizeof(packet), src, target);
		}




The next consideration is whether it would be possible to add a function that centers the name beneath the title.
As you can observe, when the name is shorter than the title, it looks quite unappealing.


image.png.c52120e580f518449e30ba223d80a371.png



It would be a good change for rAthena, I think, as I am not the only one bothered by this and centering the name would be a generally positive modification.
I would greatly appreciate it if someone could provide me with the solution. Thank you.

  • Love 1
  • MVP 1

3 answers to this question

Recommended Posts

  • 0
Posted

Yea, me too. Haha xD
I have managed to swap the title and NPC name,
but then it no longer works that npc names with # and :: can get their unique names, because the name is then displayed with # and ::.
Example: Instructor#prt

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.

  • Recently Browsing   0 members

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