Roleplaying Experience

I would like to give players experience when roleplaying. Does anyone have coding for this, or know where to begin to make a onplayerchat type thing? ANy help would be great!

It depends on exactly what you want to do. Experience is given using GiveXPToCreature. The basics of OnPlayerChat are discussed here.


We implemented this on a PW I worked on. If this is a multiplayer setting where you aren’t monitoring the players here are a few edge cases you may want to check for.

  • Word Count / Speed of Typing (How many characters are they typing and how fast are they talking)
  • What volume are they speaking in (Whisper / Tell / Shout)
  • Is anyone around that can hear them?
  • Are they talking OOCly or IC.

I can post snippets if your interested, although not sure how proficient in scripting you are.

1 Like

That would be great. If I had a base then could edit it. Want it in say, within the same view to give xp every so often when two parties are talking

Please do if you can find them.

Can this really work? I’ve seen enough of online games and people in general to assert that any kind of automated system such as this will be exploited for XP gain.

If you want to encourage roleplaying then I really think what you want is to encourage player interaction in general. The best way to do this is to fix one fundamental flaw of D&D; players receive less XP from the same monster if they are in a party because the XP is shared between them.
Reverse this; increase the XP received from the same monster if partied and you’ll see a lot more general player interaction which on a roleplaying server will mean more roleplaying.

It’s entirely possible that I am being way too cynical, but unfortunately it also remains a possibility that I am being perfectly cynical.


You aren’t wrong… But I still think servers should incentivize the focal points of what you want a server to be about.

If you want to encourage players to roleplay, over say farming the sewers filled with rats, I don’t see any issue with offering xp over time to reward that behavior. I mean… Roleplay is still developing your character right…?

Most PW’s that employ this generally offer RP-XP in a different pool from other XP rewards - or maybe they incentivize it with a different kind of reward like say a token that lets you buy “Roleplay type stuff” (aesthetics only) like a wand that spawns furniture or a funny toy that lets you do something.

Of course there may be someone out there that tries to game your system but I think there is some merit to rewarding that kind of behavior loop in your game. I’ve seen PW’s that gave XP exclusively only from RP / DM Events… whereas “Loot” and money came from dungeons. It really forced players into both roles and worked really nicely IMO. (Although others may disagree)

Obviously if your player base hates roleplaying, this system is counter-intuitive, but for RP heavy builds / player concepts, it’s nice to see xp flash across your screen when your doing what your character was meant to do. We don’t all play combat focused power builds… and it’s nice to play say a merchant or politician and still see progression on your character.

1 Like

You make some good points and one can certainly hope a “local” playerbase consisting of roleplayers who had to apply for access or download mods to even play are more devoted to the spirit of the server in question than your average MMO gamer.

My only concern with XP over time is if it is literally over time and people are not kicked for being AFK. Basically it will make a server full(er) and unfairly bump it on the server list, forcing other servers to do the same to compete for players. It’s already a reality in another old game I’ve played that has more servers than players. I’ve seen it and it’s ugly.

I wish OP success with their project.

I’ve played on a PW where characters received xp periodically for interactive chat. I would sometimes run into players who talked to exploit it, but they were the minority. As for group xp, I agree, But I found an easy workaround that only required me to splice some code into the standard on death. I basically took the nw_c2_default7 I spliced that into and pasted it into the X2 on death event. Just turn your module xp scale to 0. Unfortunately, I havent found any players to help test if it works with multiplayer but it worked solo so I dont see why it wouldnt work with a group. Basically, it finds who killed the monster, checks if they are in a party, finds the highest level character in that party, divides the CR by that character’s HD and multiplies that by 10 and awards it to the party. A solo character earns the same xp as a full party.

Default OnDeath event handler for NPCs.

Adjusts killer’s alignment if appropriate and
alerts allies to our death.
plus, BOBALOO!!!
//:: Copyright © 2002 Floodgate Entertainment
//:: Created By: Naomi Novik
//:: Created On: 12/22/2002
//:: Modified By: Deva Winblood
//:: Modified On: April 1st, 2008
//:: Added Support for Dying Wile Mounted

#include “x0_i0_spawncond”
#include “x3_inc_horse”

void main()
int nClass = GetLevelByClass(CLASS_TYPE_COMMONER);
int nAlign = GetAlignmentGoodEvil(OBJECT_SELF);
object oKiller = GetLastKiller();
float fCR = GetChallengeRating(OBJECT_SELF); //gets killed creature’s CR (custom line)
if (GetIsPC(oKiller) == TRUE) //checks if the killer was a PC

       SetLocalFloatOnAll(oKiller, "TA_XP", fCR);
       ExecuteScript("ta_xp", oKiller);

if (GetLocalInt(GetModule(),"X3_ENABLE_MOUNT_DB")&&GetIsObjectValid(GetMaster(OBJECT_SELF))) SetLocalInt(GetMaster(OBJECT_SELF),"bX3_STORE_MOUNT_INFO",TRUE);

// If we're a good/neutral commoner,
// adjust the killer's alignment evil
if(nClass > 0 && (nAlign == ALIGNMENT_GOOD || nAlign == ALIGNMENT_NEUTRAL))
    AdjustAlignment(oKiller, ALIGNMENT_EVIL, 5);

// Call to allies to let them know we're dead

//Shout Attack my target, only works with the On Spawn In setup

// NOTE: the OnDeath user-defined event does not
// trigger reliably and should probably be removed
     SignalEvent(OBJECT_SELF, EventUserDefined(1007));


Oh, and then you need this additional script that doesnt need to be put in any event or anything

//TA_XP custom xp script
//executed from default9 on death event of creature
//script executed on PC who killed
//uses float TA_XP to relay the CR of creature killed
#include “nw_i0_tool”
void main()
float fCR = GetLocalFloat(OBJECT_SELF, “TA_XP”);

object oAlpha = GetFactionStrongestMember(OBJECT_SELF, TRUE);
if (oAlpha != OBJECT_INVALID)
int nAlphaHD = GetHitDice(oAlpha);
float fAlphaHD = IntToFloat(nAlphaHD);
float fXP1 = ((fCR / fAlphaHD) * 20);
int nXP1 = FloatToInt(fXP1);
RewardPartyXP(nXP1, oAlpha, TRUE);
int nSoloHD = GetHitDice(OBJECT_SELF);
float fSoloHD = IntToFloat(nSoloHD);
float fXP2 = ((fCR / fSoloHD) * 20);
int nXP2 = FloatToInt(fXP2);
GiveXPToCreature(OBJECT_SELF, nXP2);