Delay Spawn by Chapter
Callirgos
Member Posts: 105
in BG:EE Mods
Hi Quick Question
Is there a method I could use to delay the spawn of an NPC or Companion to require a specific chapter?
For Examples,
If I'd like Gurke to appear only after Chapter 4.
If I'd like Kivan to only apear after Chapter 3.
Is there a method I could use to delay the spawn of an NPC or Companion to require a specific chapter?
For Examples,
If I'd like Gurke to appear only after Chapter 4.
If I'd like Kivan to only apear after Chapter 3.
0
Comments
you would no doubt have to go into the area script where they would be spawned in and insert some sort of command of;
check chapter X
spawn creature at location
sort of deal
I'll start with joinable NPCs, which I'll refer to using your term "companions". With the exception of the BG:EE companions (ie not Dorn and the other 3), the locations of companions in BG1 are stored in the .GAM file. I haven't looked into modifying the .GAM file, so I won't say anything further about it, although it can certainly be done. Realistically, you are likely to be looking at removing the companion from the .GAM file, and having it appear via a different mechanism.
Next you have those groups of generic enemy NPCs that are randomly generated. These are created by something called a "Spawn Point". Information on spawn points is stored in .ARE files. These don't really seem to be what you're asking about, so I'll say nothing more regarding them.
Then you have NPCs that are created via actions in a dialog, in the script of a creature, or in the script of an area. I'll address the latter mechanism, as the others don't seem relevant. Not all areas have scripts. Those that do have scripts named after the code for the area (the one you see if you use the cheat console). For example, the script for the upper floor of Feldepost's Inn is AR3352.BCS. If an NPC is created via an area script, it is easy to change the conditions by which it appears, and in the below spoiler I'll show you how.
Finally, you have NPCs which are saved in the .ARE file (area file) and loaded with the area when it is visited for the first time during a game. These are known as "Actors". Most non-generic NPCs you encounter, as well as all of the generic friendly NPCs (commoners), are Actors. It's more difficult to modify an Actor in the way that you want to do it. A sort of hackish way to do so would be to change the appearance schedule of the Actor so that it never appears, and then create the NPC using the area's BCS script. There are also other methods to edit Actors, but it's easier to add Actors than to remove them.
How to make a .CRE appear during a specific chapter:
You can edit BCS scripts using NearInfinity, or in Notepad before pasting into NearInfinity. It's important to use Notepad rather than a word processing program (like Word).
IF YOU ARE GOING TO DO THIS, MAKE SURE YOU HAVE A BACKUP COPY OF YOUR GAME SAVED ELSEWHERE.
It seems to me that you're asking about tweaking something for your own use rather than making a mod for other people, so that's how I've pitched my answer.
However, as you only want to delay the appearance of an Actor, then have it appear in the area that it normally appears in, the script actions to deactivate and activate creatures could be useful for you. I'm going to use Gurke as an example. This script, added to AR3304.BCS, deactivates Gurke and then activates him once you visit the Jovial Juggler in Chapters 5-7:
You could use one variable to hide Gurke, and another to get him to reappear, if that's what you prefer.
A similar but better thing that you can do is put a script on the Actor itself. Actors have a "specifics script", which creatures lack, and BG:EE that script slot is often unused, although the script could be added to the .CRE itself. This is better than editing an area script for a number of reasons, such as: (a) you can duplicate the same script for multiple creatures; and (b) you can have the script remove itself after it's done what you need. So here is an example for you:
Unfortunately it does take about a second for the creature to hide itself. Often that won't matter, but it's noticeable with creatures that are visible as soon as you enter an area - you see them pop in or out of existence. If it bothers you, the thing to do might be to edit the Actor so it begins the game invisible, and have the script that activates the creature remove the invisible state. But it remains problematic if the Actor begins to do something (especially initiate dialog) before being hidden.