How do I make a merchant offer you discount on goods?

From OHRRPGCE-Wiki
Jump to navigation Jump to search

So you would like to include a quest which offers discount in shops when you complete it?

Well you can do it perfectly with the OHRRPGCE! (Haven't I told you that it was the best game engine in the world? ^_^) Before we start I assume that you have made several items and that you know how to place shops. If not, feel free click above and read the how to articles that explain how to place your shop with your items. You also need to understand how to make an NPC say something different later.

Ok! In this example we are in a village in which armors & weapons are very expensive. But luckily we meet someone named Pirin who knows the shop owner. We do something for him (helping his/her sister to come back from the forest, get back a lucky charm he lost whatever)

After we spoke to him, we obtain a discount! So how are we going to proceed? . Well as usual, using tags scripts, and text boxes.

First, we need to go under custom. Edit the tags names. We're going to have 2 tags. The first one is called "shop discount" and the second one is called "discount notice". The first tag has number 19 and the second tag has number 20.

Then we're going to have the text boxes. We're going to use three text boxes. If you have already implemented the shop for which you want a discount, then you'll have to create only two text boxes.

First one (maybe you already have it)

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

The second one is Pirin speaking about the price of the armors:

  You find armors are expensive? You should go back and tell the owner you're a friend of mine. He may
  give you a discount. 
  

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

  set tag  : always do the following
  set tag 19 = ON (Shop discount)

The third one is for the shop owner.

  So you have met Pirin huh? He's also your friend?!
  Well the friend of my friend is my friend! I'll give you a discount!

Edit the conditionals again and make sure you see the lines

 instead if tag 20 = on (discount notice)
 jump to text box 33 instead 
 set tag  : always do the following
 set tag 20 = ON (Discount notice)

The text box numbers are 33 for the first one, 41 for the second one and 42 for the last one.

Now we're going to work on the shops,

Edit your armor shop. Take a piece of paper and note down all the items' names and their prices. (The price of an item is given on the line cost)

I recommend you to make a table with 3 columns : item name/ current price/ new price

You can choose another method, but I strongly recommend you to note them because it's the easiest way to get the order in which you can find the articles on the shop. As we're going to re-enter them in the same order to be sure NOT to forget ANY article or to make mistakes on prices.

Using your head or a calculator, calculate new prices (around 25% discount is fine but it can be more if you want)

Here is a example with 5 items

  item name/ current price/ new price
  leather armor /$ 142/ $ 106
  leather gloves /$85/ $63
  leather beret  /$ 95/ $ 71
  iron armor  /$380/ $ 285
  iron helmet /$270/ $202

Once it is done we'll focus on the buy require tag. As the name stated, you can buy the shop item only if the tag is turned on, which is exactly what we need. For each article, add a buy require tag and be sure it is turned off. You should have

  leather armor buy require tag 19=off
  leather gloves buy require tag 19=off
  leather beret  buy require tag 19=off
  iron armor  buy require tag 19=off
  iron helmet buy require tag 19=off

Then add new shop things. The "new things" in question are the same articles but with a different price. The buy require tag is turned on this time

  leather armor buy require tag 19=on cost: $106 
  leather gloves buy require tag 19=on cost: $63
  leather beret  buy require tag 19=on cost: $71
  iron armor  buy require 19=on cost: $285 
  iron helmet buy require tag 19=on cost: $202

Remember that the cost line corresponds to the price the merchant will sell the article for. (how much it will cost TO YOU if you prefer)

You can now save your game file and export your names for script in the script management menu. Then, go back under windows. Edit our hss file and add the following script in your hss file

define script (29, armor shop seller, none)


#--------------------------------------------------------------------------------------------------
plotscript, armor shop seller, begin

if (check tag(tag: shop discount)==off) then, begin

show text box (33)
wait for text box

end, else, begin #if the tag is on then show
show text box (41)
wait for text box
show text box (33)
wait for text box

end  #end for the if check tag

end #end for the script
#----------------------------------------------------------------------------------------------

The only thing left to do if to draw Pirin npc picture set and to place him on the map. Make him display text box 42. Save your game and test the whole thing! Enjoy!

See Also[edit]