COMPANION SYSTEM
-----------------------------------
UPDATE
----------------
Multiclassing of companions added.
DESCRIPTION
----------------
This little system helps setting up companions in a module. No scripting is needed. In fact, even in the conversation there is no need to alter any of the conditionals or action taken scripts. Just add your text and remove the unneeded nodes.
By default, this system functions like the OC companion system. But you could alter some behaviours through the "inc_companion_system" script. See there for additional info.
NEW: Multiclassing companions.
Setting up a companion step by step
----------------
It's easy: Make your companion in the tool set or use a given blueprint. You can import the companion scripts in the properties, by selecting import and there the companion script set.
Give your companion an unique max. 10 characters tag.
Duplicate the base conversation, rename it, type in your text and remove the unneeded nodes. For the behaviour like in the OC, the only node needed is the "Join first time" node. All other nodes should be removed. All nodes are duplicated, just to make it easy for you, to choose the structure you like (should the PC ask to join or the companion).
Give your companion this conversation.
Place the companion somewhere in your module.
Setting up a base camp like in the original campaign
----------------
Make your area. Now place a waypoint for each of your companions in the area. That are the spots, they will stand on in the base. This waypoints must be tagged like this: "COMP_tagofcompanion".
Attach the "a_companion_system_oe" script in the areas OnClientEnter(!) slot and the "a_companion_system_ex" script in the areas OnExit slot.
Put the "pl_companion_system_oc" script in the OnClicked slot of the door leading out of your area. For the door to beeing clickable, just give it a transition type.
Place a waypoint tagged "COMP_AREA_EXIT" where exiting the area should lead to.
Multiclass Companions
----------------
This system now supports multiclassing companions. You have to set the mode you like in the "inc_companion_system" script in the Init function. There is also a function called "LevelUpCompanion" in which you could enter the code for the level up of the companions. See the script for examples.
If you are not familiar with scripting, you will find an erf named "companion_blueprints" in this zip. If you import this erf, you will find some premade companions. You could alter this blueprints, as long as you keep the tag and do not change any of the classes, feats and skills. The mode is set to MODE_MULTI_CLASS. This are the sample companions: Bard/Dragon Disciple/Fighter, Rogue/Assassin, Ranger/Wizard/Arcane Archer, Fighter/Weaponmaster, Fighter/Dwarven Defender, Barbar/Blackguard and Rogue/Shadowdancer.
Mode Packages
----------------
Mode packages are sets of flags for a specific behaviour of the companion system. Of course you could set each option seperatly in the Init function in the "inc_companion_system" script, but these packages are a more easy method to set a predefined behaviour.
If you have set a new mode, you have to recompile all the companion scripts. You could do this through file->compile->all.
MODE_ORIGINAL_CAMPAIGN: This sets the system to function like in the original campaign.
MODE_MULTI_CLASS: As in the OC, but multiclassing companions are possible. The companions are leveled up to the level of the PC. Multiclassing thereafter is possible through dialog.
MODE_MULTI_CLASS_PLAYER_CONTROLLED: Companions are added at level 1 and given the XP of the player. The player can manually advance the companion and multiclass it as above.
MODE_NO_PLAYER_CONTOLLED_MULTICLASS: Multiclassing companions are used and the player has no control over the level up process. If he levels up, the companions do so automatically or, if they were not in the party at level up, through dialog. This mode is a little more complicated. Look in the script to see, how it is set.
Installation
----------------
Just import the erf throug file->import and follow the above instructions.
Alternative System
----------------
By changing the NO_GUI_SELECTION mode in the "inc_companion_system" script, you could use a system like in NWN 1, disabling the GUI-Selection and add and remove companions purely through conversation. See the script for more details.
Posted by Lifaen at 2011-04-20 18:12:42 Voted 10.00 on 04/20/11
Nice job! I'm using this in my current project. Thanks very much
Posted by alupinu at 2011-02-14 16:51:41 Voted 9.75 on 02/14/11
Great system just what I was looking for! Thank you... :) _________________________ Murder in Dunlop Fanglewood
My Class is Rogue ... "You look surprised to see me. If you'd been paying attention, you might still be alive."
Posted by spoe71 at 2010-01-03 20:08:30 Voted 10.00 on 01/03/10
nevermind my last post--problem is solved. I made a noobish naming mistake that I did not catch after two proofreads.
Superb system. very easy to implement.
Posted by spoe71 at 2010-01-03 19:44:03 Voted 10.00 on 01/03/10
It seems I am behind the times as I post here (since the last comments were so long ago). If you're still around, I am curious of an issue I am having.
It seems when I add the pl_companion_system_oc to the OnClick event of my door, it disables the transition to the outside area.
I tried making a transition to the waypoint specified in the readme (comp_area_exit) and I tried making it a door-to-door transition.
The party selection screen comes up, but everything stops there--my party does not transition outside.
Any thoughts?
Posted by Alleyslink at 2007-08-22 19:03:16 Voted 10.00 on 08/22/07
Dick Loraine is dead. Long live dickloraine!
I did not want to reinvent the wheel when I added companions to my mod. I wanted a system that worked reliably and was easy to implement. I messed around with other systems available on the vault but I don't like adding HAKs, and since I know how to write a campaign variable I found it unnecessary. Your system met all my criteria. Thank you very much. _________________________ Lands of Intrigue Castle Spulzeer || Dungeon Crawler DC1
Posted by WARLEADER6 at 2007-07-03 17:31:35 Voted 9.75 on 07/03/07
Hey Dickloraine, great scripts. I thank you for these. I was wondering however if you could help on something. I am not much of a scripter. in MP, for client on exit,...how can i make it if a character logs off with companions in his or her control, the companions will be reset? any help on a script is much appreciated
I have found an error in the action taken scripts. I haven't actualized all parameters. Even if there is a default parameter, this could have been the issue. I have updated the files, to remove this.
Unfortunatly however, I wasn't able to reproduce the crash. On my system there aren't any problems. Therefore it is very difficult for me, to nail down the problem. I hope, the above error caused the crash on some systems, but I'm not that positive. _________________________ Dick Loraine is dead.
I also found that it crashes when talking to companions. This is using 1.04. To verify: within the toolset run the module, add a companion and talk to him, use the world map trigger to go to the tavern room, return to the base camp, and then try to talk to the companion again. This causes a crash.
Thank you for creating that file for me! I will try it out and let you know if it works. One of my main companions is a cleric and I would be thrilled if he could multiclass as a warpriest. Another companion is a bard and it would be great if she could multiclass to a harper agent. I was happy that you already had a red dragon disciple since the player will have a companion with that class in a later chapter of my trilogy. By the way, I am using the 1.04 version. _________________________
Gaming Parents Studios - Currently working on A Time to Die Act I and Into the Forgotten Realms
Vault Submissions: Movie Trailer of A Time to Die | Unicorn Run Prefab **NEW**
Okay. But NWN shouldn't crash if you speak to the premade companions. At least on my system these companions do function. But maybe the LevelUpHenchman function is more broken as I thought and on different systems it does different things? Do you have patch 1.04 or an older patch? I tested it only for 1.04.
If you are new to scripting, I should mention another little thing, maybe this is already clear for you, but you have to recompile all the companion scripts if you alter the include. You could do this through file->compile all. _________________________ Dick Loraine is dead.
I did try the script in my module and it crashed the game several times (when I tried to talk to one of the sample companions and when I tried to get my own companion to join.) That was before I tried the coding above so I will tinker with the scripting you mentioned to see if that helps -- I didn't know I needed to add that coding for the warpriest/cleric combo. Thanks for including that and I will let you know how it turns out! By the way, I am a complete newbie when it comes to scripts so it may take some time for me to work it out. :) _________________________
Gaming Parents Studios - Currently working on A Time to Die Act I and Into the Forgotten Realms
Vault Submissions: Movie Trailer of A Time to Die | Unicorn Run Prefab **NEW**
Oh, there is another possibility. If your module is for a specific level and you know at which level the PC will get the companion, you could of course add a premade companion of the appropiate level. Use the following modes (not a package): ALLOW_MULTICLASSING and COMPANION_LEVELS_UP. If the PC is of a higher level, he could now advance the companion manually. BUT: If the PC is somehow of a lower level, SetXP will give the companion fewer XP as his level and NWN 2 WILL CRASH. So this is a little bit dangerous. _________________________ Dick Loraine is dead.
Yes, you have to code them. Unfortunatly, the LevelUpHenchman function is an old function from NWN 1. In that old times, you couldn't select the spells for prestige classes which added spellclasslevels. Therefor multiclassing with such prestige classes is broken. The spellbook will be non functional.
So just try it with your combinations. The sorcerer/duelist should function without problems. The cleric/warpriest could be more difficult. What you could try (and for divine casters this should function) is to advance the character one level below the player and let the player level up the last level of the spellcasting class. This is a little dirty, but maybe it will function.
This is a function that will do this job, use it just as the LevelUpToPC function:
void LevelUpToPCCastingClass(object oTarget, object oPC, int nClass, int nLevel, int nPackage = PACKAGE_INVALID)
{
int nCurrentLevel = GetLevelByClass(nClass, oTarget);
int nPCLevel = GetHitDice(oPC) + GetLevelAdjustment(oPC)-1;
int nCurrentHD = GetHitDice(oTarget) + GetLevelAdjustment(oTarget);
if (nCurrentLevel < nLevel && nCurrentHD < nPCLevel)
SetLevelUpPackage(oTarget, nPackage);
The code for your warpriest would be looking like this:
else if (sRoster == "co_warprie")
{
LevelUpToPC(oCompanion, oPC, CLASS_TYPE_CLERIC, 7, 158);
LevelUpToPCCastingClass(oCompanion, oPC,CLASS_TYPE_WARPRIEST, 10, 160);
LevelUpToPCCastingClass(oCompanion, oPC, CLASS_TYPE_CLERIC, 20, 158);
SetXP(oCompanion, nXP);
}
Thats a little dirty, but maybe it function. For arcane classes on the other hand, I'm sceptically. Hopefully obsidian fixes this problems in some new patch... _________________________ Dick Loraine is dead.
I am trying out your script system since I would love it if several of my companions could multiclass in my module. If I have other multiclass combinations that I want to use, do I need to code them individually into the inc_companion_system script as you have with arcane archer etc? I wanted to use a cleric/warpriest and sorcerer/duelist among other possible combos. _________________________
Gaming Parents Studios - Currently working on A Time to Die Act I and Into the Forgotten Realms
Vault Submissions: Movie Trailer of A Time to Die | Unicorn Run Prefab **NEW**
10 - A Masterpiece, Genuinely Groundbreaking 9 - Outstanding, a Must Have 8 - Excellent, Recommended to Anyone 7 - Very Good, Deserves a Look 6 - Good, Qualified Recommendation 5 - Fair, Solid yet Unremarkable 4 - Some Merit, Requires Improvements 3 - Poor Execution, Potential Unrealized 2 - Very Little Appeal 1 - Not Recommended to Anyone