Difference between revisions of "GetPartyList"

From Dragon Age Toolset Wiki
Jump to: navigation, search
m (Marked for my attention)
m (Applying template, cleaning up example)
 
Line 1: Line 1:
{{ToDoListItem|Sunjammer}}
+
{{dafunction
Returns the party list for the creature  
+
|name          = GetPartyList
<dascript>
+
|brief        = Returns the party list for a creature.
object[] GetPartyList(
+
|param1type    = object
 
+
|param1arra    =
    object oCreature = -1
+
|param1name    = oCreature
 
+
|param1default = [[OBJECT_INVALID keyword|OBJECT_INVALID]]
);
+
|param1desc    = The object to test for returning the party
</dascript>
+
|returntype    = object
'''Parameters:'''
+
|returnarra    = true
 
+
|returndesc    = Returns an array of all members in the creature's party
''oCreature''
+
|sourcemodule =
 
+
|sourcefile    = script.ldf
'''Returns:'''
+
}}
 
+
<!-- == Description == -->
An array containing the objects of all the party members.
+
   
+
'''Source:'''
+
 
+
[[script.ldf]]
+
== 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. -->
Returns the whole current Party of oCreature (Default is the Hero-Party)
 
 
 
== Remarks ==
 
== Remarks ==
 
<!-- This section contains additional comments, observations and known issues. -->
 
<!-- This section contains additional comments, observations and known issues. -->
The Hero is included in the Array
+
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 ==
 
== Examples ==
 
<!-- This section contains examples transcluded from the snippet library. -->
 
<!-- 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)
* Description:
+
* Checks the whole party for a specified
+
* item to have in inventory (conversation
+
* condition script)
+
*
+
* Created By: GameScripting
+
* Created On: 12.01.2011
+
*/
+
/********************************************/
+
 
+
  int StartingConditional()
+
 
  {           
 
  {           
    // Gets the Partylist of the Hero
 
    object[] oPartyList = GetPartyList();
 
                                             
 
    // Gets the size of the Party
 
    int nPartySize = GetArraySize(oPartyList);
 
             
 
    // A simple Counter Variable
 
    int i = 0;
 
 
     object oItem;
 
     object oItem;
      
+
     int nPartyMember;
     // We'll loop though the whole party to check for one of the followers
+
 
     // to have the specified item
+
     // get the party list and its size
     for(i; i < nPartySize; i++)
+
    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++)
 
     {     
 
     {     
         // Get the Item-Object
+
         // check if the item exists and if so return true
         oItem = GetItemPossessedBy(oPartyList[i], "MyItemTag");
+
         oItem = GetItemPossessedBy(oPartyMembers[nPartyMember], sItemTag);
                             
+
        // If the object is valid return true ...
+
 
         if(IsObjectValid(oItem))
 
         if(IsObjectValid(oItem))
 
         {
 
         {
Line 68: Line 42:
 
     }                   
 
     }                   
 
            
 
            
     // ... otherwise return false
+
     // otherwise return false
 
     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]]()
+
[[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