How do I make an NPC disappear when you talk to it but reappear when you leave and reenter the map?

From OHRRPGCE-Wiki
Jump to: navigation, search

This is rather easy, so long as you are willing to do a very small amount of plotscripting.

(Note that if the NPC in question is supposed to be dead you may want to do the exact opposite to what is explained here. See How do I use plotscripts to make an NPC disappear permanently?)

First go into the map editor for the map with the NPC. Go to "Edit General Map Data" and check that "NPC Data" is set to "Don't save state when leaving".

Then, edit your HSS file. Create a new plotscript, or find the point in an existing plotscript for a cutscene where you want an NPC to disappear.

Use the following command if you want to destroy the first copy of NPC ID 6 using the destroy NPC command:

destroy npc (6)

And here you are! Be careful that you have the right ID number. If there is more than one copy of the NPC on your map, you can specify one of them, using the NPC copy number that is displayed in the map editor and the NPC reference command.

NPC placement mode with copy-count display.png

Look at the example above. Suppose you wanted to remove the guard on the bottom right.

destroy npc (npc reference(1, 2))

Of course, if you wanted to remove the guy on the throne, you could use the command:

destroy npc (27)

Because he is the first copy of that NPC ID, you don't need to bother with the NPC reference:

destroy npc (npc reference(27, 0)) # These all do the same thing
destroy npc (npc reference(27))    # 0 is assumed if you leave out the second number
destroy npc (27)

You can also use "destroy NPC" to remove NPCs that you created with the create NPC command:

variable(ref)
ref := create npc(27, 25, 11) # Create NPC ID 27 at position 25,11
wait(5)
destroy NPC (ref)

See Also[edit]