Difference between revisions of "GetBlobsByNameListBlob"
From King Arthur's Gold Wiki
Shadlington (Talk | contribs) (Created page with "<onlyinclude> Returns a reference to a CBlob from the 'Blobs By Name List' with the given index in the list. </onlyinclude> Make sure you call populateBlobsByNameList be...") |
(No difference)
|
Revision as of 20:08, 20 August 2012
Returns a reference to a CBlob from the 'Blobs By Name List' with the given index in the list.
Make sure you call populateBlobsByNameList before using this function, to ensure the list is up-to-date with the CBlobs of the correct type.
Because you're accessing by index number, you'll likely most commonly want to use this for iterating through all of the CBlobs of a particular type - in which case you will also want to use getBlobsByNameListSize to get the number of CBlobs in the list. It may also be useful if you want to get a random or the first CBlob of a particular type.
CBlob@ getBlobsByNameListBlob(int index)
Example from Rules/Scripts/WAR_Players.as:
// gather all tents and select assigned team's tent CBlob@ tent; populateBlobsByNameList( "tent" ); for (int i=0; i < getBlobsByNameListSize(); i++) { CBlob@ blob = getBlobsByNameListBlob(i); if (blob.getTeamNum() == assignedTeamNum) { @tent = blob; break; } }