Difference between revisions of "GetPartyList"
From Dragon Age Toolset Wiki
BryanDerksen (Talk | contribs) m (1 revision: re-import with default parameter value parameters set) |
m (Applying template, cleaning up example) |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | |||
{{dafunction | {{dafunction | ||
− | |name=GetPartyList | + | |name = GetPartyList |
− | |brief=Returns the party list for | + | |brief = Returns the party list for a creature. |
− | |param1type=object | + | |param1type = object |
− | |param1name=oCreature | + | |param1arra = |
− | | | + | |param1name = oCreature |
− | | | + | |param1default = [[OBJECT_INVALID keyword|OBJECT_INVALID]] |
− | |returntype=object | + | |param1desc = The object to test for returning the party |
− | |returndesc= | + | |returntype = object |
− | |sourcefile=script.ldf | + | |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 == | |
− | + | ||
<!-- 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; | ||
− | + | // 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; | ||
+ | } | ||
+ | </dascript> | ||
− | + | == 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.
- 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; }