Il semble que les cookies ne soient pas activés dans votre navigateur. Veuillez activer les cookies pour garantir une expérience du site optimale.
Affichage des résultats 1 à 6 sur 6
  1. #1
    Date d'inscription
    juin 2011
    Messages
    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
    Date d'inscription
    mars 2007
    Messages
    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
    Date d'inscription
    juin 2011
    Messages
    391
    Citation Envoyé par Garan Voir le message
    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
    Date d'inscription
    juin 2011
    Messages
    10
    Citation Envoyé par Garan Voir le message
    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
    Date d'inscription
    juin 2011
    Messages
    10
    I've managed to do it like described above!
    Here's what it looks like:


  6. #6
    Date d'inscription
    juin 2011
    Messages
    391
    Citation Envoyé par wande Voir le message
    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?

 

 

Règles de messages

  • Vous ne pouvez pas créer de nouvelles discussions
  • Vous ne pouvez pas envoyer des réponses
  • Vous ne pouvez pas envoyer des pièces jointes
  • Vous ne pouvez pas modifier vos messages
  •  

La session de ce formulaire a expiré. Vous devez recharger la page.

Recharger