Thread Tools Display Modes
08/29/14, 01:20 PM   #1
SnowmanDK
 
SnowmanDK's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 161
[SOLVED] Getting achievements completed for current zone?

Hi all.
I know that
GetAchievementCriterion(872)
will return
19
as that's the requirement to complete the Achievement for finding M'aiq.

What I need to do is to track if I already have him in my current zone.

In have messed around with different codes a lot, but can't seem to make it work properly.

What I need is a way to say something like:
Lua Code:
  1. local REQ = 1   -- the number of times I need to find Ma'iq in this zone.
  2. if LocalAchievement(872) == REQ then
  3.    PrintLine("M'aiq is completed in this zone")
  4. else
  5.    PrintLine("M'aiq is missing in this zone")
  6. end

Last edited by SnowmanDK : 08/29/14 at 05:11 PM.
  Reply With Quote
08/29/14, 01:41 PM   #2
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by SnowmanDK View Post
Hi all.
I know that
GetAchievementCriterion(872)
will return
19
as that's the requirement to complete the Achievement for finding M'aiq.

What I need to do is to track if I already have him in my current zone.

In have messed around with different codes a lot, but can't seem to make it work properly.

What I need is a way to say something like:
Lua Code:
  1. local REQ = 1   -- the number of times I need to find Ma'iq in this zone.
  2. if LocalAchievement(872) == REQ then
  3.    PrintLine("M'aiq is completed in this zone")
  4. else
  5.    PrintLine("M'aiq is missing in this zone")
  6. end
From the API documentation:

GetAchievementCriterion(integer achievementId, luaindex criterionIndex)
Returns: string description, integer numCompleted, integer numRequired

If numCompleted == numRequired criterion is completed.

So if you want to know if you have found M'aiq in Auridon, you have to use:
Lua Code:
  1. local desc, completed, required = GetAchievementCriterion(872, 2)
  2. if completed >= required then
  3.    d("Completed")
  4. end
Criterion index is counted from the top - you can check it in game in achievement window or on Esohead:
http://esohead.com/achievements/872-i-like-maiq
  Reply With Quote
08/29/14, 05:10 PM   #3
SnowmanDK
 
SnowmanDK's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 161
Originally Posted by Garkin View Post
From the API documentation:

GetAchievementCriterion(integer achievementId, luaindex criterionIndex)
Returns: string description, integer numCompleted, integer numRequired

If numCompleted == numRequired criterion is completed.

So if you want to know if you have found M'aiq in Auridon, you have to use:
Lua Code:
  1. local desc, completed, required = GetAchievementCriterion(872, 2)
  2. if completed >= required then
  3.    d("Completed")
  4. end
Criterion index is counted from the top - you can check it in game in achievement window or on Esohead:
http://esohead.com/achievements/872-i-like-maiq
Perfect!!! Exactly what I was looking for. Thanks AGAIN Master Garkin
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Getting achievements completed for current zone?


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off