GetBlobsByNameListBlob
From King Arthur's Gold Wiki
Revision as of 20:10, 20 August 2012 by Shadlington (Talk | contribs)
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; } }