Jump to content

Adding a Companion to NWN2 OC


Recommended Posts

  • Replies 41
  • Created
  • Last Reply

Top Posters In This Topic

Oh, just grumbling a bit :) I've been cutting up and stitching together .wav files all day. I'd like him to come in as seamlessly as possible but I know only about a minute or two of his dialogue can be actually spoken. I'd hoped for a little more to give a voice to the text as he progresses, but there's only so much I can do.


When I'm closer to done with it, I think I might need help using the OnEnter script to spawn a bunch of waypoints. He'll need ones for his hangout spots, at least, and I'll probably want one to spawn him at.

Link to comment
Share on other sites

Certainly. If you want to spawn new waypoints for later convenience, then we'll need some locations in vector form. You can get them by either opening the area in the toolset, dropping an object onto the desired location, and taking note of the "position" in the object's properties (and then close the area without saving it), or by walking to an area in-game, opening the console, activating debug mode, and typing "loc", and writing down the location it reports. The latter method guarantees that the location is a valid, walkable location, since you're standing in it. The tag of the area will also be needed, with either of those methods.

Link to comment
Share on other sites

RE: Always/Once per conversation/once per creature that uses this conversation/once per game -

Is this mostly just used for random conversations for the masses? (Like, to make sure your wandering NPCs in a city don't say the same thing over and over?) Or is it used often in normal conversations?


I see they have a gc_global_int and ga_global_int default script now (which is nice to not have to make one every time you want a certain condition to be met/set) - but who is it set on and am I using it right?



Valen: (first meeting condition gc_global_int | 00_Valen_Intro | 0) blah blah blah nice to meet you


i'm this guy and i'm awesome (action ga_global_int | 00_Valen_Intro 1)


So that way he'll only repeat that conversation if you stop him before he says his second line of intro dialogue. Right?


Can I have the int be set on the NPC's line (like saying his/her name) and checked on the PC's dialogue options (to not allow the PC to ask the NPC's name if the NPC already said it)? Or will the conditional never be met since the check is on the NPC but the set is on the PC?


EDIT: Adding a NPC to a party seems incredibly confusing when trying to look at other NPCs' scripts to see what is done for the default. I believe I may be doing this wrong:

Edited by Xxtayce
Link to comment
Share on other sites

There are many parameterised general-use scripts (gc_ and ga_), and there are many more that have been written by others and myself to handle even more situations. You can script most things you want to do in a module with those scripts alone, since they can take parameters. It is a significant and important feature.


"Once per creature" is the one I use, but only use it for dialogue that should never be repeated, like first-time meeting introductions, e.g. "Hello, you're a new face in town!" with a secondary introduction node below that one which says "Ah, hello again," etc. If you want to randomise wandering NPCs, use the gc_random conditional.


Global variables are not set on anything. Local variables are. Globals are a global part of the module. I recommend you never use them unless absolutely necessary. I've found them to be less reliable than local variables. Local variables can be checked and set from anywhere in the same module. If you need one to be accessible across modules, you can use set it on the PC, who is always present, or use the journal, which is always present.


Use local variables instead, and set it on the owner of the conversation, or on the PC, or on a reference object if you prefer. For an NPC you're talking to, set it on the owner of the conversation, which in this case should be Valen, which means that you can leave that field blank, since it defaults to the owner.


One caveat -- I'm not absolutely sure that a local variable saved on a companion will persist after a module transition, but I have a relatively high degree of confidence that the companion saving, despawning, and respawning functions are built to deal with that, because it's an important matter. So, as long as the companion transitions are handled correctly, I believe it should work. (This can be tested.)


If you don't want the player to be able to abort a conversation by hitting escape or leaving and possibly break some conditions, select "Multiplayer cutscene" in the conversation properties. Simpler that way.

Edited by Tchos
Link to comment
Share on other sites



It looks like there are some more scripts there that aren't showing in your screenshot.


ga_party_add: Adds Valen to your party. May not work if he's not already on the roster, and I don't think he is.

ga_global_int: The one it's setting is purely for conversation checks to see if he's already agreed to join you. You don't need this if you're checking to see if he's joined you in other ways.

ga_reset_level: This is supposed to set the NPC to the PC's level and give the appropriate amount of experience. It's necessary to give the NPC XP at the beginning so that s/he can level up normally. Otherwise, s/he will not gain any XP. I haven't used this particular script, and do it differently, but it looks like it should work.

ga_roster_selectable: Determines whether you can use the party roster UI to add or remove Valen from the party. You have it set so that the player cannot add or remove him, so it can only be done by script (such as in a conversation that uses a script)

ga_roster_campaign_pc: In the OC, all companions that are available in the game are pre-added to the roster, but also set to "campaign PC", which means that they do not appear on the party roster. The original purpose of the setting was to add NPCs to the roster that you needed to persist across modules with everything intact, but which should not be added to the party. But you can also use it to hide companions from the player's roster until it's time for them to join. Valen probably wasn't already added to the roster, and he certainly wasn't already set to campaign NPC, so you don't need this, but you do need to add the script that adds him to the roster before you use the party_add script. See the Deekin conversation I modified to see the script to add him to the roster.

Link to comment
Share on other sites

From where I'm bringing him in (just inside the crypt outside Highkeep) I'm afraid the other companions might start fighting while he's mid-conversation. That's why I wanted to add a check to make sure he says both lines of conversation, in case the PC has to stop talking to him for some reason.


I saw scripts to change the NPC from Immortal to not-Immortal, so I'm thinking (especially considering where I'm going to spawn him) that setting him to Immortal to start and using that script to switch will be a good idea.


Since you don't have a default hang-out in Highkeep yet, Valen has to be added without the ability to be removed in the beginning (a la Bishop/Khelgar/Neeshka) but if you decide you're tired of him by the time you get to Neverwinter, I'd like the PC to be able to leave him behind indefinitely. I want to increase the number of available companions in the party by +1, but I'm thinking that might mess with companion grouping later on. Not sure the best way to accomplish it, to allow Valen to be in your party as an additional companion no matter what stage of the story you're in.


By using local variables instead of global variables, it seems like I'd need to create those manually? Or is the local variable what I add in sVariable(String) beside the global script condition/action? Sorry, I'm trying to remember mod-making and scripting from ~10 years ago, and transfer that to the updates that were done in NWN2. Please forgive my ignorance.


Oh. And while his sound files play from within the conversation in the toolset, when I go to test the mod via Ctrl+F5, I'm not hearing anything. And his face has weird glitches, where his mouth is about a foot to the right of the rest of his body.

Link to comment
Share on other sites

There's a script to hide all hostiles in the area which you can use at the beginning of the conversation, and then restore them at the end of it. That'll prevent fighting from interfering with the conversation.


I'm almost certain that there are local variables in NWN1 too, even if there was no parameterised scripting. Just use ga_local_int instead of ga_global_int. (Or string, or float, or object, or whatever).


Usually, people would set him to Plot instead of Immortal. Immortal can take damage, and plot can't. Neither can die.


It won't break anything to increase the party limit by 1, but just so you know, the OC changes the limit several times over the course of the campaign (usually to increase it). It won't hurt anything, but if you want it to always be +1, then you'll have to find all the places in the OC where it's changed, and increase it by 1.


Also, you could check to see what the OC did whenever they forced companions into the party, or when Shandra was a free, extra companion that didn't occupy a slot of the limit, but also couldn't be removed. If you haven't played that far, though, you'd be wandering into spoiler territory.


How are you assigning the sound files to the lines?


Also, I never use the "test mod" option because I had some problems with it. I always launch the game normally.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

  • Create New...