How do I use plotscripts to make an NPC disappear permanently?

From OHRRPGCE-Wiki
Jump to: navigation, search

You may have noticed a strange bitset called "appear if" when you edit npcs on the map menu. This article explains you how to use this bitset efficiently.


Have you already noticed that sometimes the npcs that you have placed under custom.exe, and then who have been destroyed while a cutscene come back whereas they shouldn't? For example a beaten boss came back when you reload the map whereas you have already beaten him/her.?

How's that? Well the answer lies in the plotscript dictionnary. Near the definition of the command destroy npc, you can read that "the deletion is not permanent. Unless this is an NPC that you created with create NPC"

But in some situations, we need to make disappear a npc that we have placed on the map under custom. If we take back the example with the boss, the hero have to meet the boss in its H.Q. As the "boss npc" was placed on the map under custom, the effect of the command "destroy Npc" at the end your script lasts until you leave the Hq.

To prevent this from hapenning you have to use to npc bitsets "appear if...tag" .

Note that there are 2 main reasons to use the "appears if". The first use is to when you make fully disappear a npc that have been already placed on the map under custom (just like in our example above). And the second use is when you need make appear a npc that was and (has to be it's a compulsory) already been placed on the map under custom.

Note that this second use of the "appears if" is (much) less useful than the first one because it very rare to be compelled to make appear a npc and in the same time to be compelled to place it on the map under custom. Most of the time, you will just create the npc, and destroy it at the end of the cutscene.

To prevent things to be more complicated than they already are, check first that the option "save npc state" has not been activated on your testing map!

Ok! Now let's see how to do.


make fully disappear a npc using a tag[edit]

The typical case here is the beaten boss in his/her HQ that have been beaten. You don't want him/her to reappear if the hero comes again (to steal its treasure for example). There we'll have something important to decide : will the hero find the boss (because they know where the HQ is and have been sent to fight him/her) or will the boss find heroes that have broken in the ennemy HQ? In the first case, we'll need the appear if function but not in the second case, we'll need to create the Boss and then destroy it.


As explained above if we use destroy NPC after he/she had been beaten that what will happen because "the deletion is not permanent. Unless this is an NPC that you created with create NPC"

To prevent this we need the "appear if" function. To do so, go under custom.Exe and pick up a free tag. In our example we will name "boss disappear" and it will be tag 7 (or any other name that may remind you what the tag is used for). Edit the hsi file and then edit the boss hq map. Pick up the npc that looks like the boss and edit it. Go down and make sure you can read

      Appear if Tag 7= on (boss disappear)

Save your game datas and edit you hss file. You can now include the following line after the boss had been beaten

      set tag (tag : boss disappear,on)
  • Note that you may need to implement NPC animation when the boss died because if not it may seem strange to see an npc

disappearing straight away.

  • Note also that you don't need to use the destroy npc command.
  • The appear if function is also one of the solution to make npc invisible


make fully disappear a npc using the option "save npc state" of the map[edit]

This one is the easiest way to do to save npcs but it can troublesome if you're a newbie that already has troubles with the npcs while its cutscene. That's why I put this here.

Alright let's take again the example of the beaten boss. If you remember, he/she in his/her HQ that have been beaten. You don't want him/her to reappear if the hero comes again (to steal its treasure for example). There we'll have something important to decide : will the hero find the boss (because they know where the HQ is and have been sent to fight him/her) or will the boss find heroes that have broken in the ennemy HQ? In the first case, we'll need the appear if function but not in the second case, we'll need to create the Boss and then destroy it.

Imagine that the hero find the boss and beat he/she. You have placed the npc boss on the map under custom.Exe. You would like it to disappear at the end of the cutscene! So how to do? Well that's simple : go under custom.exe and edit the boss hq map!

Edit the General Map Data and go down until you NPC Data: don't save state when leaving. Use the right arrow and change to "Remember state when leaving"

And... that's all! Thanks to this the extract of the definition is now incomplete "destroy NPC after he/she had been beaten that what will happen because "the deletion is not permanent. Unless this is an NPC that you created with create NPC"

The "Save Npc State" function of the map keeps that the deletition have been done and make it permanent. To make disappear you Npc permanently you just can use "destroy npc" and checked that the "Save Npc state function" of the map is active!

But now that you uses this option, it also implies that you may be very careful if you intend some scene in which npc disappear temporaly (somoene have been kidnapted as you were sleeping and have to rescue her/him for example) Feel free to ask futher question on the forum to see how to modify your code and adapt it to this kind of situations!


See Also[edit]