Aller au contenu

Photo

Automatically update stores?


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

#1
AaronH

AaronH
  • Members
  • 115 messages

Is there an option to automatically update stores when an item is edited?

It's becoming a real pain in the past years to keep our stores fully updated when we change stats etc on items. I haven't looked into this before, but was just curious as stores work slightly different.



#2
Tchos

Tchos
  • Members
  • 5 030 messages

It should work to add a script that fires RecreateItemsFromBlueprint() from ginc_item in the On Open Store Script slot.



#3
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
RecreateItemsFromBlueprint (No "s" on the end.)

#4
Tchos

Tchos
  • Members
  • 5 030 messages

Oops.  Fixed on my post.  Thanks, Lance!



#5
ColorsFade

ColorsFade
  • Members
  • 1 267 messages

Isn't this why I read somewhere that the recommendation is to spawn stores instead of place them? Wish I could remember where I read that... 



#6
Tchos

Tchos
  • Members
  • 5 030 messages

It really depends on what you want out of your shops.  If you want items players sell to still be there when they come back later, in case they change their minds, then don't spawn a new store every time.  If you want items to be refreshed back to their defaults every time, then do it.  There are also many options in between, including randomising the store contents, clearing junk and duplicates, gradually adding newer items as the characters level up, etc.  I wouldn't call any of those things the single best method, just different approaches.


  • ColorsFade aime ceci

#7
ColorsFade

ColorsFade
  • Members
  • 1 267 messages

Tchos, what do you think is the best approach for adding new items to a store as the characters level up? I think that's probably the thing I'm most interested in doing, given the level range of my campaign. 



#8
Tchos

Tchos
  • Members
  • 5 030 messages

I think an easy way would be to tie it to plot progression, since you have a good idea of what level a character should be at a certain point in the module.  I'd write a conversation script that would accept perhaps an "act" parameter, such as "Act 1", "Act 2", etc., which you would fire once the player reaches each of those points.  For each act's case, the script would get each store by its tag (this assumes either placed stores, or stores spawned once and then left alone), and then use CreateItemOnObject to spawn lists of new items for that act onto the appropriate store objects, optionally also looping through the stores to remove old items that the player would likely never need again.

 

I think that would be easier and more efficient than, for instance, having separate scripts on each store object's On Open Store Script slot, which would check the journal to see what stage the main quest is currently on or the party's character level, checking to see if it had already stocked the new items if it was past a certain stage, and stocking them if it hadn't.

 

There are other ways, but I'd go with the first unless someone else has a better idea.


  • ColorsFade aime ceci

#9
ColorsFade

ColorsFade
  • Members
  • 1 267 messages

I think an easy way would be to tie it to plot progression, since you have a good idea of what level a character should be at a certain point in the module.  I'd write a conversation script that would accept perhaps an "act" parameter, such as "Act 1", "Act 2", etc., which you would fire once the player reaches each of those points.  For each act's case, the script would get each store by its tag (this assumes either placed stores, or stores spawned once and then left alone), and then use CreateItemOnObject to spawn lists of new items for that act onto the appropriate store objects, optionally also looping through the stores to remove old items that the player would likely never need again.

 

I think that would only work for stores in the currently loaded module though, yeah?

 

Your idea got me thinking... about doing this in the OnClientEnter script. Check for the Act # (basically via Journal entry), update the store, set a flag that the stores have been updated so it won't fire every time, finish. 

 

I'm probably going to go the "spawn store once" route as opposed to placing. Not sure if it matters given that you can get the same effect from RecreateItemsFromBlueprint(). But since I tend to spawn just about everything else... might as well be consistent. 



#10
Tchos

Tchos
  • Members
  • 5 030 messages

Yes, it would only happen in the currently loaded module, so if you have multiple modules you'd have to add a conditional firing to your On Module Load scripts.



#11
Claudius33

Claudius33
  • Members
  • 256 messages

I would suggest to put the resupplying script in the campaign folder so you can adapt it while developing. I did that way in Sarmates! One single script handled it for a few stores, even located in different modules. Of course each store tag must be unique. I didn't spawn the store but just added new items into its inventory when relevant (i.e. based on the journal).

 

You can call the script from the shopkeeper convo (which I did) or execute it from the OnClientEnter script.



#12
ColorsFade

ColorsFade
  • Members
  • 1 267 messages

I would suggest to put the resupplying script in the campaign folder so you can adapt it while developing. I did that way in Sarmates! One single script handled it for a few stores, even located in different modules. Of course each store tag must be unique. I didn't spawn the store but just added new items into its inventory when relevant (i.e. based on the journal).

 

You can call the script from the shopkeeper convo (which I did) or execute it from the OnClientEnter script.

 

I put everything in my campaign folder. The only thing in my modules are the areas. 

 

I figured that out right off when I was first working in my campaign... I got tired of looking for scripts or conversations only to realize they were in some other module. 

 

I bounce around a lot when building, so it pays to have everything in the campaign folder where I can access from any module. 



#13
Tchos

Tchos
  • Members
  • 5 030 messages

You can call the script from the shopkeeper convo (which I did) or execute it from the OnClientEnter script.

 

Or the On Open Store Script slot.



#14
rjshae

rjshae
  • Members
  • 4 478 messages

I tried to write a set of scripts to micromanage a stores inventory once, but it was a royal pain to work with. In retrospect, I think it would be easier to work with bundles of store goods and randomly select a few bundles to build the current stock. I.e. create A, B, C, D, & E bundles of mundane ranged weapons; randomly select any two and merge to get the current stock. Possibly it could be done by using Stores to configure each bundle, then create a stocked store by merging.