Aller au contenu

Photo

How To: Close Store


  • Veuillez vous connecter pour répondre
12 réponses à ce sujet

#1
_Guile

_Guile
  • Members
  • 685 messages
I want to, through scripting, close a store once a PC has selected 1 item from the store...

Can someone help with this?

#2
Leurnid

Leurnid
  • Members
  • 271 messages
Does the store only sell one item?

#3
_Guile

_Guile
  • Members
  • 685 messages

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?

#4
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
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.

#5
henesua

henesua
  • Members
  • 3 882 messages
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.

#6
Builder__Anthony

Builder__Anthony
  • Members
  • 108 messages
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.

#7
WhiZard

WhiZard
  • Members
  • 1 204 messages
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.

#8
Thayan

Thayan
  • Members
  • 244 messages
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 .


#9
henesua

henesua
  • Members
  • 3 882 messages
Whizard, thats a good idea. It gives the player the right feedback.

#10
Builder__Anthony

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

rusty

#11
_Guile

_Guile
  • Members
  • 685 messages
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 .


#12
the.gray.fox

the.gray.fox
  • Members
  • 127 messages
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

#13
_Guile

_Guile
  • Members
  • 685 messages

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?  ;)

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