How do I make a battle start when you bump into an NPC?
From OHRRPGCE-Wiki
Creating an NPC which starts a battle when you bump into it is nearly the same as the procedure described in How do I make a battle start after talking to an NPC?
For every enemy on the map create an NPC with Activation: Touch and Usable only once so that it will disappear permanently after the battle. If you were to place this enemy multiple times on the map then all the copies would disappear after running into any of them, so you'll instead need multiple identical NPCs with different IDs.
Contents |
[edit] Textboxes
Old games like Monterey Penguin didn't have plotscripting available, so instead used textboxes to trigger battles. Each type of enemy would have a textbox containing something like "The killer banana lunges at you." with the correct battle formation in the conditions, and this textbox linked from the NPC (with Display Text).
[edit] Scripts
To skip the textbox, you need a script. You can either write one script per enemy type with the formation number hardwired (not recommended):
plotscript, killer banana, begin fight formation (15) end
And set Run script: killer banana on the NPC. Notice that 'fight formation' takes a formation number, not a formation set number.
...or write a generic script that triggers a formation supplied as script argument:
plotscript, formation, dummy, formation, begin fight formation (formation) end
A script linked to an NPC recieves two arguments when run (which happens when the NPC is triggered): the first is the NPC reference number, the second is the Script Argument. So you would set Run script: formation on the NPC and Script Argument 15
[edit] Formation Sets
Alternatively instead of specific formations, you can also use formation sets just like a foemap, so that a random formation is chosen:
plotscript, formation set, dummy, formation set, begin fight formation (random formation (formation set)) end