How do I update shop items?

From OHRRPGCE-Wiki
Jump to navigation Jump to search

There are several reasons which can lead you to update shop things. For example you have made a potion shop and as heroes passes they need hp+ potions so that during battle the hero still get back a correct amount of hp/ mp each time the player use a potion.

Before we start I assume that you have made a potion shop with several items and that the shop is already placed. If not click above and read the how to articles that explains how to place your shop and how to create items and how you can choose which items to sell using the edit shop menu under custom.

You also need to understand how to make an NPC saying something different later. In this example, our heroes learn after coming back from a battle, that the potion shop owner has received new articles.

To update shop things we have 2 main options. The first one using a tag, and the second one is to make 2 shops and using scripts.


Using a tag[edit]

This is the most simple and it is the one I recommend you. We're going to use, as usual, tags and text boxes. What is great for beginners is that this method does not involve plotscripting.

Ok first, we need to go under custom. Edit the tags names. We're going to use one tags. The first one is called

 "new shop arrival "  #This tag has number 21.

Then we're going to have the text boxes. We're going to use three text boxes. Normally you already have created the first one under custom when you first placed your potion shop :

First one ( you should already have it)

  Welcome to the potion shop! What can I do for you? This text box has conditionnal and is set as "always go to"
  shop? potion shop

The second one is text box which contains an npc dialogue in which he says new items are avialable at the potion shop:

 We are not isolated anylonger thanks to you. You should go to the potion shop! I think the owner
 have received new items. 
 

For this text box, edit the conditionnals and change them until you see the line

 set tag  : always do the following
 set tag 21 = ON (new shop arrival)

The second text box is text box 23, and the first one text box 15.

Now we're going to work on the shops. To add shop things, we're going to use the bitset "buy requiere tag". As the name stated, you can buy the shop item only if the tag is turned correctly, which is exactly *what we need.

Edit your potion shop.

First you need to choose, if you just want to add new items or if you need to delete the old one. Ask yourself, are the potions I want to get rid of are still usefull for the player? (some gameplay test may be needed) If the answer is yes then you should skip the step above which consists in making the tag turned off.

So we assume that the heroes are around level 15 and that they don't need to buy basic potion which gives them back only 20hp and 30mp during battle. We want the shop owner to sell only new usefull potion. To do so wer need the use buy requiere bitset and turn the tag off for all the old items. (Those items are going to disappear after the heroes learns that new items has arrived).

For each item go down and check the buy requiere line. Make sure you see

 hp potion buy requiere tag 21=off
 mp potion buy requiere tag 21=off
 ether buy requiere tag 21=off

Once it is done. You can add the new items. Give them a price on the line cost (Remember that the cost line corresponds to the price the merchant will sell the article. (how much it will cost TO YOU if you prefer)) and a selling price so that the player can get money back if he/she gets too much potion in its inventory.

This time, you turn the buy requiere tag on.

 hp+ potion buy requiere tag 21=on
 mp+ potion buy requiere tag 21=on
 ether+ buy requiere tag 21=on

Now go back and add a npc and give him the text box 23. (You can also choose to udpate the dialogue of an NPC which is already on the map) And that's all folks! You are ready to test the all thing!


Using 2 shops and plotscripting[edit]

This method may be useful if the shop you want to update has been already updated and contains around 50 items which is the limit. It slightly more complicated as it implies plotscripting but nothing a beginner cannot handle. To make the player able to buy those new powerful potions, we'll need in fact to change shop!

First go under custom and edit the shop. Add a new shop and give him exactly the same name as the one for which you want to update things. Why? Because if the name is not the same the player may complain it's strange. (If you have put Arthur's Shop and if the shop menu does not say Arthur's shop, it may seems strange.

For some reasons you may want the player still be able to buy simple ether potion, hp potion or revive. If you wish so, then you should add them now and give them a price

 hp potion $25
 mp potion $45
 ether $104

Add the new items and give them a price and a selling price.


 hp+ potion $45
 mp+ potion $85
 ether+ $174

Now edit the tags and pick a new one called "new shop arrival" (or any other name you find useful to remember what the tag does) It will be tag number 21.

Then go back and edit the text boxes and re-enter the same text that the potion owner says. Generally it's something like

Welcome to the potion shop! What can I do for you? 

This text box, just like its twin has conditionnal. You need to see

 "always go to"  shop? potion shop

As the old shop and the new shop has the same name, be sure you the number is different. You may have

  go to shop 4 Potion Shop in the first case and 
  go to shop 7 Potion Shop

This text box will be text box 25. Its twin is text box 12.

Then pick up another free box and put it something like

 We are not isolated anylonger thanks to you. You should go to the potion shop! I think the owner
 have received new items. 

It will be text box 34.

Now go into the script managment section and export the names for your scripts. Then save your game.

Go back under windows and edit the hss file. Add the following script

define script (32, potion shop owner script, none)

#------------------------------------------------------------
# script for the potion shop owner
plotscript, potion shop owner script, begin

  suspend npcs
  suspend player

  if (check tag (tag: new shop arrival)==off) then, begin
    show text box (12) #text box which leads to the potion shop until boss ???
    wait for text box
  end, else, begin
    show text box (25) #text box which leads to the second potion shop with new potions
    wait for text box
  end# end for the tag

  resume npcs
  resume player

end #end for the script

#--------------------------------------------------------------

Go back under custom, compile your script and import them. Go on the map where is the potion shop owner and edit his/ her npc. Make sure he doesn't display any text box and make him/her run the script "potionshop owner"

Pick up a free npc give him/her a picture and a palette set and make him/her display text box 34. (You may also choose to update the dialogue of an npc already on the map see above for more details).

Save your game and you have finished. You can now test the whole thing to see how it works. Go and speak to npc, make the tag active and go to the potion shop owner to see what he/she sells.

See Also[edit]