<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.returnofreckoning.com/index.php?action=history&amp;feed=atom&amp;title=API%3AAttachWindowToWorldObject</id>
	<title>API:AttachWindowToWorldObject - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.returnofreckoning.com/index.php?action=history&amp;feed=atom&amp;title=API%3AAttachWindowToWorldObject"/>
	<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:AttachWindowToWorldObject&amp;action=history"/>
	<updated>2026-10-17T11:08:53Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://wiki.returnofreckoning.com/index.php?title=API:AttachWindowToWorldObject&amp;diff=30178&amp;oldid=prev</id>
		<title>Maintenance script: UI Lua API import (WAR 1.4.8)</title>
		<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:AttachWindowToWorldObject&amp;diff=30178&amp;oldid=prev"/>
		<updated>2026-10-16T19:40:28Z</updated>

		<summary type="html">&lt;p&gt;UI Lua API import (WAR 1.4.8)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{LuaApi|group=WorldObject}}&lt;br /&gt;
Makes a window follow a world object (a player, creature or other object) on screen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AttachWindowToWorldObject(windowName, worldObjectId)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Arguments ==&lt;br /&gt;
;windowName : &amp;lt;code&amp;gt;string&amp;lt;/code&amp;gt; – Name of the window to attach.&lt;br /&gt;
;worldObjectId : &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; – ID of the world object, as given by the game data and events.&lt;br /&gt;
&lt;br /&gt;
== Returns ==&lt;br /&gt;
Nothing.&lt;br /&gt;
&lt;br /&gt;
== Details ==&lt;br /&gt;
* The window is added to the object&amp;#039;s list of attached windows. One object can have several windows, and the client does not check whether the window is already in the list.&lt;br /&gt;
* Every frame, the client projects each attached object&amp;#039;s position to the screen. For each attached window:&lt;br /&gt;
** the window is shown when the point is on screen and hidden when it is not;&lt;br /&gt;
** when the projected point moves, the window is moved so that it is centred horizontally on the point with its bottom edge on the point, then kept inside the screen.&lt;br /&gt;
* For player objects the point is taken from the character&amp;#039;s model when one is available.&lt;br /&gt;
* When the object no longer exists, its attachments are removed automatically. The window itself is not destroyed.&lt;br /&gt;
* The function needs at least two arguments and only reads the last two.&lt;br /&gt;
&lt;br /&gt;
== Errors ==&lt;br /&gt;
* &amp;lt;code&amp;gt;Error in function call &amp;#039;AttachWindowToWorldObject&amp;#039;: window %s does not exist&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
Attaching an event-text anchor to its target, from &amp;lt;code&amp;gt;default/easystem_eventtext/source/system_eventtext.lua&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-- Have to use MoveWindowToWorldObject() like&lt;br /&gt;
--   MoveWindowToWorldObject(self.m_Anchor, self.m_TargetObject, self.m_AttachHeight)&lt;br /&gt;
--   if we want to have scaled attachment?  Or modify AttachWindowToWorldObject() at some point.&lt;br /&gt;
AttachWindowToWorldObject(anchorWindowName, targetObjectNumber)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[API:DetachWindowFromWorldObject|DetachWindowFromWorldObject]]&lt;br /&gt;
* [[API:ForceUpdateWorldObjectWindow|ForceUpdateWorldObjectWindow]]&lt;br /&gt;
* [[API:MoveWindowToWorldObject|MoveWindowToWorldObject]]&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>