How do I make a church?
So you want to make a church? A church is a place where the heroes are revived. Most of the time it is cheap to prevent the player from beeing stucked because of a lack of money. It involves a bit of work but it worths the efforts.
The church you made with plotscripting can also offer other services such as anti-poisonning, spell learning, or saving. To implement it correctly it is recommended that you understand what are global variables are and how to make a menu.
Customisation through plotscripting let you decide if you want to give your heroes only a few HP back or full HP.
Don't use the INN shop that comes with Custom.exe
As you may have noticed while doing the HOW TO and your tests the INN you make with the Edit shop menu already make heroes rise from the dead. So you may wonder: Do I have to make INN from scratch along with the church? Well, hopefully not. As we'll see in the next section there are ways to desactivate the revive function of the INN.
There are also other problems when trying to make a church from a INN shop. If you try to give your INN script to your priest you'll see when the script run the phrase the INN costs. (Whereas you should see : A donation costs) An that's not the only problem! When the INN script runs, you can see the HP bar of all of your heroes (dead and alive alike) whereas in a church script, you may want to see only the heroes who are dead.
But finally the main drawback of using a simple modified INN shop function is that you don't have other services like anti-poising, uncursing or save that you may want the player to find in your game.
A simple script to make your Church
Checking that the revive function of an INN shop in unactive
There are two main ways to revive dead heroes . The first one is the bitset in the edit general game data of the rpg file called "Inn revive dead heroes". The second one is the command.
set inn revive mode (state)
Before going further, we need to check that your INN is a simple INN so that implementing a church system make sense. So I advise you to go under custom. Edit the general game data and edit the preference bitset. Check that the bitset
Inn revive dead heroes
is not active. Then edit your .hss file. Go into the edit menu of your program and search for the phrase: set inn revive mode. If the line does not appear, it won't founded. Then we'll make a Killer NPC script. That script will prevent you from having to make battles until one of your heroes is dead. You need dead heroes to be able to check that your church script function correctly during the implementation process. First make an a NPC (or import graphics) that look like an enemy. Pick up a free box. Let's say text box 17. Write something like
Ennemy: Sorry I have to kill you, it's for a test!
Then save your game data and add the following script into your hss file.
script, killer npc script, begin suspend player suspend npcs show text box (17) #sorry I have to kill you wait for text box set hero stat (0,stat:hp, 0,current stat) set hero stat (0,stat:mp, 2,current stat) set hero stat (1,stat:hp, 3,current stat) set hero stat (1,stat:mp, 8,current stat) set hero stat (2,stat:hp, 0,current stat) set hero stat (2,stat:mp, 5,current stat) set hero stat (3,stat:hp, 0,current stat) set hero stat (3,stat:mp, 6,current stat) resume player resume npcs end #end of the plotscript
This script change all heroes HP and MP. As you notice only hero 1 is alive. Save your hss file. Import your script. Edit your map and then the NPC that look like an enemy you created earlier.
Now we can test and launch the game. Go and speak to enemy npc and thet go to the INN. Normally all your heroes except hero 1 should be healed. Now that your INN does not revive dead heroes anymore, we can proceed to the next step.
Making your INN script
If you add this command, your INN keeper will gain the ability though plotscripting to in fact became a priest. So before we start edit your game and check that the bitset is not activate. Else, you'll never be able to make your heroes to come back to life.
It might be more difficult to do so if you have made your own Inn but not impossible. We're using the same commands (set hero stat, get hero stat etc..), but in a slightly different way. We have seen in the article How do I prevent a dead hero from reviving at the Inn? how to make a reviving point. So we're going to start from that.
If you remember well, we're using variables that checks that the Hp of the heroes is 0, and if so, we want the script to restore our stats.
script, reviving point, begin suspend player suspend npcs if (check tag (tag: go to revive)==On)then, begin variable (hero0 hp, hero1 hp, hero2 hp, hero3 hp) hero0 hp:= get hero stat (0,stat:hp,current stat) hero1 hp:= get hero stat (1,stat:hp,current stat) hero2 hp:= get hero stat (2,stat:hp,current stat) hero3 hp:= get hero stat (3,stat:hp,current stat) If (hero0 hp == 0) then, begin # if hero 0 has no Hp then begin set hero stat(0,stat:hp, get hero stat(0,stat:hp,maximum stat)/6) show text box (45) #priest: good luck may the lord be with you wait for text box end, else, begin If (hero1 hp == 0) then, begin # if hero 1 has less 1hp then begin.. set hero stat(1,stat:hp, get hero stat(1,stat:hp,maximum stat)/5) show text box (45) #priest: good luck may the lord be with you wait for text box end, else, begin If (hero2 hp == 0) then, begin set hero stat(2,stat:hp, get hero stat(2,stat:hp,maximum stat)/5) show text box (45) wait for text box end, else, begin If (hero3 hp == 0) then, begin set hero stat(3,stat:hp, get hero stat(3,stat:hp,maximum stat)/5) show text box (45) wait for text box end, else, begin show text box (13)# sorry buy it seems that you don't need my service wait for text box resume player resume npcs end# end for last else, begin end # ends for the ifs end end end resume player resume npcs end #end of the plotscript