Author Topic: Inventories and Magic Bags  (Read 913 times)

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Inventories and Magic Bags
« Reply #15 on: September 11, 2012, 06:11:12 pm »


               One futher clarification.

Again this is not problem with the way how it works by default. I am working on PW which is missing any persistent storage and so we encourage players to make mule characters. The ammount of items in there often exceeds 500. These players often relogging if they cant log in twice at once. There are no issues with that, our OnAcquire contains only few adjustions from the default.

This is fine, the problems arises when the OnAcquire script is poorly written and ineffective. Tagbased scripting might be cause. I certainly dont think that its okay to try to fire script for each items tag, when only total minority of items has such behavior scripted actually. Now I dont talking about the way how ExecuteScript works, its probably fast and probably handles the case of non-existant script, yet I wouldnt call it if its not really necessary.

The local variable to deal with items only once isnt good idea. You have to also remove this variable when the item is dropped, also what if you need to apply some sort of effect on character, something that must be repeated after relogging?

Anyway, my advice is to make the OnAcquire script as efficient as possible, because you cannot prevent the OnAcquire script to be fired.
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Inventories and Magic Bags
« Reply #16 on: September 11, 2012, 07:02:53 pm »


               Are you suggesting that no tagbased scripting be included in the onAcquire event?
               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Inventories and Magic Bags
« Reply #17 on: September 11, 2012, 08:05:36 pm »


               Yes, I tried to suggest this. After more closer look it looks tagbased scripting is ON by default so nvm. Anyway Im not claiming that tagbased scripting is wrong and it makes this. Im claiming that I dont have this ON (and I have very small and effective OnAcquire script) and there arent any lag issues even when char with 500+ items logs in.

Apparently just the fact that it fires OnAcquire script 500 times at once it probably the most extense.
               
               

               


                     Modifié par ShaDoOoW, 11 septembre 2012 - 07:08 .
                     
                  


            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Inventories and Magic Bags
« Reply #18 on: September 11, 2012, 10:00:33 pm »


               OK. I understand your perspective.

Since I do have a bit more than the tagbased hook in OnAcquire, I'll look into some optimizations.

In my experience once CNR is implemented you tend to get characters with huge inventories. I am leaning towards CNR now, and want to be ready for it.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Inventories and Magic Bags
« Reply #19 on: September 13, 2012, 10:39:26 pm »


               If you do have a lot in your OnAquire script,  You could mark the items that do not have an OnAquire event so that the event can skip them.   Assuming that your OnAquire Event is a If.. else If.. statement you could do it something like this.  


If ( GetLocalInt(oItem, "NO_AQUIRE_EVENT") )
{
  if ( sTag == "tag')  DO Stuf

 else if ( sTag == "tag')  DO Stuf
 ....

else SetLocalInt(oItem, "NO_AQUIRE_EVENT",1)

}

If done right "NO_AQUIRE_EVENT" local will only get set if none of the tags matched. Allowing the script to just skip over all the checks after the first time Aquired.

Where  the above will run into problems is when you add items to your OnAquire Event.  But it is not that hard to overcome.   You basicly give the script a version number.   The first time it is only checks to see if the local is set.  To make sure that a new revision of the scrip(with Tag checks added) dosen's skip items PC already possess, just increase the local you are checking on the item.   Agreed that the first time players log in again it will check every item in there inventory.   But it will only be the first time they log in after a revision of the script.  

So your second run of the script would end up looking like this.

If ( GetLocalInt(oItem, "NO_AQUIRE_EVENT")== 2 )
{
  if ( sTag == "tag')  DO Stuf

 else if ( sTag == "tag')  DO Stuf
 ....

else SetLocalInt(oItem, "NO_AQUIRE_EVENT",2)

}

and of cource the third revision just increase it to 3.  Ect.  

Hope that is helpfull
L8
               
               

               
            

Legacy_Validus II

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
Inventories and Magic Bags
« Reply #20 on: September 30, 2012, 03:17:07 pm »


               Magic bags, player file size, crafting included.  Ok lets see here.

Managing magic bags can be a hugeissue IMHO.  Screen after screen of bags with no labels and no way of being SURE what is in them until you actually open them.  What a pain.  A couple of fixes: create new bags/boxes with different looks and labels to help you visually sort them out.  A box specifically for gems makes tons of sense, it would not even have to be magic (gems have no weight).  Boxes for scrolls and potions make sense too.

Next, reduce the number of bags/boxes a PC can have on his person.  To me one full screen should be enough, I would think this could be done by scripting using integers to restrict number of containers on a player?  

We all know players log in and out with a lot of stuff they either will not use, do not have time to get back to town to sell or craft with or are simply being packrats, keeping that old sword for 'sentimental' reasons.  Pfah!  Looks like players need merchants who come to them.  So give them some.  

Create an item to use in summoning merchants, I have in mind two types.  One normal merchie to sell the 'spoils' to and get gold for.  The other merchant would be special, a 'storage' merchie, he would buy and sell items used in crafting, crafted items, reagents, maybe even excess scrolls and potions?  The price would be one gold piece per item, both buying and selling. Each sell could be stored as an integer on the PC so he could only buy/sell however many he/she originally had. This store would only be used to BUY what it also SELLS so the player could get his stuff back.

If a store is too much to deal with script wise, conversations with an NPC merchant might be used, like Percy in Nordock used to be in buying reagents, I feel sure that could be done.  Scripts checking integers on players could then be used to sell stuff back to the player.  And with the right scripts this process can be done so ALL of a certain item are taken off the PC at the same time.

I use a script generator though I have managed to adapt or add to scripts in the past.  All the above is off the top of my head without looking at any scripts.  I hope this might help?