Would you like to react to this message? Create an account in a few clicks or log in to continue.

A question about the types of armor

2 posters

Go down

A question about the types of armor Empty A question about the types of armor

Post by Eric of Atrophy Tue Nov 10, 2009 10:22 pm

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!
Eric of Atrophy
Eric of Atrophy
Ludicrous Level
Ludicrous Level

. : Dungeon Master
Male Number of posts : 4112
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

http://myanimelist.net/profile/Eric_of_Atrophy

Back to top Go down

A question about the types of armor Empty Re: A question about the types of armor

Post by Alundaio Tue Nov 10, 2009 10:51 pm

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
Alundaio
Aenean Scholar
Aenean Scholar

Male Number of posts : 372
Age : 39
Main Character : Alundaio
Time Zone : GMT-04:00 (EST)
. : A question about the types of armor Forum_donor
Registration date : 2009-09-14

Back to top Go down

A question about the types of armor Empty Re: A question about the types of armor

Post by Alundaio Tue Nov 10, 2009 10:53 pm

Nwn Lexicon is your friend, use it.
Alundaio
Alundaio
Aenean Scholar
Aenean Scholar

Male Number of posts : 372
Age : 39
Main Character : Alundaio
Time Zone : GMT-04:00 (EST)
. : A question about the types of armor Forum_donor
Registration date : 2009-09-14

Back to top Go down

A question about the types of armor Empty Re: A question about the types of armor

Post by Eric of Atrophy Wed Nov 11, 2009 12:21 am

Thank you, Alundaio, that's just what I needed!
Eric of Atrophy
Eric of Atrophy
Ludicrous Level
Ludicrous Level

. : Dungeon Master
Male Number of posts : 4112
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

http://myanimelist.net/profile/Eric_of_Atrophy

Back to top Go down

A question about the types of armor Empty Re: A question about the types of armor

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum