GetMatchCompatibility
From NWN Lexicon
Contents |
[edit] GetMatchCompatibility(talent, string, int)
Check if creature is able use a talent from a selected class in the requested method.
int GetMatchCompatibility( talent tUse, string sClass, int nType );
[edit] Parameters
tUse
The talent to check.
sClass
The class to check.
nType
The method to use. (variable) NW_TALENT_*
[edit] Description
Returns a boolean true/false if the talent tUse is effective in protecting the NPC versus the sClass passed in. It is used to make random behavior.
[edit] Remarks
The function normally called prior to GetMatchCompatibility() is GetCreatureTalentRandom() which can only return a talen an NPC has, then GetMatchCompatibility checks to see if that talent is useful against the specified class.
[edit] Requirements
#include " x0_i0_match "
[edit] Version
1.26
[edit] Example
// NPC AI code (NOT TESTED IN ALL CASES) // SOME CODE TAKEN FROM nw_i0_generic I TAKE NO CREDIT FOR IT. #include "x0_i0_match" void main() { talent tUse; struct sEnemies sCount = DetermineEnemies(); int bValid = FALSE; int nCnt; string sClass = GetMostDangerousClass(sCount); while(GetIsTalentValid(tUse) && nCnt < 10) { tUse = GetCreatureTalentRandom(TALENT_CATEGORY_BENEFICIAL_PROTECTION_SELF); if(GetIsTalentValid(tUse) && GetMatchCompatibility(tUse, sClass, NW_TALENT_PROTECT)) { bValid = TRUE; nCnt = 11; } nCnt++; } if(bValid == TRUE) SendMessageToPC(GetFirstPC(),"NPC CAN USE TALENT"); }
[edit] See Also
functions: |
author: GoLeM, editor: Charles Feduke, Mistress, additional contributor: Genji