Difference between revisions of "GetEnteringObject"

From NWN Lexicon
Jump to: navigation, search
(Created page with "=GetEnteringObject()= Gets the object that last opened or entered the calling object. object  GetEnteringObject(); ====Description==== Returns the o...")
 
 
(6 intermediate revisions by 5 users not shown)
Line 1: Line 1:
=GetEnteringObject()=
+
{{DISPLAYTITLE:GetEnteringObject()}}__NOTOC__
 +
Gets the object that last opened or entered the calling object.
 +
<nwscript>
 +
object GetEnteringObject();
 +
</nwscript>
 +
 
 +
====Description====
  
Gets the object that last opened or entered the calling object.
+
Returns the object that last opened or entered the calling object.
 +
 
 +
The value returned by this function depends on the object type of the caller:
  
[[object | object ]] GetEnteringObject();
+
# If the caller is a door or placeable it returns the object that last triggered it.
 +
# If the caller is a trigger, area of effect, module, area or encounter it returns the object that last entered it.
  
====Description====
+
Return value on error: OBJECT_INVALID.
  
Returns the object that last opened or entered the calling object. <br /> The value returned by this function depends on the object type of the caller: (1) If the caller is a door or placeable it returns the object that last triggered it. (2) If the caller is a trigger, area of effect, module, area or encounter it returns the object that last entered it. <br /> Return value on error: OBJECT_INVALID.
+
====Remarks====
  
<br /><br />
+
This function is identical to [[GetClickingObject]] - Bioware sometimes uses them interchangably, and usefully for scripters it also means scripts can be reused wholesale for multiple events, in this case [[OnEnter]], [[OnClick]] and [[OnFailToOpen]].
  
 
====Version====
 
====Version====
Line 17: Line 26:
 
====Example====
 
====Example====
  
<font color="#007f00">// Greet any Players that come into a trigger set around a drunk in a tavern.
+
<nwscript>
</font>
+
// Greet any Players that come into a trigger set around a drunk in a tavern.
<font color="#0000ff">void</font> main()
+
 
{
+
void main()
    <font color="#0000ff">if</font>(GetIsPC(GetEnteringObject()))
+
{
    {
+
    if(GetIsPC(GetEnteringObject()))
        AssignCommand(GetNearestObjectByTag(<font color="#00007f">"TavernPatron"</font>),SpeakOneLinerConversation(<font color="#00007f">"DrunkGreeting"</font>));
+
    {
        AssignCommand(GetNearestObjectByTag(<font color="#00007f">"TavernPatron"</font>),ActionPlayAnimation(ANIMATION_LOOPING_PAUSE_DRUNK));
+
        AssignCommand(GetNearestObjectByTag("TavernPatron"),SpeakOneLinerConversation("DrunkGreeting"));
    }
+
        AssignCommand(GetNearestObjectByTag("TavernPatron"),ActionPlayAnimation(ANIMATION_LOOPING_PAUSE_DRUNK));
}
+
    }
 +
}
 +
</nwscript>
  
 
====See Also====
 
====See Also====

Latest revision as of 14:08, 12 April 2021

Gets the object that last opened or entered the calling object.

Description

Returns the object that last opened or entered the calling object.

The value returned by this function depends on the object type of the caller:

  1. If the caller is a door or placeable it returns the object that last triggered it.
  2. If the caller is a trigger, area of effect, module, area or encounter it returns the object that last entered it.

Return value on error: OBJECT_INVALID.

Remarks

This function is identical to GetClickingObject - Bioware sometimes uses them interchangably, and usefully for scripters it also means scripts can be reused wholesale for multiple events, in this case OnEnter, OnClick and OnFailToOpen.

Version

1.22

Example

// Greet any Players that come into a trigger set around a drunk in a tavern.
 
void main()
{
    if(GetIsPC(GetEnteringObject()))
    {
        AssignCommand(GetNearestObjectByTag("TavernPatron"),SpeakOneLinerConversation("DrunkGreeting"));
        AssignCommand(GetNearestObjectByTag("TavernPatron"),ActionPlayAnimation(ANIMATION_LOOPING_PAUSE_DRUNK));
    }
}

See Also

functions: 

GetExitingObject

events: 

OnUsed Event



 author: John Shuell, editor: Kristian Markon