PoA_PRC8/_module/nss/setxpbank2.nss
Jaysyn904 8d97886c3f Changed folder name.
Changed folder name.
2022-10-07 21:08:37 -04:00

46 lines
1.1 KiB
Plaintext

//Created by Guile 5/5/08 (This XP Bank script sets an intergal on the module
//which allows PCs to store xp/gold on the module and retrieve with other
//characters (as long as they don't change cd keys!)
void main()
{
object oPC;
oPC = GetPCSpeaker();
int cGold = GetGold(oPC);
int nLvl = GetHitDice(oPC);
int nGold = nLvl * 50;
int cXP = GetXP(oPC);
int pXP = (cXP / 100) * 95; //95%
if(cGold>nGold)
{
if(pXP > 0)
{
//Note this is set for single player, for testing purposes.
//Set to FALSE for multiplayer!
string pCD = GetPCPublicCDKey(oPC, TRUE);
//just in case the PC loses thier XP let's write a log entry!
PrintString("The following Player Has Used the DM Globe to store XP - /");
PrintString(GetPCPlayerName(oPC));
PrintString("/ ");
PrintInteger(pXP);
int rXP = GetCampaignInt("STORED_XP", pCD, GetModule());
//Store thier XP information first in a nwn database file!
SetCampaignInt("STORED_XP", pCD, rXP, GetModule());
//Take All Gold & XP!
SetXP(oPC, 0);
//Then boot the PC..
DelayCommand(1.0, BootPC(oPC));
}
}
else
{
FloatingTextStringOnCreature("You don't have enough gold!", oPC);
}
}