PDA

View Full Version : Re-Recruitables


rictus135
03-13-2007, 11:33 AM
I have had an idea for some time for designing a recruit script that would not cause you to lose the NPC you are replacing. However I am a novice scripter, and while I know the basics of what would need to be done, I do not know how to do it or even if it can be done. To give you an idea of what it would be like just think of NWN recruiting. This would require more than just a script i suppose, such as updating the original NPC's Dialogs to support their re-recruitment, and perhaps the addition of new variables in the Globalcat.2da so that the NPC's that are being replaced can be spawned in a different module, I am not entirely sure.

From what I know the script would need to do the following at the very least:

Check to see if NPC_Blah is in your party.

If the answer is yes remove NPC_blah and spawn them in area_??? at such and such coordinates
Add NPC_who? to your party

If the answer is no add NPC_who? to your party

It would be best if it would scan for the NPC's template name rather than their Tag or slot number, as some recruit mods may not use different tags for the new NPC and some might (such as the recruit redhawk mod). If more than one recruit mod is being used, and you use the party slot, you may spawn copies of the original npc. For example if I was using the recruit Dustil mod and replaced Mission, mission would be spawned somewhere, if I then recruited redhawk in the same slot mission would be spawned a second time and Dustil would be lost. So to make it fully effective you would need to check for additional recruit mods. So you would need to check if a specific person is in a specific slot, or you may remove both the original NPC as well as a new NPC in a different slot.

Check to see if NPC_Blah is in your party at slot?.

If the answer is yes remove NPC_blah and spawn them in area_??? at such and such coordinates
Add NPC_who? to your party at slot?

If the answer is no check to see if NPC_Somebody is in your party at slot? etc. etc. until

If the answer is no add NPC_who? to your party at slot?

This wouldn't address the problem of using multiple recruitment mods that overlap, without everyone who has ever made a recruit mod updating theirs with a universal script. But it could be used by individuals who want to add the option of re-recuitment to their own mods.
Anyway, I would appreciate any input on the topic.

stoffe
03-13-2007, 12:23 PM
A few problems with this idea, as far as I know:
It is not possible to get the template ResRef an object was created from via scripting in KOTOR (unlike NWN). There are no functions available to check for it. And you can only check the Tag (or other specifics) of an NPC in a party slot by first spawning them into the game world.


Unlike NWN, the KOTOR games only have one area loaded at a time. You cannot modify another area than the one the player currently is in via scripting, so you can't move an NPC from one area to another. The only characters capable of moving from one area to another are those stored in the Party Table (and Puppet Table in TSL). Everyone else are stuck in the area they were created in.

So, while you could remove a party member temporarily and have them keep their game state (vars set, inventory, level progression etc), you could only switch them back into the party while you are in the area where you left them. And you'd have to make sure that area is never cleaned out from the savegame, or runs a script that resets it or deletes NPCs in it, or they'd be lost permanently.


Some game data is kept track of for a particular party slot rather than for an individual NPC. Things like influence and Puppets in TSL are stored for a party slot, so if you replace the character in that slot they would "inherit" the influence and any puppets (eg. Bao-Dur's Remote) of the previous occupant etc. :)


Some of the standard game scripts (The Ebon Hawk scripts and cutscenes in particular) assume the occupant of a party table slot to have a specific tag. If no character with the expected tag exists, since you've swapped out the NPC in the party table slot for another, those scenes/scripts may malfunction. You'd have to locate all those scripts in the game and rewrite them so they won't make that assumption.

rictus135
03-14-2007, 12:05 AM
I knew there would be certain problems with the idea, but WOW! that is a lot. I have a few idea about geting around that, but as i know only a limited amount i may be using incorrect terminology, and it is all just guesswork.

I was aware you couldn't just spawn anyone anywhere at anytime, i just used my example to give some idea of what i meant. I thought tha the use of ?global variables? was the way to get around this.
If you create a new variable - say the Jolee variable - and set it to 0 when he is in your party or not recruited yet then change it to 1 when he is removed from your party, you set up an effect for that variable. Whenever you enter an area it checks for the status of that variable (and any others pertaining to that area) and if it is set on 1 it runs a new script that spawns jolee at the coordinates you specify.

It might also be possible to change your party back to default whenever you enter the ebon hawk. Just run an on enter script (if you can in KOTOR) that re-recruits all of the original party members. Rather than talking to one of the new NPC's directly to rerecruit them, you could just create an "armband communicator" that runs a dialog that uses the recruiting scripts.

As for the inability to check for the template resref this can also be partially overcome by using the global variables. If the Jolee variable is set to 1, all dialog options for recruiting someone in jolee's slot are disabled, and a new line for recruiting jolee appears. So if you wanted to kick redhawk out of your party and recruit dustil using jolees spot, you must first recruit Jolee before recruiting Dustil.

stoffe
03-14-2007, 08:44 AM
I knew there would be certain problems with the idea, but WOW! that is a lot. I have a few idea about geting around that, but as i know only a limited amount i may be using incorrect terminology, and it is all just guesswork.

It's not impossible to do, it's just hard to make it seamless and to prevent it from breaking when used along with mods made by other mod makers. You can use global vars to keep track of the party state, as long as all scripts that add/remove party members respect those vars and keep them up-to-date with the actual content of the player's group.

It would be a significant amount of grunt work to locate all the scripts in the game which checks for/spawns in party members for cutscenes, interjections, quests or whatever and make those scripts check your globals instead when determining what to do.

The biggest hurdle for any mod like this is that you'd have to force the player to return to the Ebon Hawk (or another similar "party central" area) before changing their party around, and keep any party members that are currently not in the group stored in the Ebon Hawk area (altering any scripts running there that might remove them not to do so).

This would be needed since you can only access an NPC to add them to the party if they are in the same area as the player currently is in. If you spawn them in from their template, rather than spawn them from the party table or add an NPC that already exist in the game world, you would reset them to their default state, essentially making a new copy of them every time, where all the gear they carry, their levelup progression and any dialog vars set on them would be lost.

If you use the Ebon Hawk for this you could alter the script of the Exit trigger to open a dialog where the player can choose who should be part of the group from a list of available NPCs, before displaying the Party Selection Screen (where you choose your two side-kicks) for that group.