Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Dark Dreams of Furiae - a new module for NWN:EE! Buy now
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

Looking for: XP on Chat System for PWs(automated Roleplay reward)

Hey guys, maybe you can help me out here.

I’m looking for a script system that has been available back in the days which I can’t find anymore nor do I know how it was called.

What this system basically did was awarding XP based on the amount of chat a player did during a specific timeframe.

In action it should reward players automatically for engaging in roleplay on a PW so they have the same character progression as people who spend their time more on monster hunting.

Would be really cool if someone could remember how such a system was called and if it is still to find somewhere so I could edit it to suite my idea.
I'm not proficient enough to create something like that from scratch unfortunately *sigh*

Thanks in advance!

Comments

  • badstrrefbadstrref Member Posts: 124
    edited December 2018
    Can you detail the system maybe someone could create it for you? I guess random chat spam doesn't give xp ?

    Talime
  • TalimeTalime Member Posts: 71
    Awww nah... I would never want someone occupy with something i personally need but for which I am too stupid to do myself :/, I just remember there have been systems like that available back in the days but cannot find them anymore.

    It is actaully rather simple:

    It is a system that basically awards X exp after Y time based on the amount of chat one person did till a cap Z is reached per day.

    So in a very simple term as an example: it will give up to 50 exp every 20 minutes based on the amount of chat done.
    So words or letters are counted.

    I thought about is being abused but really, it would be much more fun and efficient to just go kill monsters.
    It is intended as a system for roleplayers who spend 3 hours or so a day to sit in town and roleplay to get at least a bit of a character progression and don't feel forced to pause their roleplay in order to fill up a daily XP cap.

    At best there are variables that can be changed to tweak the amount of xp per amount of time per chat done.

    So what I hoped to find was a system where I could tweak:
    - how much xp per day can be achieved through it
    - how much xp per tick is given
    - how much time is between ticks
    - how much chat needs to be done to get 20, 40, 60, 80, 100% of said tick
    - preferebly only the normal say chat being counted, not group or whispers

    So a guy who does 10 minutes of roleplay gets only a fraction of the XP, the guy who does 2h of rp does gets.
    It is meant as an automated system to reward doing roleplay when no GM is available to do so. (most of the time) and which is more just than subjective GM rewardings.

    So since that is a rather big system(at least from what I think in my naive world) I would never ask someone to build it for me. I might be able to some day and then can provide it to the community myself :)

    Like I said those systems were available back in the days but after nwvault went down, so much seems to be lost :/

  • badstrrefbadstrref Member Posts: 124
    edited December 2018
    We must assume that this rewarding system is provided to a well behaving community, because otherwise it would require ai and deeplearning to distinguish abuse from legit RP. or 1DM : 1 player ratio to police...

    technically you can provide a "RPPoint" for each non OOC string, delay its attribution by one minute..., and decide for a maximum value of "RPPoint" (ie 60, or one hour) . so you have a ramp from 0 to 60, you can use this ramp to provide different XP values. once you grant XP you reset the "RPPoint" back to zero, and repeat.

    I have no idea really, this seems complex and I've never thought of something like this before.
    Also I've searched in the vault for ambient xp, rp xp and such, found nothing.
    good luck.

    (edit : if you want something as basic as the one I described, I'd be happy to write it, but it may not suit all your needs)

    Post edited by badstrref on
    Talime
  • TalimeTalime Member Posts: 71
    badstrref said:

    We must assume that this rewarding system is provided to a well behaving community, because otherwise it would require ai and deeplearning to distinguish abuse from legit RP. or 1DM : 1 player ratio to police...

    From my experience there will not be an issue with people abusing it. Mainly because my PW project won't really cater towards anyone else but hardcore rpers, just by the simple fact that there is not much to do and an XP cap will be in place. So hardcore leveling is not possible. And as such it would be rather boring for people to play there who are not seeking like 80% roleplay.

    And then the amount of XP generated by this system is way too slow to be effectively abused.

    The idea is that if you sit there spaming "kjashdkhadhakshkdshadk" for 20 minutes, you'd get like say 50 exp.
    It would be way more fun to just actually roleplay, or go monster hunting instead. So I'm not worried for it being abused.

    The only real restriction I'd like to have is that the "Rp count" is only counted in talk and whisper, not group or pm , dm chat, so extensive ooc chats are not rewarded by XP.
    And if possible but not required, if you could flag an area being completely OOC where the system is disabled entirely.


    So no no AI or so is required. By any means.

    Just a simple: "Use chat -> get x amount of XP over y time. Till cap z is reached per day." And if the variables x,y,z are adjustable it would be even more awesome and would fullill 100% of my needs. Really.

    The idea of cunting RP points and convert them to XP after a certain time sounds like an extremely cool solution.
    If it would be possible with the 3 configureable variables that makes it possible to determine how much XP per RPpoint is awarded, so the system can be scaled up and down for tweaking.
    One variable for the time between each RPPoint to XP ticks, so it could be per hour or per 20mins.
    Aswell as one to set the daily XP cap that can be achieved by this System. Like 500 per day, or 1000 per day.

    Reason for the variables are: I have not yet fully thought through how fast/slow I'd like to have people being able to level up.


    Ans as I am not fully aware how it works with scripting, if the daily XP can is globally (so also taking Monster XP into account) but ignores GM awarded XP, that would be a very cool bonus.


    So if you really, and I mean really want to try this out I'd be extremely glad and thankfull. I don't need a very complex system and by any means since I have yet nothing even closely found yet, everything is a help or at least starting point!
    Also if possible, and you're ok with it, I'd like this script be publicly available to the community.

    So in any case thank you so much for at least replying and offering something like that :)
    Still amazed every day on Discord, Chats and Forums how awesome the NWN community is.

    Love and best whishes,
    Talime / Leaf

  • badstrrefbadstrref Member Posts: 124
    edited December 2018
    Tried something, it is extremely basic.

    I'm sorry if this is ridiculously simple, but, it works (hope someone else can help you better)


    Save this file as _inc_chatxp
    // Minimum delay before granting another RP Point, in seconds
    const float fRPP_DELAY = 15.0;
    
    // Time at wich we sum the RP Points and distribute rewards, in seconds
    const float fRPP_REWARD_TIME = 60.0; // you can change this to anything higher than fRPP_DELAY
    
    // Base XP for each RP point
    const int nXP_PER_RPP = 25;     // 60s/15delay = 4 opportunities per minute to get a RPPoint x 25xp = You can earn 100xp per minute max
    
    
    void TrackChatXP(object oPC, string sChat)
    {
        if(!GetIsDM(oPC) && !GetIsDMPossessed(oPC))
        {
    
        string sOOC = GetStringLeft(sChat, 2);
        if(sOOC == ""    ||// Ignore empty
           sOOC == "//"  || sOOC == "((" || sOOC == "||" || // Ignore OOC chat here
           sOOC == "/p " || sOOC == "/d" || sOOC == "/s"    // Ignore some Channels here
           ){return;}
    
              if(!GetLocalInt(oPC, "RPP_AWARDED"))
              {
              int nRPP = GetLocalInt(oPC, "CHATXP_RPP"); int nRPP_New = nRPP +1;
              SetLocalInt(oPC, "CHATXP_RPP", nRPP_New);
              SendMessageToPC(oPC, "RP Points : "+IntToString(nRPP_New));
              SetLocalInt(oPC, "RPP_AWARDED", TRUE);
              DelayCommand(fRPP_DELAY, DeleteLocalInt(oPC, "RPP_AWARDED"));
              }
    
    
        }
    
    }
    
    
    void CycleChatXP()
    {
        int nRPP;
        int nReward;
    
        object oPC = GetFirstPC();
        while(GetIsObjectValid(oPC))
        {
            if(!GetIsDM(oPC) && !GetIsDMPossessed(oPC))
            {
               nRPP    = GetLocalInt(oPC, "CHATXP_RPP");
               if(nRPP > 0)
               {
               nReward = nRPP * nXP_PER_RPP;
               SetXP(oPC, GetXP(oPC) + nReward);
               SendMessageToPC(oPC, "You were granted "+IntToString(nReward)+"XP for "+IntToString(nRPP)+" RP Points");
               DeleteLocalInt(oPC, "CHATXP_RPP");
               }
            }
        oPC = GetNextPC();
        }
    
    DelayCommand(fRPP_REWARD_TIME, CycleChatXP());
    }
    


    This inside the module's on-chat
    #include "_inc_chatxp"
    
    void main()
    {
        object oPC   = GetPCChatSpeaker();
        string sChat = GetPCChatMessage();
    
        TrackChatXP(oPC, sChat);
    }

    This inside the module's on-load
    #include "_inc_chatxp"
    
    void main()
    {
      CycleChatXP();
    }
    

    Post edited by badstrref on
    Talime
  • TalimeTalime Member Posts: 71
    edited December 2018
    Simple is good, then I can understand it!
    Thank you so much, no matter how simpel it is , it is more than I currently had.

    Will test it out in a bit! *hugs*

    Best whishes,
    Talime/Leaf


    /edit:
    from my basic understandings here:
    Would it be somehow possible to cap the amount of XP received per day through this system? So that, lets say after receiving 500 XP from this, it no longer awards XP till next day or so?

    Not sure how NWN would handle daily based things though.


    /edit2:

    Mhm I might be stupid here, but you basically say that I should put 2 scripts here into one "onmodule load"
    and the first part of the first script and the second script both in onchat.

    *scratches her head* Uhm ... sooo even a 8 int Wildelf like me thinks this might be intended differently and something got mixed up while posting?

  • badstrrefbadstrref Member Posts: 124
    edited December 2018
    Talime said:


    /edit:
    from my basic understandings here:
    Would it be somehow possible to cap the amount of XP received per day through this system? So that, lets say after receiving 500 XP from this, it no longer awards XP till next day or so?

    Not sure how NWN would handle daily based things though.

    For this you will need persistant data because of relogging and temporary variable loss (NBDE can help).
    Then to get the elapsed 24hours you would need to substract 2 timestamps that you turned from Hours/Minutes/seconds into pure seconds and compare it to 24hours turned into seconds (86400s) , and I think module should be set to 60 minute per hour in advanced properties (instead for example of 2minutes for 1 hour)... Unless NWNX has a operating system timestamp grabbing function..
    Talime said:


    /edit2:

    Mhm I might be stupid here, but you basically say that I should put 2 scripts here into one "onmodule load"
    and the first part of the first script and the second script both in onchat.

    *scratches her head* Uhm ... sooo even a 8 int Wildelf like me thinks this might be intended differently and something got mixed up while posting?

    Please ignore what is written in the _inc_chatxp script.
    There is 3 scripts only, if you just copy paste them it should work, as long as you name the first _inc_chatxp
    I'm sorry, this turned a bit difficult.

    Post edited by badstrref on
    Talime
  • TalimeTalime Member Posts: 71
    edited December 2018
    Hey there!

    Ahh I understand, yes seems I was a bit stupid. And please don't apologize for me not being able to understand how scripting works.

    Mhm I see so a cap is appearently not possible, then maybe I have to rely on a complete daily XP cap. Not sure how to do that but that works somehow.
    Will find it out!

    Anyway thank you so much for that scrip it is awesome, really! Does exactly what I hoped it does.
    Would it be ok if I share it on nwnvault in your name? (or you might want to do it yourself)


    ___
    I found however a critical bug it seems: At least this occoured to me while testing:
    If I login as a DM character and then back to my player character, the system will no longer award me rp points nor xp.
    It seems it still counts my account as a DM.

    So in my naivity I'd say I have to change it to: GetIsPC(oPC) instead of !GetIsDM(oPC) ?

  • badstrrefbadstrref Member Posts: 124
    edited December 2018
    Talime said:


    Would it be ok if I share it on nwnvault in your name? (or you might want to do it yourself)

    it's a bit amateur script
    Talime said:


    I found however a critical bug it seems: At least this occoured to me while testing:
    If I login as a DM character and then back to my player character, the system will no longer award me rp points nor xp.
    It seems it still counts my account as a DM.

    So in my naivity I'd say I have to change it to: GetIsPC(oPC) instead of !GetIsDM(oPC) ?

    This is strange, I dunno about that, maybe EE bug? but GetIsPC() returns true for both DM and Players and
    object oPC = GetFirstPC(); // only real players
        while(GetIsObjectValid(oPC))
        {
            if(!GetIsDM(oPC) && !GetIsDMPossessed(oPC)) // continue if player is not DM 
            {
    from this code you can tell, it takes into count only real players, then filters DM's out

    Talime
  • TalimeTalime Member Posts: 71
    edited December 2018
    Edit2:

    I think I have found where the issue is:

    It has nothing to do with the DM character or not, it seems to break if a character relogs before the Delay counter was reset which then breaks the cycle by never reseting the delay counter for that character it seems. Till the server is restarted.


    If I relog after waiting 15sec (and NOT chatting of course) but before the XP reward is granted, the system continues flawelessly where it stopped.

    So after accumulating 2 points -> wait 15sec -> relogg -> getting the 3rd point -> get exp -> again 1. point as it should.

    If i accumulate 2 points -> not wait 15sec for the delay to finish and relogg immediately -> get exp on relog for 2 points -> no further point granted till server reset.

    So the reward cycle works perfectly just the accumulation cycle breaks because of how the delay function works.
    Maybe there is an easy way to fix that?









    I don't really know why this happens, but my idea was: If NWN connects GetIsDM even with player characters of said account, then just not to filter DMs out to fix it?

    Either way tested a few hours now and while everyone else got the exp, my charcater didn't even get a single point again after I logged into the DM client for a few seconds and then back again.

    Edit1:
    changed:

    if(!GetIsDM(oPC) && !GetIsDMPossessed(oPC)) // continue if player is not DM
    {
    to

    if(GetIsPC(oPC) && !GetIsDMPossessed(oPC)) // continue if player is not DM
    {


    Testing:
    I accumulated 3 RP points on my player character -> relogged to DM client before points were converted to XP
    Counter started at 1 again, as it should:
    Accuulated 2 RP points on the DM character now -> relogged to PC client before points were converted to XP

    Player character recieved XP from 2 points immediately (so no counter reset but also not starting from the PCcharacter counter but the DMcharacter counter), instead of 3 points and from that on was unable to get any further RP point. Even after that change.

    Testing further now!

    Testing2:
    changed:

    if(!GetIsDM(oPC) && !GetIsDMPossessed(oPC)) // continue if player is not DM
    {
    to

    if(GetIsPC(oPC)) // continue if player is not DM
    {

    It fixed the issue that the DMCharacters accumulated points were retrieved for the PCcharater, but still then no further RP point could be accumulated.

    And I have no idea why since now the system doesn't differenciate between DM and PC.

    Post edited by Talime on
  • badstrrefbadstrref Member Posts: 124
    edited December 2018
    Hi, as you said "RPP_AWARDED" is getting lost on relog, delaying things is always dangerous as we cant control future :)

    a simple fix would be to use inside your module's on-enter event :
    #include "_inc_chatxp"
    void main()
    {
    	object oPC = GetEnteringObject();
    	DelayCommand(fRPP_DELAY,  DeleteLocalInt(oPC, "RPP_AWARDED")); // upon relog, players will be able to earn RP Points after fRPP_DELAY (15 seconds in current configuration)
    }

    - or maybe don't use this script at all as it is problematic in quite a few ways... but maybe you can learn scripting and do something great, you already have a good eye / method for debugging

    Post edited by badstrref on
    Talime
  • TalimeTalime Member Posts: 71
    edited December 2018
    Edit:

    Tested your fix for the onenter event:
    It works pretty good. One thing that was strange is that for some reason I was able to accumulate 7 RP points before getting XP, which should actaully be impossible with the default settings in this script.

    So for some reason the delay scipped a few times granting one RP point faster than intended.
    However this was only happening occessionally and didn't influence the system by much. Just something I have to keep in mind when evaluating the exact numbers I'd want to use for the constants.

    The positive thing is: It works perfectly fine even after relogging so we can assume this as being fixed.


    So great of you, if I can ever help you out somehow, even tough I might be not of much use, please by any means reach out for me! I would be glad to give you back this favour! Maybe you need a few testers or so for your own work.





    __________

    Hey there!

    no you have made too much afford to not use it at all.
    I was thinking of getting rid of the delay all togather and just award a lot less XP per chat entry.

    But that would ultimately mean I need to be able to award less than 1 xp per rp point. Or maybe the ability to bundle it, so x (for example 10) amount of RP ponts = 1 XP since it will not delay anything and people spaming short sentences are ultimately being rewarded more than people who thoughtfully formulate their emotes and sentences.

    But as I said, If we can get this system to work somehow I will use it, maybe I will even be able to build upon it but I intend to use it, as you have used up your own time to help me out it would be totally ungratefull to not use it. Like I said it basically does what I hoped it did, it just has a minor bug.


    Awww and what kidn words from you but I fear I won't be able to ever learn basic scripting. I mean I am even completely lost whenever I read something about Linux or any of teh linux nwnx or nwn tools. I don't even know what a docker is and how I have to use these github archives. Totally lost here.

    So I need to be realistic here, I simply don't have the time to learn about the environment behind scripting for months just to be able to work on a small script I'd need. I'm glad if I can find some time beside my college studying and this is why I am extremely gratefull that you even thought about helping me out here.


    I will try your fix you posted and report back what happened! So again thank you sooo much!

    Love,
    Talime/Leaf

    Post edited by Talime on
    badstrref
  • badstrrefbadstrref Member Posts: 124
    edited December 2018
    Well,

    on-enter we have :
    DeleteLocalInt(oPC, "RPP_AWARDED")

    this allows players to cumulate further points, I guess when you allow this, at the same time you could reset the RP points and reward some xp based on stored RP Points on relog? since you reset them to zero. (the logic in CycleChatXP() function, but only for this person

    You may get rewards for only 1 RP Point because the CycleChatXP keeps going, if you want a minimum RP points before awarding xp you could

    inside the CycleChatXP function, for example :
    if(nRPP >= 4) instead of > 0

    I'm building a module, but is nowhere to be playable atm, but thanks for your kind offer.
    and good luck with yours


    Post edited by badstrref on
    Talime
  • TalimeTalime Member Posts: 71
    Ahh now I understand how ths was possible, sure could have been because of allready stored points.
    In that case it is totally fine, I mean they accumulated the points before so of course they should get them at some point.

    Makes total sense.
    Well in that case your script works perectly fine, again thank you sooo much.

    And good luck with your module, will deffinately keep an eye on that once it is playable!
    *waves*

    badstrref
  • badstrrefbadstrref Member Posts: 124
    Once finished I'll provide it to everyone to grab from the the vault... cya!

    TalimedTdfot1
  • TalimeTalime Member Posts: 71
    That is great!
    Bye and see you!

  • badstrrefbadstrref Member Posts: 124
    edited January 2019
    Talime said:

    That is great!
    Bye and see you!

    Hey, posted a WIP, here

    (nevermind, way too early)

    Post edited by badstrref on
    dTdfot1
  • TalimeTalime Member Posts: 71
    Huh? Aww ... *looks around* Where?... hmm..

Sign In or Register to comment.