So alternatively to this whole system mentioned above, something Ghost said gave me an idea. I looked at the scripts for our persistant gold bank, and our releveler. I am wondering if I can use them modified to just make new exp bank scripts? As an example, some of the gold scripts are:
#include "aps_include"
// Used to deposit gold in the bank. oPC is the character depositing gold
// and iGold is the amount to deposit
void DepositGold(object oPC, int iGold);
// Used to withdraw gold from the bank. oPC is the character withdrawing gold
// and iGold is the amount to withdraw
void WithdrawGold(object oPC, int iGold);
// Returns the amount of gold the player has in the bank
int GetBankGold(object oPC);
void DepositGold(object oPC, int iGold)
{
int iMaxGold = 200000000; //Maximum gold that can be stored in the bank
int iBankGold;
string sPlayer = SQLEncodeSpecialChars(GetPCPlayerName(oPC));
string sSQL = "SELECT gold FROM bankvault WHERE player='" + sPlayer + "'";
SQLExecDirect(sSQL);
if (SQLFetch() == SQL_SUCCESS)
{
iBankGold = StringToInt(SQLGetData(1));
if ((iBankGold + iGold) > iMaxGold)
{
iGold = iMaxGold - iBankGold;
SendMessageToPC(oPC, "The maximum amount of gold you can store is "
+ IntToString(iMaxGold));
}
sSQL = "UPDATE bankvault SET gold=" + IntToString(iBankGold + iGold)
+ " WHERE player='" + sPlayer + "'";
SQLExecDirect(sSQL);
TakeGoldFromCreature(iGold, oPC, TRUE);
}
else
{
if (iGold > iMaxGold)
{
iGold = iMaxGold;
SendMessageToPC(oPC, "The maximum amount of gold you can store is "
+ IntToString(iMaxGold));
}
sSQL = "INSERT INTO bankvault (player,gold) VALUES ('" + sPlayer + "',"
+ IntToString(iGold) + ")";
SQLExecDirect(sSQL);
TakeGoldFromCreature(iGold, oPC, TRUE);
}
}
int GetBankGold(object oPC)
{
int iBankGold = 0;
string sPlayer = SQLEncodeSpecialChars(GetPCPlayerName(oPC));
string sSQL = "SELECT gold FROM bankvault WHERE player='" + sPlayer + "'";
SQLExecDirect(sSQL);
if (SQLFetch() == SQL_SUCCESS)
{
iBankGold = StringToInt(SQLGetData(1));
}
else
{
sSQL = "INSERT INTO bankvault (player,gold) VALUES ('" + sPlayer + "',0)";
SQLExecDirect(sSQL);
}
return iBankGold;
}
void WithdrawGold(object oPC, int iGold)
{
int iBankGold = GetBankGold(oPC);
string sPlayer = SQLEncodeSpecialChars(GetPCPlayerName(oPC));
string sSQL = "UPDATE bankvault SET gold=" + IntToString(iBankGold - iGold)
+ " WHERE player='" + sPlayer + "'";
SQLExecDirect(sSQL);
GiveGoldToCreature(oPC, iGold);
}
and than an example of a deposit amount script:
#include "jk_inc_bank"
void main()
{
object oPC = GetPCSpeaker();
int iGold = 10000;
DepositGold(oPC, iGold);
ExportSingleCharacter(oPC);
}
And also in case any sort of interger information, and translation (gp to xp) might be needed here is an example of one of the releveler scripts:
#include "conf_module"
void main( )
{
object oPC = GetPCSpeaker( );
int nXP = GetXP( oPC );
int nXPAfter = FloatToInt(IntToFloat(nXP) * IntToFloat(RELEVEL_XP_PENALTY) / 100.00);
SetXP( oPC, 10000 );
SetXP( oPC, nXPAfter );
}
Modifié par Lazarus Magni, 24 juin 2011 - 08:02 .