|
||||||
| Lua Code Discussion You scared? Terrified. Mortified. Petrified. Stupefied... by [coding]. | ||||||
![]() |
|
|
Thread Tools |
|
|
#1 |
|
Member
Join Date: Nov 2010
Posts: 24
|
Alright, I'm in a forming raid group and there GetNumRaidMembers() returns 7.
How do I know if that's 7/10, 7/25 or even possibly 7/40? I see no way to get the M part of n/M where n is how many members are now present, but M is what "Raid Difficulty" is set to under the leaders drop down menu. Surely this should be easy, but I'm missing it completely. Thanks for any help, Andy |
|
|
|
|
|
#2 |
|
Hero Member
Join Date: Nov 2005
Posts: 803
|
|
|
|
|
|
|
#3 |
|
Seal Cub Clubbing Club
Join Date: May 2005
Location: California, US
Posts: 7,758
|
GetInstanceInfo will only work if you're already inside the target instance.
To get the currently selected raid difficulty before you enter the instance, use GetRaidDifficulty (return values match passable parameters for SetRaidDifficulty). You may also wish to check whether you are in a battleground or outdoor combat zone (usually treated as a 40-player raid), a battleground, etc. Here is the relevant code from Grid that determines which group type the player is currently in: Code:
local function GetPartyState() local _, instance_type = IsInInstance() if instance_type == "arena" then return "arena" end if instance_type == "pvp" then return "bg" end if GetNumRaidMembers() > 0 then if instance_type == "none" and GetZonePVPInfo() == "combat" then return "bg" end if instance_type == "raid" then local _, _, _, _, max_players = GetInstanceInfo() return max_players > 10 and "raid_25" or "raid_10" else local raid_difficulty = GetRaidDifficulty() return (raid_difficulty == 2 or raid_difficulty == 4) and "raid_25" or "raid_10" end end if GetNumPartyMembers() > 0 then return "party" end return "solo" end
__________________
& Author/maintainer of Grid, PhanxChat, and many more. | PM me on CurseForge Troubleshoot an addon | Turn any code into an addon | More addon resources Need help with your code? Attach or paste your whole, real files. Please don't PM me about addon bugs, requests, or code help. Post a comment, ticket, or thread instead! |
|
|
|
|
|
#4 |
|
Member
Join Date: Nov 2010
Posts: 24
|
Thank you, I will give that a try.
|
|
|
|
![]() |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|
All times are GMT. The time now is 06:05 AM.
WowAce Forums




