Author Topic: PnP Coins for NWN1  (Read 993 times)

Legacy_Mad.Hatter

  • Full Member
  • ***
  • Posts: 156
  • Karma: +0/-0
PnP Coins for NWN1
« Reply #15 on: May 25, 2011, 12:05:35 am »


               Redownloaded CEP and corrected the mixed erf issue. It should work correctly this time. Let me know if you have any issues.
               
               

               
            

Legacy_Artistmonk

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
PnP Coins for NWN1
« Reply #16 on: May 25, 2011, 04:53:38 am »


               Awesome, would be nice to have this with encumberance system.
               
               

               
            

Legacy_Mad.Hatter

  • Full Member
  • ***
  • Posts: 156
  • Karma: +0/-0
PnP Coins for NWN1
« Reply #17 on: May 25, 2011, 05:03:27 am »


               If you put coins_acqu and coins_unacqu in the appropriate module events (or merge them with your own) then every time you pick up 50 coins you get a 1lb item created on you as per the 3rd Edition PHB; when you drop them, these items are removed. Check out the demonstration module, I have encumbrance enabled.
               
               

               
            

Legacy_Artistmonk

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
PnP Coins for NWN1
« Reply #18 on: May 25, 2011, 04:37:08 pm »


               Thank you for response and foresight. Excellent.
               
               

               
            

Legacy_Greyfort

  • Sr. Member
  • ****
  • Posts: 442
  • Karma: +0/-0
PnP Coins for NWN1
« Reply #19 on: May 26, 2011, 01:03:08 am »


               I made a simple reward system for giving players coins i will post link to vault when testing done
               
               

               
            

Legacy_Greyfort

  • Sr. Member
  • ****
  • Posts: 442
  • Karma: +0/-0
PnP Coins for NWN1
« Reply #20 on: May 26, 2011, 02:49:49 am »


               Here is the scoop on the trouble shoot....

1) coin models missing for what you have set in tool set. iit_*_#
pp #46 missing replaced with #51, gp #58 missing replaced with #05,
ep #51 was replaced with #32,sp #33 missing replaced with #16,
cp #58.  That will fix the missing model issue and they look good in your inventory.

2)Issue making change, picked up some extra coin from loot generator[see below] talked to merchant said i had 93973gp closed shop lost all coin over 50k stack, resulting in net loss of 41 gp.  There seems to be a issue in making change.  I looked at the original that used no haks and although theirs’ does not work like pp,ep, scale it makes change right and has no issue with amount of coins, it will even spill out of invy onto floor sue to 10stack size on platinum.  Probably just minor math error.

3) if weight at 5126 thats 1 50k stack of each coin you cant pick up any more coins server freezes
I ask because with nwnx_funcs or linux_funcs PC chars can have abilities that allow for weight exceeding that I think the encumbrance 2da needs to be flushed out I think I have one from shadow. I placed it in my override and still got error

Well thats all I found, still if you keep the coin under 500k and stacks under 50k no issues.
although with the nwnx_funcs it makes a Player quite strong and with gear at max or custom made with the asbury forge a Items value is sometimes in the 10s of millions and the no hack version converts the millions over fine and with the base item 2da over ride I can set those stacks to 50k max

[I can send you module/erf, I have been working on for custom loot if you want to include with your coin system to help others get started at least]
               
               

               
            

Legacy_Mad.Hatter

  • Full Member
  • ***
  • Posts: 156
  • Karma: +0/-0
PnP Coins for NWN1
« Reply #21 on: May 26, 2011, 08:15:48 am »


               Thanks for the testing and reply:

(1) The five models you mention are the original CRAP/CEP ones. I included the other icons to give builders options (especially if adding multiple types of currency to their modules). I suppose I could go change the assigned models.

(2) I don't follow. Are you saying that only the CEP version has issues making change and then only if the change being created is in excess of 50,000 coins? What do you mean by "theirs’ does not work like pp,ep" in reference to the NON-CEP version? Could you clarify for me? I'm gettin' old!

(3) I just barely tested this. You seem to be right. I'm not sure exactly what causes this freeze. I tried adding additional weight generation conditionals but it didn't seem to work. It seems that caching the coins_inc and the added conditionals did delay the freeze by a bit. I'll keep digging around.

It may just be that my system as written isn't near capable of handling modules where many hundreds of thousands of coins are processed by an individual player.

I'd like to see the custom loot script. I've been looking at CRAP/Accerak's and would like to see what you've conjured up.
               
               

               
            

Legacy_Mad.Hatter

  • Full Member
  • ***
  • Posts: 156
  • Karma: +0/-0
PnP Coins for NWN1
« Reply #22 on: May 26, 2011, 10:06:41 am »


               So, I have figured out how to get rid of the locking up due to bajillions of coins. There were just too many calculations going on. I now just need to figure out how to effectively recalculate weight. I'll figure it out, promise.

*Edit* As a side note, the system still works perfectly well for PCs who will not be carrying around more than 250,000 coins at a time (besides this purported change issue that I haven't been able to reproduce... not NWN gold, custom coinage). For the vast majority of RP modules this will never be an issue.
               
               

               


                     Modifié par Mad.Hatter, 26 mai 2011 - 09:09 .
                     
                  


            

Legacy_Mad.Hatter

  • Full Member
  • ***
  • Posts: 156
  • Karma: +0/-0
PnP Coins for NWN1
« Reply #23 on: May 26, 2011, 08:18:59 pm »


               I found the change creation problem you were talking about, Greyfort. The problem is that CreateItemOnObject wont create multiple stacks of items (as that would be Object*s* rather than Object). I solved it simply by adding:
else if(iCoin* >= 50000)             
        { CreateItemOnObject("coin_"+sType+"5", oTarget, iCoin*);
          nCoinTotal = nCoinTotal - 50000;
          iCoin* = iCoin* - 50000;
        }

Now I'll look into the weight locking issue. Thanks for your testing thusfar.
               
               

               
            

Legacy_Mad.Hatter

  • Full Member
  • ***
  • Posts: 156
  • Karma: +0/-0
PnP Coins for NWN1
« Reply #24 on: May 27, 2011, 05:19:08 am »


               v1.3 is in the works (yes, I do quick updates. Thanks me for being a teacher and this being summer...).

1.3 simplifies the weight code by a ton. It is faster at low coin counts and can now handle tons of coins without slowing. (I tested 1,880,000 NWN gold worth today with only 1 stack of platinum) I will also clean up the erfs and demonstration mods (somehow despite my double-triple checking the wrong weight item got in there).

Finally, if I have time I will start to work on the loot system so that this can be used out of the box in any module using default loot systems.

(In other words, I have fixed both the coding issues that Greyfort brought to our attention.)
               
               

               


                     Modifié par Mad.Hatter, 27 mai 2011 - 04:20 .
                     
                  


            

Legacy_Artistmonk

  • Jr. Member
  • **
  • Posts: 54
  • Karma: +0/-0
PnP Coins for NWN1
« Reply #25 on: May 27, 2011, 06:19:21 pm »


               Waiting eagerly....
               
               

               
            

Legacy_Mad.Hatter

  • Full Member
  • ***
  • Posts: 156
  • Karma: +0/-0
PnP Coins for NWN1
« Reply #26 on: May 27, 2011, 07:12:32 pm »


               Greyfort sent me an e-mail where he stated that he didn't crash until 50,000 pounds of coins had been created on the PC. My code allows for creating more than 50,000 pounds, so I assume this is an issue with encumbrance.2da. I will likely be leaving it as is because I can't think of many people who want a legitimate encumbrance system who plan on carrying 50,000 pounds of coin around. Anyone who is knowledgeable to hack the game up enough to carry that much weight can alter that themselves.

Part of the weight code simplification is to make changing the weight of coins a single editable entry. Right now it is 50 per pound, which means the system won't choke until a PC is carrying 50*50,000 = 2,500,000 coins. You could adjust the weight to anything you like and allow for  millions of coins possible on a PC (just raising the limit to the NWN2 version's 1,000 per pound would (theoretically) allow 50,000,000 coins on a PC without slowing).
               
               

               
            

Legacy_Greyfort

  • Sr. Member
  • ****
  • Posts: 442
  • Karma: +0/-0
PnP Coins for NWN1
« Reply #27 on: May 28, 2011, 10:51:41 pm »


               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
               
               

               
            

Legacy_Mad.Hatter

  • Full Member
  • ***
  • Posts: 156
  • Karma: +0/-0
PnP Coins for NWN1
« Reply #28 on: May 28, 2011, 11:12:12 pm »


               Greyfort, are you using the updated version 1.3? I fixed the change issue. I just tested your exact situation in the test module and got the correct change back.
               
               

               
            

Legacy_Greyfort

  • Sr. Member
  • ****
  • Posts: 442
  • Karma: +0/-0
PnP Coins for NWN1
« Reply #29 on: May 28, 2011, 11:31:01 pm »


               I belive I have the right version from the link in the forums, or the one from the Pm.  

The money changer script is a script that changes copper to maxx pp,then gp,then ep,then sp and so on with each coin so players dont have to carry a 50k stack of copper.

I will look again to see if I have correct no cep version.