Sulan once asked me if it is possible to read all attributes that something has. Turns out that you CAN!
For example, this will return all attributes that the player has:
You can investigate further with, for example, all attributes that the player ship has:
You can also check the player ship type:
Or the player location:
Or the blade that the player uses:
Use trace() instead of LogIt() to have the full list posted in compile.log so you can read it without it disappearing from your screen.
I hope you find this useful for modding!
For example, this will return all attributes that the player has:
Code:
aref arAttributes; makearef(arAttributes, PChar);
int nMasts = GetAttributesNum(arAttributes);
for (int m = 0; m < nMasts; m++)
{
aref arAttribute = GetAttributeN(arAttributes, m);
string sAttribute = GetAttributeName(arAttribute);
LogIt("Attribute Name = " + sAttribute);
}
Code:
aref arAttributes; makearef(arAttributes, PChar.ship); // Change what you are interrogating here
int nMasts = GetAttributesNum(arAttributes);
for (int m = 0; m < nMasts; m++)
{
aref arAttribute = GetAttributeN(arAttributes, m);
string sAttribute = GetAttributeName(arAttribute);
LogIt("Attribute Name = " + sAttribute);
}
Code:
int iShipType = GetCharacterShipType(PChar);
if (iShipType < 0 || iShipType == SHIP_NOTUSED) return 0;
ref rShip; makeref(rShip, ShipsTypes[iShipType]);
aref arAttributes; makearef(arAttributes, rShip);
int nMasts = GetAttributesNum(arAttributes);
for (int m = 0; m < nMasts; m++)
{
aref arAttribute = GetAttributeN(arAttributes, m);
string sAttribute = GetAttributeName(arAttribute);
LogIt("Attribute Name = " + sAttribute);
}
Code:
ref lcn = &Locations[FindLocation(pchar.location)];
aref arAttributes; makearef(arAttributes, lcn);
int nMasts = GetAttributesNum(arAttributes);
for (int m = 0; m < nMasts; m++)
{
aref arAttribute = GetAttributeN(arAttributes, m);
string sAttribute = GetAttributeName(arAttribute);
LogIt("Attribute Name = " + sAttribute);
}
Code:
string weaponID = PChar.equip.blade; // defines weaponname
aref weapon;
Items_FindItem(weaponID, &weapon); // defines object for weaponattributes
aref arAttributes; makearef(arAttributes, weapon);
int nMasts = GetAttributesNum(arAttributes);
for (int m = 0; m < nMasts; m++)
{
aref arAttribute = GetAttributeN(arAttributes, m);
string sAttribute = GetAttributeName(arAttribute);
LogIt("Attribute Name = " + sAttribute);
}
I hope you find this useful for modding!