Traps and xp
From NWNWiki
[edit] What it Does
After a player character has disarmed a trap (s)he will be rewarded with some XP. Amount of XP depends on level of Char and level of trap. Put this script into the "OnDisarm"-slot of the trap
[edit] The Script
// Traps & XP
//
// Rewards player with XP if trap was disarmed
//
// by Incanus - big THX to Benn
// enjoy or destroy
//
// www.versuchungdermacht.de
object oPC; //player who disarmed trap
int nXP; //XP player gets
int nDC; //DC
int nlevel;
void main()
{
//Get PC who disarmed the trap
oPC = GetLastDisarmed();
//Get level of PC
nlevel = GetHitDice(oPC);
//Get DC for disarming trap (needed for calculation of XP)
nDC = GetTrapDisarmDC(OBJECT_SELF);
//Check, if trap was set by another PC. Otherwise give XP
if (GetTrapCreator(OBJECT_SELF)==OBJECT_INVALID)
{
nXP = (nDC-(15+nlevel))*2*nlevel;
GiveXPToCreature(oPC,nXP);
}
}
This is just a basic script, but it works fine. You can adjust the amount of XP by changing the formula:
(nDC-(15+nlevel))*2*nlevel
