We have detected that cookies are not enabled on your browser. Please enable cookies to ensure the proper experience.
Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2011
    Posts
    10

    Get player experience points

    Hi everyone,

    I might have asked this before, but does anyone know of any way to get the current player's experience points?
    I've looked through the updated API but I can only see access to Level and LevelChanged event on the Actor.

    Am I missing something, or is it just not achievable with the currently exposed API?

    Any pointers are greatly appreciated.

    Thank you!

  2. #2
    Join Date
    Mar 2007
    Posts
    1,590
    AFAIK, the only way is to parse it from the Advancement channel chat message when you gain xp. You would simply have to have a chat handler installed that looks for messages like "You've earned 24 XP for a total of 8,866 XP." in the Advancement channel and capture the total. I would recommend using the string.match function and learning about Lua patterns (similar to regex but not exactly the same) and captures. There are quite a few examples of chat handlers in existing plugins. Then whenever the player earns any xp you can start tracking the total - of course this only works if the user keeps your plugin loaded at all times.

  3. #3
    Join Date
    Jun 2011
    Posts
    391
    Quote Originally Posted by Garan View Post
    AFAIK, the only way is to parse it from the Advancement channel chat message when you gain xp. You would simply have to have a chat handler installed that looks for messages like "You've earned 24 XP for a total of 8,866 XP." in the Advancement channel and capture the total. I would recommend using the string.match function and learning about Lua patterns (similar to regex but not exactly the same) and captures. There are quite a few examples of chat handlers in existing plugins. Then whenever the player earns any xp you can start tracking the total - of course this only works if the user keeps your plugin loaded at all times.
    To be explicit, if you were to load the plugin for the first time after already earning any XP ever you would need to manually add the XP to the plugin. Every crash to desktop would require you to update the XP tracked manually to be up to date. So it is not impossible, just inconvenient in places.

  4. #4
    Join Date
    Jun 2011
    Posts
    10
    Quote Originally Posted by Garan View Post
    AFAIK, the only way is to parse it from the Advancement channel chat message when you gain xp. You would simply have to have a chat handler installed that looks for messages like "You've earned 24 XP for a total of 8,866 XP." in the Advancement channel and capture the total. I would recommend using the string.match function and learning about Lua patterns (similar to regex but not exactly the same) and captures. There are quite a few examples of chat handlers in existing plugins. Then whenever the player earns any xp you can start tracking the total - of course this only works if the user keeps your plugin loaded at all times.
    Actually, this makes a lot of sense. If I can get access to the text saying "You gained X xp for a total of Y xp" then I only need to extract the total XP.
    I should know how much XP you need for each level, because it's available on the wiki and I can just hardcode it.
    And I already know your current level.

    With all of this, you only need to gain xp once from any source for the plugin to get back to date!

    Thanks so much I'll try this and report back.

  5. #5
    Join Date
    Jun 2011
    Posts
    10
    I've managed to do it like described above!
    Here's what it looks like:


  6. #6
    Join Date
    Jun 2011
    Posts
    391
    Quote Originally Posted by wande View Post
    I've managed to do it like described above!
    Here's what it looks like:

    That is great, I did not realize the total is mentioned in chat. I can think of a useful feature in adding XP/h for the current play session - it would allow you to compare skirmishing vs questing vs instances vs grinding. Or also parsing for quest completion text, averaging XP per quest and giving a rough number of quests needed for the next level. Will you upload a plugin to lotrointerface.com or be sharing the source code otherwise?

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

This form's session has expired. You need to reload the page.

Reload