Hi all,
Just wondering if there is a way of after buying an item off a merchant that within the OnAquireItem proc to close the merchant window?
Thanks,
Doomie
A way to close a store after buying an item?
Débuté par
doomie22
, juin 16 2011 10:57
#1
Posté 16 juin 2011 - 10:57
#2
Posté 16 juin 2011 - 11:41
Interesting.
A number of options come to mind.
But I think the cleanest one (and one that will leave no trace what-so-ever) is to destroy the very Store object.
That will cause the immediate cessation of shopping activity -- for sure.
But it will also do it for any other PC shopping at the same Store in that moment (multiplayer).
When you destroy a Store, you lose any customization made to it after its spawning. That includes you also lose any and all items that were sold _to_ the Store.
Recreating the Store (that is, spawning it anew from its blueprint) would not bring the sold items back. Makes perfect sense.
So... To solve this problem, just CopyObject() the original Store somewhere (you clone it).
You can spawn it at the same Location of the original Store currently open for shopping -- the game will not care.
Then you simply destroy the original Store object.
That should do the trick nicely.
And because you have copied (cloned) the original Store, you have also preserved all items that were sold to it.
Please let me know if it works -- I can not make tests from here at the moment.
-fox
[edit]
Let us steppify it:
1) Query the Location of the currently opened Store.
2) CopyObject() the currently opened Store at the Location from point 1.
3) Destroy the currently opened Store.
4) Send fox a bunny.
-fox
A number of options come to mind.
But I think the cleanest one (and one that will leave no trace what-so-ever) is to destroy the very Store object.
That will cause the immediate cessation of shopping activity -- for sure.
But it will also do it for any other PC shopping at the same Store in that moment (multiplayer).
When you destroy a Store, you lose any customization made to it after its spawning. That includes you also lose any and all items that were sold _to_ the Store.
Recreating the Store (that is, spawning it anew from its blueprint) would not bring the sold items back. Makes perfect sense.
So... To solve this problem, just CopyObject() the original Store somewhere (you clone it).
You can spawn it at the same Location of the original Store currently open for shopping -- the game will not care.
Then you simply destroy the original Store object.
That should do the trick nicely.
And because you have copied (cloned) the original Store, you have also preserved all items that were sold to it.
Please let me know if it works -- I can not make tests from here at the moment.
-fox
[edit]
Let us steppify it:
1) Query the Location of the currently opened Store.
2) CopyObject() the currently opened Store at the Location from point 1.
3) Destroy the currently opened Store.
4) Send fox a bunny.
-fox
Modifié par the.gray.fox, 16 juin 2011 - 11:48 .
#3
Posté 18 juin 2011 - 12:23
I am not liking the idea of that especially if someone else is using it.
Has anyone got a script out there that a PC is able to buy a key off a merchant but if they try to buy another then it stops them?
Thanks
Has anyone got a script out there that a PC is able to buy a key off a merchant but if they try to buy another then it stops them?
Thanks
#4
Posté 18 juin 2011 - 01:31
You can always cycle through the other shop users and issue (for them alone) an OpenStore() command.doomie22 wrote...
I am not liking the idea of that especially if someone else is using it.
Their Store interface would just blink for a moment. No big deal -- really.
But if you do not like it, who am I to insist?
When you buy an item from a Store, the OnAcquireItem module event fires for you.doomie22 wrote...
Has anyone got a script out there that a PC is able to buy a key off a merchant but if they try to buy another then it stops them?
Thanks
At that point you can query the call for more details... starting with seeing who is the _former_ Possessor of the newly acquired item.
If such possesor is the Store... you just give the item back to it (to the Store, I mean).
Have care to refund any GP worth the item to give back, of course -- for this kind of giving back is not a regular transaction.
Does this help better?
-fox
Modifié par the.gray.fox, 18 juin 2011 - 01:37 .
#5
Posté 18 juin 2011 - 02:21
Thinking along the lines of Fox there have the merchant in the conversation prior to opening the store check the pc for an int(more on this in a moment), if the pc has the int marking dont open the store, just say "Hope that key did you some good.". The int would be marked on the pc when they originally purchase the key, you can have the onacquire of the mod close the store, I think, I will open the toolset and make sure in a bit. So any subsequent attempts by the pc to get another key will be thwarted.
Modifié par Baragg, 18 juin 2011 - 02:23 .
#6
Posté 18 juin 2011 - 02:23
Did not immediately see a CloseStore, but mayhap you could add an action to the pc action que such as move back 2 steps and thereby have the store close?
#7
Posté 20 juin 2011 - 03:47
I have got a concept on how I can sort it, but I am having trouble with a small thing.
I am in the module on acquire item script. I am trying to link back to the shop that is currently open.
What my plan is that if it finds that within the database that there is an int set against the player that it will take the item and either give it back to the shop or create the item on shop and destroy the item from the player, but I have no idea how I can get the shop info from within the acquire script.
I am in the module on acquire item script. I am trying to link back to the shop that is currently open.
What my plan is that if it finds that within the database that there is an int set against the player that it will take the item and either give it back to the shop or create the item on shop and destroy the item from the player, but I have no idea how I can get the shop info from within the acquire script.
#8
Posté 20 juin 2011 - 08:59
object oStore = GetModuleItemAcquiredFrom();
if{GetObjectType( oStore) == OBJECT_TYPE_STORE)
{
// then the store that the item came from is oStore.
}
if{GetObjectType( oStore) == OBJECT_TYPE_STORE)
{
// then the store that the item came from is oStore.
}





Retour en haut






