As silly as this is going to sound...
I think I've figured out how to spawn an NPC in the SAME module you're standing in, but how do you make a script spawn an NPC in a different module?
For the record, I'm trying to make a mod where you can save the Endar Spire survivor in the Undercity. You convince him not to run off and get killed. I've already scripted him making a dignified exit.
However, I'm trying to make a script that spawns him Zelka's clinic in the Upper City South after he makes his exit from the Undercity.
_______________________________________________________
Okay. Now for part 2 - is there a script to "unrecruit" a character? I'm working on a recruit mod where the recruited character only stays in your party temporarily.
I think I've figured out how to spawn an NPC in the SAME module you're standing in, but how do you make a script spawn an NPC in a different module?
You can't do it directly since a script only can perform actions in the currently loaded module. It's usually done by setting a global variable where you indicate that the NPC should be spawned. Then either the OnModuleLoad, or Area OnEnter event scripts for the area where the NPC should appear, check if the global variable has been set, and if so spawns the NPC and unset the variable again (to prevent a new clone from being spawned every time you enter the area).
You must add global variables to the globalcat.2da file to be able to use them. Then you can use the SetGlobalBoolean() function in your dialog or cutscene in the Undercity to set your variable, and use GetGlobalBoolean() in the OnModuleLoad/OnEnter script in the Upper City to check if it has been set.
You can either modify the k_ptar_a02ac_en script (which is the OnEnter script for the Upper Taris South area), or assign an OnModuleLoad script to it in the module.ifo file inside tar_m02ac.rim (it has no OnModuleLoad script set currently).
Thank you. Now, second silly question - how can you make a PC leave your party (ala Trask, Bastila post-Leviathan or half the crew if you go DS)?
Thank you. Now, second silly question - how can you make a PC leave your party (ala Trask, Bastila post-Leviathan or half the crew if you go DS)?
To remove them from both the party selection screen and the active 3 man party you can use a script like:
void main() {
RemovePartyMember(NPC_BASTILA);
RemoveAvailableNPC(NPC_BASTILA);
}
...where you replace NPC_BASTILA with the constant for the party slot occupied by the character you want to remove:
NPC_BASTILA
NPC_CANDEROUS
NPC_CARTH
NPC_HK_47
NPC_JOLEE
NPC_JUHANI
NPC_MISSION
NPC_T3_M4
NPC_ZAALBAR