Changed folder name.
Changed folder name.
This commit is contained in:
82
_module/nss/setxpbank.nss
Normal file
82
_module/nss/setxpbank.nss
Normal file
@@ -0,0 +1,82 @@
|
||||
////////////////////////////////////
|
||||
//Created by Genisys / Guile 5/08/08
|
||||
////////////////////////////////////
|
||||
/*
|
||||
|
||||
XP Bank (Not an original concept)
|
||||
|
||||
This script goes in the Action Taken
|
||||
event of my DM Conversation to store
|
||||
XP in the database for the Player to
|
||||
retrieve with any character, in case
|
||||
they totally messed up their
|
||||
character.
|
||||
(Cost 1% of XP and 500 Gp / Level)
|
||||
|
||||
*/
|
||||
////////////////////////////////////
|
||||
|
||||
void main()
|
||||
{
|
||||
//Declare Major Variables
|
||||
object oPC;
|
||||
oPC = GetPCSpeaker();
|
||||
int cGold = GetGold(oPC);
|
||||
int nLvl = GetHitDice(oPC);
|
||||
int nGold = 0; //nLvl * 500;
|
||||
int cXP = GetXP(oPC);
|
||||
int pXP = (cXP / 100) * 99; //99%
|
||||
|
||||
|
||||
//If the PC has enough gold...
|
||||
if(cXP >1)//cGold>nGold)
|
||||
{
|
||||
//If the PC has at least 100 XP (Required to prevent an error)
|
||||
if(pXP > 99)
|
||||
{
|
||||
//Note this is set for multiplayer, use the script setxp2 for single player!
|
||||
string pCD = GetPCPublicCDKey(oPC, FALSE);
|
||||
|
||||
//Just in case the PC loses thier xp/gold let's write a log entry!
|
||||
WriteTimestampedLogEntry("The following Player Has Used the DM Globe" +
|
||||
"to store XP / " + GetPCPlayerName(oPC) + "/ " + IntToString(pXP));
|
||||
|
||||
int rXP = GetCampaignInt("STORED_XP", GetPCPublicCDKey(oPC), GetModule());
|
||||
|
||||
//////TEMPORARY///////
|
||||
int tXP = cXP + rXP; //rXP + pXP;
|
||||
|
||||
//Store thier XP information first in a nwn database file!
|
||||
SetCampaignInt("STORED_XP", GetPCPublicCDKey(oPC), tXP, GetModule());
|
||||
|
||||
//Take all the player's XP
|
||||
SetXP(oPC, 0);
|
||||
|
||||
//Let's make sure the character is saved!!!!
|
||||
DelayCommand(1.0, ExportSingleCharacter(oPC));
|
||||
|
||||
//Then boot the PC..
|
||||
DelayCommand(5.0, BootPC(oPC));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//If they PC doesn't have enough XP..
|
||||
if(pXP<99)
|
||||
{
|
||||
FloatingTextStringOnCreature("You don't have enough XP!", oPC);
|
||||
}
|
||||
//If the PC doesn't have enough gold..
|
||||
else if(cGold<nGold)
|
||||
{
|
||||
FloatingTextStringOnCreature("You don't have enough gold!", oPC);
|
||||
}
|
||||
//In case of errors..
|
||||
else
|
||||
{
|
||||
FloatingTextStringOnCreature("Please notify a DM's there is an error" +
|
||||
" with the XP Bank.", oPC);
|
||||
}
|
||||
}
|
||||
//Script End
|
||||
}
|
Reference in New Issue
Block a user