ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   How do I identify whether a character is in a particular Guild like Fighters or Mages (https://www.esoui.com/forums/showthread.php?t=8688)

Hydra9268 08/08/19 03:14 AM

How to identify whether a character is in a particular Guild like Fighters or Mages?
 
Here's my code.

Lua Code:
  1. -- /dump d(ZGV.Utils.SkillLines(false,true,false,true,true))
  2. function Utils.SkillLines(showType,showLineInfo,showLineXP,showSkillAbilities,showAbilityInfo)
  3.     if showType then
  4.         d("Number of Skill Types: "..GetNumSkillTypes().."\n-----------------------------")
  5.     end
  6.     if showLineInfo then
  7.         for index = 0,GetNumSkillLines(SKILL_TYPE_GUILD) do
  8.             d(index..": "..GetSkillLineInfo(SKILL_TYPE_GUILD, index))
  9.         end
  10.         d("-----------------------------")
  11.     end
  12.     if showLineXP then
  13.         for index = 0,GetSkillLineXPInfo(SKILL_TYPE_GUILD) do
  14.             d(index..": "..GetSkillLineXPInfo(SKILL_TYPE_GUILD, index))
  15.         end
  16.         d("-----------------------------")
  17.     end
  18.     if showSkillAbilities then
  19.         for index = 0,GetNumSkillAbilities(SKILL_TYPE_GUILD) do
  20.             d(index..": "..GetNumSkillAbilities(SKILL_TYPE_GUILD, index))
  21.         end
  22.         d("-----------------------------")
  23.     end
  24.     if showAbilityInfo then
  25.         local hasProgression, progressionIndex, lastRankXP, nextRankXP, currentXP, atMorph = GetAbilityProgressionXPInfoFromAbilityId(abilityId)
  26.         local skillType, skillIndex, abilityIndex = GetSkillAbilityIndicesFromProgressionIndex(progressionIndex)
  27.         local abilityId2 = GetSkillAbilityId(skillType, skillIndex, abilityIndex)
  28.         d("GetSkillAbilityId: "..abilityId2)
  29.         d("skillType: "..skillType)
  30.         d("skillIndex: "..skillIndex)
  31.         d("abilityIndex: "..abilityIndex)
  32.         d("-----------------------------")
  33.         if hasProgression then d("hasProgression: true") else d("hasProgression: false") end
  34.         d("progressionIndex: "..progressionIndex)
  35.         d("lastRankXP: "..lastRankXP)
  36.         d("nextRankXP: "..nextRankXP)
  37.         d("currentXP: "..currentXP)
  38.         if atMorph then d("atMorph: true") else d("atMorph: false") end
  39.         d("-----------------------------")
  40.     end
  41. end

And what it outputs


It's based off of this text file. As far as I know, these appear to be the only public functions that provide skill line information. However, it does so in a generalized way and not in the way I need.



Basically what I am looking for is a simple boolean against a Guild to see if it appears in the list of Skills (e.g. false returned if player isn't in the Fighters guild, or true returned if player is in the Mages guild, etc.).

Any ideas?

Baertram 08/08/19 06:34 AM

Code:

* GetSkillLineDynamicInfo(*[SkillType|#SkillType]* _skillType_, *luaindex* _skillLineIndex_)
** _Returns:_ *luaindex* _rank_, *bool* _advised_, *bool* _active_, *bool* _discovered_

*bool* _advised_
*bool* _active_
*bool* _discovered_
One of these should say true if you have it activated or discovered. Where discovered maybe also true if you have found a book of the mages guild but ar enot member of the mages guild? Not sure, you'd need to test this.

Skilltype = SKILL_TYPE_GUILD
skillLineIndex = The guild's index you want to check

Lua Code:
  1. local function checkIfInSkillGuild(guildSkillIndex)
  2.    if guildSkillIndex <= 0 then return end
  3.    local  rank, advised, active, discovered = GetSkillLineDynamicInfo(SKILL_TYPE_GUILD, guildSkillIndex)
  4.    return active
  5. end

Hydra9268 08/08/19 11:43 AM

Excellent. Thanks, Baertram. :)


All times are GMT -6. The time now is 12:03 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI