Jump to content

XML y coordinate dilemma


hexef

Recommended Posts

So, there's this UI component that shows the name of the item/NPC under your crosshair within the "activation" distance. It's UI path is the following: "HudMainMenu/Info/justify_center_text".

 

My script makes that component invisible under certain conditions, and also injects a custom component, let's call it "ChangedName", inside "HudMainMenu/Info", which copies most of the traits of "HudMainMenu/Info/justify_center_text". It's basically a new sibling of "justify_center_text", if I understand this concept correctly.

 

This is the exact raw XML of the new "ChangedName" component, injected under a MenuMode 4 block's GetGameRestarted condition, through JIP's InjectUIComponent:

<text name="ChangedName">
   <x>
      <copy src="sibling(justify_center_text)" trait="x" />
   </x>
   <y>
      <copy src="sibling(justify_center_text)" trait="y" />
   </y>
   <justify>
      <copy src="sibling(justify_center_text)" trait="justify" />
   </justify>
   <font>
      <copy src="sibling(justify_center_text)" trait="font" />
   </font>
   <systemcolor>
      <copy src="sibling(justify_center_text)" trait="systemcolor" />
   </systemcolor>
   <string>
      <copy src="io()" trait="string" />
   </string>
</text>

In game, the new "ChangedName" component seems to have copied most of the traits of "justify_center_text" properly, with the exception of the "y" trait. I have no idea why is this happening, and it's frustrating beyond belief.

 

If I check the X coordinate of both elements in-game using GetUIFloat, it returns the same coordinates for both "justify_Center_text" and "ChangedName", which are 160. But the Y coordinate has different results, 0 for "justify_center_text" and 65 for "ChangedName". Where the hell would that 65 be coming from?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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