Wir haben festgestellt, dass Euer Browser keine Cookies akzeptiert. Bitte erlaubt die Verwendung von Cookies in den Optionen Eures Browsers, um eine optimale Funktion dieser Webseite zu gewährleisten.
Ergebnis 1 bis 6 von 6
  1. #1
    Registriert seit
    15.06.2011
    Beiträge
    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
    Avatar von Garan
    Garan ist offline Defender of the Hornburg
    Registriert seit
    25.03.2007
    Beiträge
    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
    Registriert seit
    02.06.2011
    Beiträge
    391
    Zitat Zitat von Garan Beitrag anzeigen
    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
    Registriert seit
    15.06.2011
    Beiträge
    10
    Zitat Zitat von Garan Beitrag anzeigen
    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
    Registriert seit
    15.06.2011
    Beiträge
    10
    I've managed to do it like described above!
    Here's what it looks like:


  6. #6
    Registriert seit
    02.06.2011
    Beiträge
    391
    Zitat Zitat von wande Beitrag anzeigen
    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?

 

 

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •  

Diese Formular-Sitzung ist abgelaufen. Du musst die Seite neu laden.

Neu laden