Difference between revisions of "GetPartyList"

From Dragon Age Toolset Wiki
Jump to: navigation, search
(Generated by Sunjammer's Dragon Age Script Paser)
 
m (Applying template, cleaning up example)
 
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Generated with errors}}
 
 
{{dafunction
 
{{dafunction
|name=GetPartyList
+
|name         = GetPartyList
|brief=Returns the party list for the creature
+
|brief         = Returns the party list for a creature.
|param1type=object
+
|param1type   = object
|param1name=oCreature
+
|param1arra    =
|param1desc=
+
|param1name   = oCreature
|returntype=object[]
+
|param1default = [[OBJECT_INVALID keyword|OBJECT_INVALID]]
|returndesc=
+
|param1desc   = The object to test for returning the party
|sourcefile=script.ldf
+
|returntype   = object
|sourcemodule=
+
|returnarra    = true
 +
|returndesc   = Returns an array of all members in the creature's party
 +
|sourcemodule  =
 +
|sourcefile   = script.ldf
 
}}
 
}}
 
 
<!-- == Description == -->
 
<!-- == Description == -->
 
<!-- This section contains the full description from the functions comments. Do not change unless you are confident these are incomplete or incorrect. -->
 
<!-- This section contains the full description from the functions comments. Do not change unless you are confident these are incomplete or incorrect. -->
 
+
== Remarks ==
<!-- == Remarks == -->
+
 
<!-- This section contains additional comments, observations and known issues. -->
 
<!-- This section contains additional comments, observations and known issues. -->
 +
If oCreature is not specified then the array returned is for the player's party and the player's character is included in the array.
 +
== Examples ==
 +
<!-- This section contains examples transcluded from the snippet library. -->
 +
The following function checks the whole party for a specified item to have in inventory:
 +
<dascript>
 +
int Party_GetItemPossedBy(object oCreature, string sItemTag)
 +
{         
 +
    object oItem;
 +
    int nPartyMember;
  
<!-- == Examples == -->
+
    // get the party list and its size
<!-- This section contains examples transcluded from the snippet library. -->
+
    object[] oPartyMembers = GetPartyList(oCreature);
 +
    int nPartyMembers = GetArraySize(oPartyMembers);
 +
           
 +
    // loop over the party and check each member for a matching item
 +
    for(nPartyMember; nPartyMember < nPartyMembers; nPartyMember++)
 +
    {   
 +
        // check if the item exists and if so return true
 +
        oItem = GetItemPossessedBy(oPartyMembers[nPartyMember], sItemTag);
 +
        if(IsObjectValid(oItem))
 +
        {
 +
            return TRUE;
 +
        }
 +
    }                 
 +
         
 +
    // otherwise return false
 +
    return FALSE;
 +
}
 +
</dascript>
  
<!-- == See also == -->
+
== See also ==
 
<!-- This section contains links to articles, functions or constant groups. -->
 
<!-- This section contains links to articles, functions or constant groups. -->
 +
[[GetParty]]
  
 
[[Category: Party and group control]]
 
[[Category: Party and group control]]

Latest revision as of 12:54, 7 September 2011

Returns the party list for a creature.

object[] GetPartyList(
object oCreature = OBJECT_INVALID
);
Parameters:
oCreature
The object to test for returning the party
Returns:

Returns an array of all members in the creature's party

Source:

script.ldf

Remarks

If oCreature is not specified then the array returned is for the player's party and the player's character is included in the array.

Examples

The following function checks the whole party for a specified item to have in inventory:

 int Party_GetItemPossedBy(object oCreature, string sItemTag)
 {           
    object oItem;
    int nPartyMember;
 
    // get the party list and its size
    object[] oPartyMembers = GetPartyList(oCreature);
    int nPartyMembers = GetArraySize(oPartyMembers);
 
    // loop over the party and check each member for a matching item
    for(nPartyMember; nPartyMember < nPartyMembers; nPartyMember++)
    {     
        // check if the item exists and if so return true
        oItem = GetItemPossessedBy(oPartyMembers[nPartyMember], sItemTag);
        if(IsObjectValid(oItem))
        {
            return TRUE;
        }
    }                   
 
    // otherwise return false
    return FALSE;
 }

See also

GetParty