Author Topic: How To: Close Store  (Read 414 times)

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
How To: Close Store
« on: April 18, 2012, 02:06:01 pm »


               I want to, through scripting, close a store once a PC has selected 1 item from the store...

Can someone help with this?
               
               

               
            

Legacy_Leurnid

  • Sr. Member
  • ****
  • Posts: 473
  • Karma: +0/-0
How To: Close Store
« Reply #1 on: April 18, 2012, 05:12:39 pm »


               Does the store only sell one item?
               
               

               
            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
How To: Close Store
« Reply #2 on: April 18, 2012, 05:24:25 pm »


               

Leurnid wrote...

Does the store only sell one item?


No, it sells multiple items, but only 1 item is allowed to be taken out of it, and the other store allows 2 items to be taken out of it, I'll use a variable to check the # of items taken, I just need to know which function to use to make the PC close the store...

Anyone?
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
How To: Close Store
« Reply #3 on: April 18, 2012, 07:01:33 pm »


               There is not one.  The store the closing of the store is handled by the client.   I guess you could try clear all actions or have the PC do some other action.   You will also need to use the On item Aquired module event to capture the item being sold.  

I am not at home right now so I can not test any of that out.
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
How To: Close Store
« Reply #4 on: April 18, 2012, 07:24:35 pm »


               I appreciate that you'd like to do this with a store, but this may be better handled by a dynamic conversation that provides a menu of items to select from.
               
               

               
            

Legacy_Builder__Anthony

  • Full Member
  • ***
  • Posts: 180
  • Karma: +0/-0
How To: Close Store
« Reply #5 on: April 20, 2012, 08:22:59 am »


               maybe get the gold from the merchant and if it drops close the store.not sure if thats possible unless maybe you link the store to the npc somehow.
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
How To: Close Store
« Reply #6 on: April 20, 2012, 10:54:35 am »


               I just had an idea.  If nothing else works try opening a fake store (a store with no inventory, gold, or ability to identify items).  This should close the current store and make it look like all the items disappeared after the player selected one.
               
               

               
            

Legacy_Thayan

  • Sr. Member
  • ****
  • Posts: 435
  • Karma: +0/-0
How To: Close Store
« Reply #7 on: April 20, 2012, 02:48:02 pm »


               How about using the Store OnOpen event to set a variable on the PC that the store is open? Then have the module OnAcquire check if that that variable is set on the PC and, do a ClearAllActions() to close the store. I'm not 100% sure if ClearActions will close the store though, but there's other things you could try in the OnAcquire script at that point though too - like opening the blank store or quickly starting and ending a blank conversation or something. I'm sure there are plenty of actions that would result in force closing the store.

Oh - and the store OnClosed event would need to contain a script that removes the variable set on the PC in the store OnOpened event.
               
               

               


                     Modifié par Thayan, 20 avril 2012 - 01:49 .
                     
                  


            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
How To: Close Store
« Reply #8 on: April 20, 2012, 03:04:30 pm »


               Whizard, thats a good idea. It gives the player the right feedback.
               
               

               
            

Legacy_Builder__Anthony

  • Full Member
  • ***
  • Posts: 180
  • Karma: +0/-0
How To: Close Store
« Reply #9 on: April 22, 2012, 07:22:40 am »


               ya i guess you could do a count on the container or something like that.check to see if somethings taken out....

rusty
               
               

               
            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
How To: Close Store
« Reply #10 on: April 22, 2012, 05:37:35 pm »


               ClearAllActions() does NOT work, unfortunately.... (I've tried it 2 ways)

The Items are scripted so that when the PC acquires the item it will ClearAllActions() on the PC..

So, what I'm going to do is just remove the inventory from the store once the PC has obtained the one item they chose...

I'll have to use a fake store, or an empty one that is, and fill the empty store with the real store's goods...

Thanks for the help guys...
               
               

               


                     Modifié par _Guile, 22 avril 2012 - 04:38 .
                     
                  


            

Legacy_the.gray.fox

  • Full Member
  • ***
  • Posts: 214
  • Karma: +0/-0
How To: Close Store
« Reply #11 on: April 28, 2012, 04:40:56 pm »


               As the player buys the item, cutscene_seize him and walk him away in any direction.
Move him to a distance any greater than 2 meters from where he was standing in the moment that the store opened. The store will self-close gracefully.


-fox
               
               

               
            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
How To: Close Store
« Reply #12 on: April 28, 2012, 08:11:31 pm »


               

the.gray.fox wrote...

As the player buys the item, cutscene_seize him and walk him away in any direction.
Move him to a distance any greater than 2 meters from where he was standing in the moment that the store opened. The store will self-close gracefully.


-fox


Say that's a pretty sharp idea!  ':wizard:'

Why didn't anyone else think of this?  '<img'>
               
               

               


                     Modifié par _Guile, 28 avril 2012 - 07:12 .