How do I make a church?

From OHRRPGCE-Wiki
Jump to navigation Jump to search

In some RPGs, particularly older ones, the player has to visit a church to revive dead heroes, instead of being able to revive them at the inn. (There are also games that have this but call it something else, like the clinic in the first two Etrian Odyssey games.) If you disable dead heroes being revived at inns, you can make a church by using plotscripting.

(In your game, that is. You can make a church in real life, but not by using plotscripting.)

The basic process of restoring dead heroes' HP is simple: you simply use set hero stat to change their HP to something that isn't zero. It's up to you how much health they'll have upon revival. Here are a few options you could choose:

set hero stat (0, stat:HP, get hero stat (which hero, stat:HP, maximum stat))   # revives the first hero in the party with full health, good as new
set hero stat (0, stat:HP, get hero stat (which hero, stat:HP, maximum stat)/2) # revives the first hero with half health, battered but alive
set hero stat (0, stat:HP, 1)                                                   # barely revives the first hero with 1 HP

You could just put a "set hero stat" command in a for loop, but the way churches typically work in RPGs is a little different from that: you pick a single dead hero and pay a revival fee. You probably also want to prevent the player from reviving a hero who isn't dead.

You'll also want to create a few text boxes to inform the player of what's happening. In this example we'll need three: one to inform the player that the hero was successfully revived, one to say the player doesn't have enough money for this, and one to inform the player that they selected a hero who doesn't need reviving. (If you use this method, you'll actually need a total of four text boxes overall; the fourth is the one that appears when your player talks to the priest NPC to start this whole process.)

Using the "half health" option, here's an example plotscript:

define constant (45, revived hero text box)        # change these to whatever the text boxes actually are in your game
define constant (46, revival unneeded text box)
define constant (47, cant afford revival text box)
define constant (100, revival fee)                 # price to revive a hero

plotscript, church script, begin
  variable (which hero)
  which hero := pick hero ("Who do you want to revive?")
  
  # check whether the player actually chose a hero or just canceled.
  # we'll only bother doing anything if they chose a hero.
  if (which hero > -1) then, begin
    if (get hero stat(which hero, stat:HP, current stat) == 0) then, begin
      
      # if HP is zero, attempt to revive the hero
      if (pay money (revival fee)) then, begin
        # revive the hero with 1/2 health and notify player
        set hero stat (which hero, stat:HP, get hero stat (which hero, stat:HP, maximum stat)/2)
        show text box (revived hero text box)
        
      end, else, begin
        # player can't afford to revive hero
        show text box (cant afford revival text box)
      end
    end, else, begin
      # this hero is already alive
      show text box (revival unneeded text box)
    end
  end
end


Now, simply put a "priest" NPC on your map, and have it display a text box whose "AFTER" conditional is set to run your church script.

See also[edit]