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

From OHRRPGCE-Wiki
Jump to: navigation, search

So you would like to include a quest which offers discount in the shops at the end ?

Well you perfectly can do it with the OHRRPGCE! (Haven't I told you in that it was the best game engine of the world? ^_^)

Before we start I assume that you have made several items and that you know how to place shops. If not click above and read the how to articles that explains how to place your shop with your items.


You also need to understand how to make an NPC saying something different later.

Ok! In this example we are in a village in wich armors & weapons are very expensive. But luckily we meet somoene named Pirin who knows the shop owner.

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.

Ok 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 conditionnal and is set as "always go to"
 shop? armor shop

The second one is Pirin speaking Pirin:

  You find Armors are exepensive? 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 conditionnals 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?!
  We'll the friend of my friend is my friend! I'll give you a discount!

Again edit the conditionnals 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 in the best way to be sure to NOT forgot ANY article.

Using your head or a calcutator and calculate new prices (around 25% discount if fine but it can be more if your 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 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. For each article, add a buy requiere tag and be sure it is turned off. You should have

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

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

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

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)

You can now save your game file and export your names for script in the script managment 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 while thing!

[edit] See Also

Personal tools