GetSkillRank(int, object)
Determines a creature's rank in particular skill.
int GetSkillRank( int nSkill, object oTarget = OBJECT_SELF );
Parameters
nSkill
oTarget
The creature to check what rank they have in nSkill. (Default: OBJECT_SELF)
Description
Returns the number of ranks that oTarget has in nSkill.
If nSkill is untrained this function returns 0, and -1 if oTarget doesn't have nSkill. See known bugs for why it might never return -1.
Remarks
Use GetHasSkill to see if they have the skill and can use it, for example, to check if they have a useable Animal Empathy in a conversation. This mearly returns the value of ranks they have - therefore, it normally does return at least 0, you can't make yourself have negative ranks!
The fact that it returns the ranks may mean it never returns -1, as noted below, even though the description says it.
Known Bugs
Its been remarked that it appears to be returning 0, not -1, if a PC does not have any ranks in a skill and it it one that requires training.
Version
1.22
Example
// This script would be placed in a conversation // where the player challenges the Master Bard to // a performance duel. void main() { // Initialize Objects object oPlayer = GetPCSpeaker(); // Determine skill checks int iPPerCheck = d20(1) + GetSkillRank(SKILL_PERFORM, oPlayer); int iMPerCheck = d20(1) + GetSkillRank(SKILL_PERFORM, OBJECT_SELF); // Compare the two skill checks if (iPPerCheck > iMPerCheck) { // Player wins perform duel // Place reward code here } else { //Player looses perform duel //Place failure code here } }
See Also
functions: | ActionUseSkill |
categories: | Talents/Skills/Feats Functions |
constants: | SKILL_* Constants |
author: Tom Cassiotis, editor: Jasperre, additional contributor(s): Jasperre, John Baker
Send comments on this topic.