A question about the types of armor
2 posters
Page 1 of 1
A question about the types of armor
Riddle me this, riddle me that...
My question is a simple one - is there a scripting command that allows one to determine the type of armor a PC is wearing (light, medium, etc...)? I have need of detecting the armor type worn, and am very curious to see if such a thing is possible. Have any of you scriptmonkeys seen something along these lines!
An internets for teh winnar!
My question is a simple one - is there a scripting command that allows one to determine the type of armor a PC is wearing (light, medium, etc...)? I have need of detecting the armor type worn, and am very curious to see if such a thing is possible. Have any of you scriptmonkeys seen something along these lines!
An internets for teh winnar!
Eric of Atrophy- Ludicrous Level
- . :
Number of posts : 4113
Age : 51
Location : Kea'au, HI, USA
Main Character : The Vault of Atrophy
NWN Username : atrophied_eric
DM Name : Dungeon Mistress Anaurra Lide
Time Zone : GMT - 10:00 EST (We have our own time zone!)
Registration date : 2008-06-06
Re: A question about the types of armor
- Code:
// Example of a time to use this function, when a blacksmith needs
// to check if a piece of armor the character is wearing can be
// actually forged.
// It can only be forged if it is has an total AC of 4 to 7. This is
// when it will return TRUE.
void main()
{
// Get the item
object oItem = GetItemInSlot(INVENTORY_SLOT_CHEST, GetPCSpeaker());
// Get the AC value of it
int nAC = GetItemACValue(oItem);
// Check the value
if(nAC >= 3 && nAC <= 7)
{
// Passes
return TRUE;
}
return FALSE;
}
// Sample code 2. This is a very simple function that will accuratly
// use the unidentified (base price of that item type) to get the
// base AC value.
// So, 0 is clothing, up to 8, which is full plate.
// Returns the base armor type as a number, of oItem
// -1 if invalid, or not armor, or just plain not found.
// 0 to 8 as the value of AC got from the armor - 0 for none, 8 for Full plate.
int GetArmorType(object oItem)
{
// Make sure the item is valid and is an armor.
if (!GetIsObjectValid(oItem))
return -1;
if (GetBaseItemType(oItem) != BASE_ITEM_ARMOR)
return -1;
// Get the identified flag for safe keeping.
int bIdentified = GetIdentified(oItem);
SetIdentified(oItem,FALSE);
int nType = -1;
switch (GetGoldPieceValue(oItem))
{
case 1: nType = 0; break; // None
case 5: nType = 1; break; // Padded
case 10: nType = 2; break; // Leather
case 15: nType = 3; break; // Studded Leather / Hide
case 100: nType = 4; break; // Chain Shirt / Scale Mail
case 150: nType = 5; break; // Chainmail / Breastplate
case 200: nType = 6; break; // Splint Mail / Banded Mail
case 600: nType = 7; break; // Half-Plate
case 1500: nType = 8; break; // Full Plate
}
// Restore the identified flag, and return armor type.
SetIdentified(oItem,bIdentified);
return nType;
}
Alundaio- Aenean Scholar
- Number of posts : 372
Age : 39
Main Character : Alundaio
Time Zone : GMT-04:00 (EST)
. :
Registration date : 2009-09-14
Re: A question about the types of armor
Nwn Lexicon is your friend, use it.
Alundaio- Aenean Scholar
- Number of posts : 372
Age : 39
Main Character : Alundaio
Time Zone : GMT-04:00 (EST)
. :
Registration date : 2009-09-14
Re: A question about the types of armor
Thank you, Alundaio, that's just what I needed!
Eric of Atrophy- Ludicrous Level
- . :
Number of posts : 4113
Age : 51
Location : Kea'au, HI, USA
Main Character : The Vault of Atrophy
NWN Username : atrophied_eric
DM Name : Dungeon Mistress Anaurra Lide
Time Zone : GMT - 10:00 EST (We have our own time zone!)
Registration date : 2008-06-06
Similar topics
» Armor alterations question...
» Findable treasure question (Armor of elemental air)
» damage types
» Not Used: Damage types
» Not Used: Love for the rogu-ish types maybe?
» Findable treasure question (Armor of elemental air)
» damage types
» Not Used: Damage types
» Not Used: Love for the rogu-ish types maybe?
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum