Aller au contenu

Photo

Restrict armor


  • Veuillez vous connecter pour répondre
5 réponses à ce sujet

#1
Surek

Surek
  • Members
  • 94 messages

I have a question about armor.
Is there any way to restrict a certain armor type from being worn by the PC through scripting?
Example, restricting the PC from wearing any type of heavy armor. Any ideas on how to do this would be greatly appreciated.



#2
Proleric

Proleric
  • Members
  • 2 356 messages

The usual way to do this is in the module OnPlayerEquipItem event. For example, here is the CEP script which prevents wearing items if the custom gender restriction applies:

 

Spoiler

 

In your example of heavy armour, you could check GetBaseItemType instead.



#3
meaglyn

meaglyn
  • Members
  • 811 messages

The armors will all have the same baseitem type so it gets a little more complicated. The type of the armor is based on the chest part's ACBONUS value, which in turn determines if it's light, medium or heavy.

   int nTorso = GetItemAppearance( oItem, ITEM_APPR_TYPE_ARMOR_MODEL, ITEM_APPR_ARMOR_MODEL_TORSO);
   // Read 2DA for base AC
   string sACBase = Get2DAString( "parts_chest","ACBONUS", nTorso);
   int nAC = StringToInt(sACBase);

Then use nAC to determine if you consider this heavy armor or not. I think the game uses >= 6 for heavy.  Of course you'll want to check the base item type is armor before using the above or won't mean much.


  • Kato - aime ceci

#4
Proleric

Proleric
  • Members
  • 2 356 messages

The armors will all have the same baseitem type so it gets a little more complicated....

lol I remembered that shortly after posting - thanks for the correction.

#5
meaglyn

meaglyn
  • Members
  • 811 messages

I thought you probably knew that :)  I was just giving a more complete soultion rather than trying to correct you.  


  • Proleric aime ceci

#6
Proleric

Proleric
  • Members
  • 2 356 messages
No worries - it's just that I was driving around all day thinking "actually what I said was bollox" so glad you put it straight.