How do I make an NPC that gives you hints all along the game?

From OHRRPGCE-Wiki
Jump to navigationJump to search

You may have see that some rpg have implemented a npc which you can come and see to get hints when you don't know where to go or who you should speak to. Well the OHRRPGCE can also perfectly do it! ^_^

To do so we'll use use the switch command and cases. Ok let's take an example with Soleil. You need to go to see the king and then you need to see a counsellor to get the pass for Raflesia training camp. But the counsellor ask for help first and need advice for a present for the birthday of his daughter. You don't know who you should ask to get the good idea about what present to buy and give him.

Indeed to make all this work, the king does not give much details, only the name of the consellor or his/ her physical description. (Else you would find it straight away)


That's when the "hint npc" comes in. Go under custom. Draw an npc. Then go back to the main menu and pick up some free text boxes

  text box 34 " You should go and speak to the king. He may have something
  important to tell you.
  text box 37 To get the pass of Rafflesia you need to find consellor Harry. He is in the 
  kitchen speaking with his wife. Use the back door to get access to the royal kitchen.
  text box 38 You should go at the shoe shop and search for the barber. He is Harry's friend and
  he knows his family very well. The shoe shop is on the right street after the fountain.


Now go back under windows, edit our hss file and enter the following script


define script (21, hint npc, none)

Global variable (12, hint npc behaviour)

#-------------------------------------
plotscript, hint npc, begin 


switch (hint npc behaviour), do, begin

case (0) do, begin

show text box (34)
wait for text box
exit script
end

case (1) do, begin
show text box (37)
wait for text box
exit script
end

case (2) do, begin
show text box (38)
wait for text box
exit script
end
end #end for the switch

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

Now: how to make switch cases so that the npc says different thing to help us?. Well we'll need to use fake plotscripting!

When the game starts the value of variable hint npc behaviour is 0 so we need to change that to update his dialogues. Text box 37's content implies that we haven't met Harry. That means we need to change value as we speak to the king. Instead of making the king display a simple text box, we'll use a script

#-------------------------------------
plotscript, king speech, begin 

show text box (28)
wait for text box

hint npc behaviour:= 1 # give value 1 to the variable so that it updates hint npc dialogue

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

Then we learn we need to go to the shoe shop. It implies that we have not yet meet with the barber. We need to change value as we speak to the councellor. Then again we'll need to give the councellor NPC a script instead of a text box.

#-------------------------------------
plotscript, councellor, begin 

show text box (41)
wait for text box

hint npc behaviour:= 2 # give value 2 to the variable so that it updates hint npc dialogues.

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


Now save your hss file. Go back under custom and compile your scripts. Edit the map and give the new script you've made for the councellor and the king and put the text box line to "none". You need to see

   Display text : none

If you don't do that the text will be displayed 2 times.

Save your game and text the whoe thing! You're


Some things to remember[edit]

  • A hint npc is usefull when the map are big and when the player can loose easily. It also helpful when there are a lot of quests

and sub-quests because the player cannot remember all the informations stored in the text boxes. (Especially if he does not play for a long time)

  • If you intend to make say other important things later to other characters (like the king and the counsellor here) you'll

need to use tags and not just use a text so that the global variable "hint npc behaviour" does not get an old value and start to say things he/she has already said.

  • If the hint npc knows so many things there may be a reason and he/she might be involved in the main quest.