I created a money changer script, the last issue i seem to be dealing with its the remainder after conversion example: 12 gp into 1 plat wiith 2 gold left over it give pp and 4gp thats 1 bug.
Here is script it stands alone but you do need the pnp no cep mod from this forum, and you need to add a line into the conversation of merchant money changer to trouble shoot it in the mod.
//////////////////////$$$$$$$$$$$$$$$$$$$$$$$$$$$//////////////////////
//
// Greyfort $$$ MONEY CHANGER $$$
//
//////////////////////$$$$$$$$$$$$$$$$$$$$$$$$$$$//////////////////////
// name of your coins
const string sTypeU ="coin";
//-----------------------------------------------
// corrects xtra coin after stack=0
void CheckCoinOverFlow(object oPC=OBJECT_SELF);
void CheckCoinOverFlow(object oPC=OBJECT_SELF)
{
// check for items to remove
object oCoinR =GetFirstItemInInventory(oPC);
while (GetIsObjectValid(oCoinR)==TRUE)
{
if( GetLocalString(oCoinR,"Dstry")=="TRUE")
{
DestroyObject(oCoinR);
}
oCoinR =GetNextItemInInventory(oPC);
}
}
///////////////////[end of function]////////////////////////
//-----------------------------------------------
// changes copper to pp,gp,ep,sp////
void Change_copper(object oPC =OBJECT_SELF);
void Change_copper(object oPC =OBJECT_SELF)
{
string sType=sTypeU;
int ncpStk,ncp2pp1,ncp2pp2,ncp2gp1,ncp2gp2,ncp2ep1,ncp2ep2,ncp2sp1,ncp2sp2;
object oCoin =GetFirstItemInInventory(oPC);
while (GetIsObjectValid(oCoin))
{
//::///////////////////////
//int ncpStk,ncp2pp1,ncp2pp2,ncp2gp1,ncp2gp2,ncp2ep1,ncp2ep2,ncp2sp1,ncp2sp2;
// !! CHECK COPPERS !!
if (GetStringRight(GetTag(oCoin),5)=="coin1" )
{
ncpStk = GetItemStackSize(oCoin);
if( ncpStk >9)
{
// debug
FloatingTextStringOnCreature("Start copper stack="+IntToString(ncpStk)+"",oPC,FALSE);
// give max platinum
if( ncpStk >=1000)
{
ncp2pp1 = ncpStk / 1000;
ncp2pp2 = ncpStk - ( ncp2pp1 * 1000);
ncpStk = ncp2pp2;
SetItemStackSize(oCoin,ncpStk);
CreateItemOnObject("coin_"+sType+"5", oPC, ncp2pp1);
}
// give max gold
if( ncpStk >=100)
{
ncp2gp1 = ncpStk / 100;
ncp2gp2 = ncpStk - ( ncp2gp1 * 100);
ncpStk = ncp2gp2;
SetItemStackSize(oCoin,ncpStk);
CreateItemOnObject("coin_"+sType+"4", oPC, ncp2gp1);
}
// give max electrum
if( ncpStk >=50)
{
ncp2ep1 = ncpStk / 50;
ncp2ep2 = ncpStk - ( ncp2ep1 * 50);
ncpStk = ncp2ep2;
SetItemStackSize(oCoin,ncpStk);
CreateItemOnObject("coin_"+sType+"3", oPC, ncp2ep1);
}
// give max silver
if( ncpStk >=10)
{
ncp2sp1 = ncpStk / 10;
ncp2sp2 = ncpStk - ( ncp2sp1 * 10);
ncpStk = ncp2sp2;
if ( ncpStk >=1 ){
SetItemStackSize(oCoin,ncpStk);}
if ( ncpStk <=0 ){
SetLocalString(oCoin,"Dstry","TRUE");}
CheckCoinOverFlow( oPC);
CreateItemOnObject("coin_"+sType+"2", oPC, ncp2sp1);
}
// debug
FloatingTextStringOnCreature("Finish copper stack="+IntToString(ncpStk)+"",oPC,FALSE);
}
}
// look for more coins
oCoin =GetNextItemInInventory(oPC);
}
}
///////////////////[end of function]////////////////////////
//-----------------------------------------------
// changes silver to pp,gp,ep////
void Change_silver(object oPC =OBJECT_SELF);
void Change_silver(object oPC =OBJECT_SELF)
{
string sType=sTypeU;
int nspStk,nsp2pp1,nsp2pp2,nsp2gp1,nsp2gp2,nsp2ep1,nsp2ep2;
object oCoin =GetFirstItemInInventory(oPC);
while (GetIsObjectValid(oCoin))
{
//::///////////////////////
//int nspStk,nsp2pp1,nsp2pp2,nsp2gp1,nsp2gp2,nsp2ep1,nsp2ep2;
// !! CHECK SILVER !!
if (GetStringRight(GetTag(oCoin),5)=="coin2" )
{
nspStk = GetItemStackSize(oCoin);
if( nspStk >9)
{
// debug
FloatingTextStringOnCreature("Start silver stack="+IntToString(nspStk)+"",oPC,FALSE);
// give max platinum
if( nspStk >=1000)
{
nsp2pp1 = nspStk / 100;
nsp2pp2 = nspStk - ( nsp2pp1 * 100);
nspStk = nsp2pp1;
SetItemStackSize(oCoin,nspStk);
CreateItemOnObject("coin_"+sType+"5", oPC, nsp2pp1);
}
// give max gold
if( nspStk >=100)
{
nsp2gp1 = nspStk / 10;
nsp2gp2 = nspStk - ( nsp2gp1 * 10);
nspStk = nsp2gp2;
SetItemStackSize(oCoin,nspStk);
CreateItemOnObject("coin_"+sType+"4", oPC, nsp2gp1);
}
// give max electrum
if( nspStk >=10)
{
nsp2ep1 = nspStk / 10;
nsp2ep2 = nspStk - ( nsp2ep1 * 10);
nspStk = nsp2ep2;
if ( nspStk >=1 ){
SetItemStackSize(oCoin,nspStk);}
if ( nspStk <=0 ){
SetLocalString(oCoin,"Dstry","TRUE");}
CheckCoinOverFlow( oPC);
CreateItemOnObject("coin_"+sType+"3", oPC, nsp2ep1);
}
// debug
FloatingTextStringOnCreature("Finish silver stack="+IntToString(nspStk)+"",oPC,FALSE);
}
}
// look for more coins
oCoin =GetNextItemInInventory(oPC);
}
}
///////////////////[end of function]////////////////////////
//-----------------------------------------------
// changes electrum to pp,gp////
void Change_electrum(object oPC =OBJECT_SELF);
void Change_electrum(object oPC =OBJECT_SELF)
{
string sType=sTypeU;
int nepStk,nep2pp1,nep2pp2,nep2gp1,nep2gp2;
object oCoin =GetFirstItemInInventory(oPC);
while (GetIsObjectValid(oCoin))
{
//::///////////////////////
//int nepStk,nep2pp1,nep2pp2,nep2gp1,nep2gp2;
// !! CHECK ELECTRUM !!
if (GetStringRight(GetTag(oCoin),5)=="coin3" )
{
nepStk = GetItemStackSize(oCoin);
if( nepStk >1)
{
// debug
FloatingTextStringOnCreature("Start electrum stack="+IntToString(nepStk)+"",oPC,FALSE);
// give max platinum
if( nepStk >=1000)
{
nep2pp1 = nepStk / 20;
nep2pp2 = nepStk - ( nep2pp1 * 20);
nepStk = nep2pp2;
SetItemStackSize(oCoin,nepStk);
CreateItemOnObject("coin_"+sType+"5", oPC, nep2pp1);
}
// give max gold
if( nepStk >=2)
{
nep2gp1 = nepStk / 2;
nep2gp2 = nepStk - ( nep2gp1 * 2);
nepStk = nep2gp2;
if ( nepStk >=1 ){
SetItemStackSize(oCoin,nepStk);}
if ( nepStk <=0 ){
SetLocalString(oCoin,"Dstry","TRUE");}
CheckCoinOverFlow( oPC);
CreateItemOnObject("coin_"+sType+"4", oPC, nep2gp1);
}
// debug
FloatingTextStringOnCreature("Finish electrum stack="+IntToString(nepStk)+"",oPC,FALSE);
}
}
// look for more coins
oCoin =GetNextItemInInventory(oPC);
}
}
///////////////////[end of function]////////////////////////
//-----------------------------------------------
// changes gold to pp////
void Change_gold(object oPC =OBJECT_SELF);
void Change_gold(object oPC =OBJECT_SELF)
{
string sType=sTypeU;
int ngpStk,ngp2pp1,ngp2pp2;
object oCoin =GetFirstItemInInventory(oPC);
while (GetIsObjectValid(oCoin))
{
//::///////////////////////
//int ngpStk,ngp2pp1,ngp2pp2;
// !! CHECK GOLD !!
if (GetStringRight(GetTag(oCoin),5)=="coin4" )
{
ngpStk = GetItemStackSize(oCoin);
if( ngpStk >9)
{
// debug
FloatingTextStringOnCreature("Start gold stack="+IntToString(ngpStk)+"",oPC,FALSE);
// give max platinum
if( ngpStk >=10)
{
ngp2pp1 = ngpStk / 10;
ngp2pp2 = ngpStk - ( ngp2pp1 * 10);
ngpStk = ngp2pp2;
if ( ngpStk >=1 ){
SetItemStackSize(oCoin,ngpStk);}
if ( ngpStk <=0 ){
SetLocalString(oCoin,"Dstry","TRUE");}
CheckCoinOverFlow( oPC);
CreateItemOnObject("coin_"+sType+"5", oPC, ngp2pp1);
}
// debug
FloatingTextStringOnCreature("Finish gold stack="+IntToString(ngpStk)+"",oPC,FALSE);
}
}
// look for more coins
oCoin =GetNextItemInInventory(oPC);
}
}
///////////////////[end of function]////////////////////////
//-----------------------------------------------
// changes gold to pp////
void Change_platinum(object oPC =OBJECT_SELF);
void Change_platinum(object oPC =OBJECT_SELF)
{
string sType=sTypeU;
int nppStk,npp2mn1,npp2mn2;
object oCoin =GetFirstItemInInventory(oPC);
while (GetIsObjectValid(oCoin))
{
//::///////////////////////
//int nppStk,npp2mn1,npp2mn2;
// !! CHECK PLATINUM !!
if (GetStringRight(GetTag(oCoin),5)=="coin5" )
{
nppStk = GetItemStackSize(oCoin);
if( nppStk >999999)
{
// debug
FloatingTextStringOnCreature("Start platinum stack="+IntToString(nppStk)+"",oPC,FALSE);
// give max platinum
if( nppStk >=1000000)
{
npp2mn1 = nppStk / 1000000;
npp2mn2 = nppStk - ( npp2mn1 * 1000000);
nppStk = npp2mn2;
if ( nppStk >=1 ){
SetItemStackSize(oCoin,nppStk);}
if ( nppStk <=0 ){
SetLocalString(oCoin,"Dstry","TRUE");}
CheckCoinOverFlow( oPC);
CreateItemOnObject("mnote", oPC, npp2mn1);
}
// debug
FloatingTextStringOnCreature("Finish platinum stack="+IntToString(nppStk)+"",oPC,FALSE);
}
}
// look for more coins
oCoin =GetNextItemInInventory(oPC);
}
}
///////////////////[end of function]////////////////////////
//////////[ MAIN ]////////
void main()
{
object oPC =GetPCSpeaker();
// set vars
int cpdone,spdone,epdone,gpdone=0;
// check coins
if(cpdone==0 ){ Change_copper(oPC); cpdone=1; }
if(cpdone==1 ){ Change_silver(oPC); spdone=1; }
if(spdone==1 ){ Change_electrum(oPC); epdone=1; }
if(epdone==1 ){ Change_gold(oPC); gpdone=1; }
if(gpdone==1 ){ Change_platinum(oPC); }
//reset vars
cpdone=0;spdone=0;epdone=0;gpdone=0;
///////[ END OF SCRIPT ]///////
}
On another note: I made a work around for the million dollar players...a M-Note no weight worth a milion gp, only thing its lacking is a model files in hak so it looks like a bag of coins when. I also added a creature on death script, and a object open/death script both generate loot droped. I will post mod on valt or give newest version to mad.hatter if he wants to add it to his vault link.
If y'all could look at script and maybe tell me why its not giving me correct change I be much thankful