Companion Project
v3.1
"Companion Project" style companion "template", but newer version.
Tribunal and/or Bloodmoon
required
This mod requires at least Tribunal to function. It should work equally well with just Bloodmoon though (or both)...
Please Read this. There is information in this about the mod that you'll probably want to know.
Changes from 3.0-
I have removed the second script text file that was included with the original and added a short tutorial to this readme for those who wish to create companions for release using this mod. The script in the text file was bugged a bit, and a couple of people had problems with it. Hopefully the tutorial in the "Misc." section below will simplify the process a bit.
One guffaw with the "one time move" section has been fixed.
Another modder's resource type of mod as is the earlier Companion Project mod.
Gives you a companion base from which to either create your own companion, or use in part or whole in the creation of your own mods.
Basically a more refined version of the Cally/Gabran (C/G) script that uses a different style of warping, but set up in a similar manner to the original "Companion Project" mod, although this script is not commented as was the one in CP. This one uses a newer "quick-warp" scheme that places the companion roughly 17 virtual feet behind the player when a warp occurs. C/G mods placed the companion less than one virtual foot from the player. Reason for this change is to make warping less noticeable during gameplay.
I also used a "ForceRun" section in the C/G scripts to minimize warping. Worked fine, but made them look terrible if used with other companions (they looked like they were on a pogo-stick). I was able to eliminate that problem with this newer warping system, so this one will behave more like a typical companion when used with other companion mods.
The original "Companion Project" warping system used a delayed warp, meaning that a period of time had to expire before the companion warped (8 seconds). On occasion, if the script had not timed out, it was possible for the player to loose the companion if they were too far from teleport types of devices (doors most notably) when/if the player activated such devices. Problem here was that you needed to turn and insure that companion was close enough every time you used a teleport device.
This mod is similar to the C/G mods in that it uses a "quick-warp" scheme to eliminate any delay during normal wandering. In other words, if a CP companion got stuck, you would have to wait a few seconds for the warp to occur whenever a warp became necessary. This one has no delay during normal wandering, meaning you can play the game without having to constantly check to insure that companion is close enough to accompany you through a door, siltstrider, etc..
Rough guess on the maximum distance that a companion can be from a teleport device for a successful teleport is 1000+ game units (near 50 virtual feet). I've tested it out to 900gu without problems and this companion should never be farther than 700gu from the player with the possible exception being during combat, eliminating this possible loss at doors, etc..
Two possible cases where you can loose this one: If you activate a teleport device during combat and companion is too far away (warping is disabled during combat), or if you should do the same shortly after combat (a six second timer is used here to allow the companion enough time to rejoin after combat is over). I should like to think these two instances would be extremely rare. To save confusion, this mod does employ a timed warp as does CP, but only after combat. During normal wandering the quick-warp system is used, so there are actually two different systems in use here.
Next thing to fix to insure good following ability was a minor problem of them leaving their weapons out after combat was over. "GetWeaponDrawn" is the script function used to disable warping during combat (you don't want them to warp during combat..), so if they leave their weapon out after combat is over, warping is essentially broken. This is a known game bug. Although this doesn't occur often, it does happen, and when it does, you can loose the companion if you don't notice it.
Section of script for "auto-sheathing" of all weapons is used to fix this. This section uses the sounds that weapons make when swung or shot to check and see if combat is over. If no weapon sounds are heard after a 4 second interval, a short section of script runs that equips a silver dagger, and when this happens the companion correctly sheathes their weapon (dagger is immediately removed from inventory after this event). This was used in the C/G mods, but was done for melee and thrown weapons only. Bow and crossbow sounds have been added to this one, meaning that all weapons are now covered by this "auto-sheathe" section.
Slight hitch: If companion has to move a distance that takes longer than the defned 4 seconds to enter combat, the auto-sheathe will fire. In-game, this will look like they have broken stride and that's about it. They will re-draw their weapon and continue pursuit. On a really long run, they can do this a couple of times, but it does not affect their performance during this event, and they will successfully engage the opponent. Like I said, just looks like a missed step if you see it.
I have to shut this auto-sheathe off during levitation as well. Because of this 4 second timer, they will continually reset to the player's "z" axis if they attempt to enter combat. If they should happen to leave their weapon out after combat while levitating, there is a command in the "combat" section of dialog to get them to sheathe.
Upshot here is that this companion should be very near 100% in following ability, but act more like "normal" companions in compairison to the C/G mods. Given this, you can now turn more of your attention to the game instead of having to check on companion all of the time to insure that they are following correctly.
Probably the best thing about this version that will affect modders who would want to use this in their own mods is that I have put everything into two scripts: One main script, and one leveling script. I've heard from some who are not enamored with the leveling script I've used, so I thought this the best way to go about it. Also, the C/G mods used several sub-scripts to accomplish a few things, making it difficult to apply to other companions. This one should be fairly easy to use when compared to those.
If you wish to disable the leveling script, either remove, or comment out (;) the following lines from the main script (in red bold (ONLY these lines)):
near the top-
if ( MenuMode == 1 )
if ( GetPCSleep == 0 )
return
endif
endif
about a third of the way down-
if ( GetCurrentAIPackage == 3 )
if ( GetPCSleep == 1 )
StartScript 1gr_comp2Level
endif
Once this is done in the main, the leveling script itself can be deleted as well.
No references are used in either script, so either a copy/paste of the script(s), or modification of this mod, with appropriate ID change should work fine for released mods. And please use unique IDs for your characters if you do use this script in a released mod to prevent conflicts with other companion mods. It probably wouldn't hurt to rename the scripts themselves, either.
Appropriate changes should also be used in dialog. If two mods have identical topics, then there will also be conflicts, so, for instance, where I have used "-combat", you should change that to something else: "-combat mode" for instance (anything, as long as it is unique).
I would also strongly suggest that the top section of the script be left intact. There are several return lines whose placement is crucial to correct functioning of this mod. There are notes in the script near the bottom that define where additions should be made if so desired. Variables can be added as well.
Guard stuff:
This version is guard enabled. What this means is that the companion will attack creatures on their own without being prompted. When using any other class for companions other than guard, there are only three reasons they (companion) will enter combat (what I term "prompts"): The player is attacked; the player attacks, or they (companion) are attacked (very rare). The guard class uses a different (hard coded) AI that dictates that they will attack creatures that are in the process of attacking the player.
In order to keep the companion from arresting the player if the player breaks the law, a unique greeting has been used in the "0" slot of the "Greetings" category in dialog. When the game engine searches for appropriate greetings, it starts at this "0" section and runs through all of them (9 is the last) until it finds a correct greeting for the current condition. By putting this unique greeting at the very top of the "0" slot, it gets hit first, and the game engine never makes it to the greetings that the guards typically use ("5" slot), thus she will not arrest you if you do wrong...
You will still see some guard type topics appear, but they will not affect the mod. I have used the "NoLore" option to eliminate most of these topics, which also gets rid of any topics that are not specifically assigned to the companion, but there are a still a few that the "NoLore" variable does not affect. It should also be noted that if you take the companion to Solthsteim, they will then have the full assortment of topics. Apparently none of the lore topics used in Bloodmoon are affected by the "NoLore" variable. I could have removed all topics not covered by the "NoLore" variable by using the "NotID" function in dialog, but there are many. I probably would have missed some, and using this type of approach greatly increases the size of the mod.
If you want to use this guard option in a mod, and need to add new greetings, then make sure that you add them to the top of this "0" slot. If you do not want to set them as a guard, then set their class as you please, and use the "5" slot (typical) for your greetings (make sure to remove the greeting I've used in the "0" slot if this is the case).
Note that by using the guard class they will only attack hostile creatures, not NPCs (code dictated).
Many thanks to Emma for this dialog tip.
Standard fare:
-companion share
-auto levitation
-auto water walking
-auto sneak
-CE water breathing ability to insure that they won't drown.
-CE 1 point per second restore fatigue
I did this because I've noticed that these companions run a lot when normally following, and that saps their fatigue. This probably isn't the best solution, but it was a lot easier just creating a simple CE ability than doing a bunch of scripting.
-CE swift swim ability
This one to keep them from warping repeatedly while swimming behind the player.
Auto-Leveling:
This mod makes use of an auto-leveling system that I've used for some time. There is nothing in-game to tell you that the companion is leveling, but it works just the same. Every time the player successfully rests, the leveling script runs and makes compairison checks against the player's stats to see if any changes have occured. If there have been changes, then adjustments are made. Attributes are at or near those of the player's. Both armors and weapons are changed according to the player's level.
Attributes example:
If the player's strength is 60 and it increases to 61 then the leveling script will adjust the companion's strength accordingly:
short p_strength ;declared variable
set p_strength to ( ( Player->GetStrength ) * 0.85 ) ;this statement sets the variable to the defined level (player's strength x 0.85)
setStrength p_strength ;this statement then sets the companion's strength to that defined in the statement above
In this case, the leveling script sets the companion's strength to 85% that of the player's, so if the player's strength was 60, the companion's was 51. If the player's strength is increased to 61, then, on a successful rest, the companion's strength gets increased to 52. Note that strength is the only one of the attributes that is set as a percentage of the player's attribute. The others are equivalent to the player's attributes. This is to show that such a system is easily changed, so if you were to increase the 0.85 to 1.25, then the companion will have 1.25 x the player's strength. This operation can be done for all attributes as well as health, etc.. Also note that there are two different "short variables" used for the attributes, so similar adjustments should be made for both. I did this to insure that the stat only goes up and never down. Reason for this is that if the player gets hit with a damage strength spell in-game, thus loosing a percentage of his/her strength, then rests, the leveling script would tell the companion to adjust their strength down. Not desireable...
Armor and weapon skills are done a bit differently. They add a number to the player's level to get the desired skill level for the companion. The player's level was the only number I could come up with that would be the same across the board for all classes of players. If I had set the weapon and armor sklls according to the player's skills, and the player was a mage class with a 5 skill in weapons, then companion wouldn't have been very effective.
Weapon/Armor example:
short p_longblade
set p_longblade to ( ( Player->GetLevel ) + 35 )
setLongblade p_longblade
...gives the companion 36 for a longblade skill if the player is level 1 (35 + 1) and 45 if the player is level 10 (35 + 10). This works effectively at low and mid levels, but gets just a bit uber at higher levels: Player at level 70 yields 105 longblade (70 + 35).
Armors use the same setup except 45 is added to the player's level.
All weapons use 35 + player level and all armors use 45 + player level. She will be as adept with longblade as she will be with a spear, and will use heavy armor as effectively as she will light.
I've used this system ever since it was introduced in "Companion Project", and it is effective in keeping the companion viable throughout the course of the game.
This system is based on Ulfgeir's speed and athletics boost that was introduced in the "Slave Warrior Jessica v1.3" mod.
Combat:
-Melee only
-Marksman only
-Player match
This one causes the companion to mimic the player's weapon usage during combat. Works for melee and marksman only. Example: I typically start a combat sequence with a ranged weapon and then switch to a melee weapon when the opponent gets close enough. When you use this option, the companion will do the same provided thay have both types of weapons in inventory.
-Use what you want
Allows the AI to control weapon useage.
-Sheathe your weapon
Used in case the auto-sheathe fails (during levitation sequence).
Follow:
-Standard stuff...
Others:
Auto-move
This mod uses an auto-move function if so desired. This can be toggled off or on via dialog. What it does is cause companion to ALWAYS move if too close to the player. If you have this enabled and companion is in your way, mearly bump into her and she will move. There is a caveat here: If the companion is moving, they are not in follow mode, so you can loose them at teleport devices. If you use this option, make sure that companion is stopped before activating these types of devices. Eye candy, mostly...
One-time move
Similar to that used in Dixon's "Hilda" mod. This simply puts the companion in wander mode for 4 seconds and then right back into follow mode again.
Take a healing potion
If her health is below 70% you can command her to take a healing potion, but only the standard in-game potions, and she has to have at least one of these in inventory. If she has no healing potions in inventory, she will tell you so. If her health is above 70% she will tell you that she is fine and doesn't need healing at present.
Tribunal (and Bloodmoon) include a function that dictates that if a NPC (or creatures in some cases) have a healing potion in inventory, that they automatically take it if their health falls below a defined point. My own guesstimate is that this occurs at 30% remaining health. This will also hold true for this companion. One hitch with this: They will continue to consume healing potions, nearly every frame, until their health rises above the 30% mark. This means that if you give them 10 restore health potions and their health falls below that 30% mark, they will probably consume all of them at once. This problem has been delt with via script in some mods ("Partners" I think for one), but not in this one. I would suggest that you only allow companion one healing potion at a time and that potion should be commensurate with their (your) level, so if they are low level with 55hp, then a standard healing potion will work fine, but at higher levels, you should give them one of the stronger potions instead. You will want to give them another healing potion if you use this option and only allow them to carry one at a time (recommended).
If you do allow them to carry several healing potions of varying types, and then tell them to take a healing potion via this option, they will take the best one they have in inventory.
I was a bit reluctant to include this because it involves both dialog and a section in script (a bit complex in relation to the rest of the dialog), but there have been times companion was at low health, I didn't want to rest, and wanted her to take a healing potion. This helps a bit in that respect.
Note that her current health will be reported whenever you open dialog with her (I think Dixon did this too, but this is my own version, and it gets reported as a percentage of max health.).
Late addition: While testing, I noticed that companion's strength was degenerating whenever I would leave her alone and change cells after a rest period. Problem was that she had "Yellow Tick" disease which I was unaware of. It is important to understand this sequence of events (rest/put into wander mode/cell change), because the leveling script will set her strength to where it should be during a successful rest, but once the player and her are in different cells, the disease effects show up again, and you will notice this depleation at that point, and this condition will continue until something is done about it.
I was unaware of the possibility of NPCs contracting these diseases up to this point. What I did (suggestion by Emma) was give her restore and cure capabilities (found in this "-others" section), so you can fix this problem should you happen to notice it. Notice it... There's the rub. I could script for all of these disease and curse spell effects, and have a messagebox display if she were to beome "infected", but this current script is already quite large, and I would hate adding that much to it for something that is going to happen rarely, and there is nothng in dialog that will detect if an NPC is diseased (PC yes. NPC no.), so you're going to have to keep an eye on her strength (companion share shows strength) and see if you notice it going down. If you do, simply run these two commands (restore and cure) to fix her. You should run both, because there are different diseases and curses. Couldn't put them all into one spell because the "restore" spell used up all available slots (attributes). Emma also suggested that I not try having her cast both at the same time (both in one results box). We aren't sure if both will work if used this way. I suppose you could also do this on a regular basis (daily???) as well, and that would insure that they would be up to par.
Installation and useage:
Unzip to your C:\ folder, NOT DATA FILES! "Companion_v3.esp" this readme, and one other .txt file. Make sure the .esp is enabled in the "mods" section of the splash screen. If manual placement is desired, just put the "Companion_v3.esp" in your data files folder.
Note that this companion is NOT in the game. To get her there, make sure the mod is enabled, then pull the console in-game with the tilde key (~), and type the following:
placeatpc 1gr_comp3 1 0 0 0
...then hit the "enter" key.
(PlaceAtPC, ItemID, count, distance, direction)
Make sure the syntax is correct when you do this. Spaces ARE necessary.
She will auto-level on initial encounter.
Performance:
As far as I can tell, this mod costs about 2 to 3 frames per second on my system (P4 2.8gig with ATI 9600pro). For compairison, the original Companion Project cost about 1 to 2 fps and the Cally/Gabran mods were in the 4 to 5 fps range.
Miscellaneous:
If you want to use this mod to create you're own companion, and want to use a unique head, then please visit this site: http://www.gamersroam.com/emma/faq.htm for instructions. Lot of other good things there as well, including Emma's companions and many other great mods (including Emma's heads).
I'm going to try a short tutorial here on creating your own companion for release. If you just want to modify this mod for your own personal use, don't bother with this.
Suggestion is to use the mod as it stands, but you will need to make some changes to keep the mod from conflicting with other companion mods that use this, or similar methods.
This kind of bounces around a bit, but stick with me here and make sure you follow these instructions in the order that they are laid out and hopefully this all goes well. If it doesn't, please feel free to PM or email me. This is off the top of my head, so I may have made a couple of guffaws here or there. If I did and you let me know about them I will make appropriate changes to this section.
Dialog window is accesed from the "dialog bubble" icon.
Script window is accessed from the "pencil" icon.
1- Change the names of the topics:
-Open the mod up in the editor.
-Click on the dialog icon to bring up the dialog window.
-All of the topics used in this mod are at the top of the list... You will need to change them all...
-Take combat for instance: The reason it's at the top is because I used a hyphen in front of the name: "-combat..."
-Notice the three periods at the end of it... This is to insure that the topic is unique if used with other mods...
-You will also need to insure that your topics are unique as well.
-As an example, you could change "-combat..." to "-use of arms".
-In the topics list, click on the original topic once, then click on it a second time (not a double-click).
-An edit box appears, and you can now change it to what you wish.
-Change the rest to something unique also.
-VERY IMPORTANT!!! Once you rename these topics, you will also need to change the appropriate "AddTopic" lines in the main script.
-You will find these near the bottom of the main script.
-Remember that syntax is everything in script.
-These need to be EXACTLY the same as the names of the topics used in the dialog window or they won't show up in the game.
-Click on the script icon.
-A grey script window will open.
-Click on "Script" in the top left corner of the script window.
-Click on "Open"
-Select the "1gr_comp3Script" from the pull down box.
-Make the appropriate changes to the "AddTopic" lines.
-Once you are finished, click on "Script" again and then click "Save".
-If you're syntax on the topic names is incorrect here, the script will not save, and will give you an error message informing you that it cannot find the topic you have specified. Remember that syntax (spelling, etc.) has to be exact...
2- Open the property sheet of the character and make applicable changes:
-Find the character in the NPC tab of the Objects window.
-Double-click to open the property sheet.
-Change the ID of the charater.
-I use "1gr_" on all of my companions now to insure that the ID is unique.
-"1" to keep the NPC at the top of the NPC list, and "gr_" is simply the first two letters of "Grumpy".
-Change it to whatever you like, but make sure it will be unique.
note: Emma and I have had our differences about this, but from what I've seen if you change the topics BEFORE you change the ID, as has been outlined here, then the filtering for the ID that is used in dialog should automatically reflect the change to the ID name. In other words: Once you change the ID of the character and then save it, the correct ID should appear in the "Speaker Condition / ID" section of the dialog window. But... Check this once you have saved the new ID to insure that this is indeed the case. If it's not, mearly change the "Speaker Condition / ID" to the appropriate ID of the character.
-Change the name of the character to whatever you wish.
-You may change the race to whatever you want.
-You may change the class to whatever you want, but be advised that if you change it from the "Guard" class the character will no longe exhibit the guard characteristics as mentioned above.
-Change head/hair/sex to whatever you wish.
-Finally, check the spells section of the property sheet. There are three abilities that I have added to these guys: 1gr_comp2_swim, 1gr_comp2_wb, and 1gr_comp2_fat. The first insures that they will keep up with you while swimming without warping too much. Second is the companion's water breathing spell which keeps him/her from drowning, and the last one is a restore fatigue spell that keeps the companion from loosing too much fatigue while following. If you change the race of the companion, the editor will remove these spells from the spell-set automatically, so you'll need to add them back in again. Find them in the "Spellmaking" tab of the "Objects" window and just drag/drop them back into the spell-set window.
3-Make applicable changes to the scripts:
-Click on the script icon.
-A grey script window will open.
-Click on "Script" in the top left corner of the script window.
-Click on "Open"
-Select the "1gr_comp3Script" from the pull down box.
-Change the name of the main script: I use "1gr_comp3Script". Change this name to whatever you wish to insure that it is unique.
-Change the name of the leveling script as it is in the main script.
-This needs to be done in two different places.
-About 2/5ths of the way down in the main script you will see the following:
if ( GetCurrentAIPackage == 3 )
if ( GetPCSleep == 1 )
StartScript 1gr_compLevel
endif
-The line in bold above is the one you want to change, and agian, change it to anything as long as it's unique. Example:
if ( GetCurrentAIPackage == 3 )
if ( GetPCSleep == 1 )
StartScript MyCompLevel
endif
-Near the bottom of the script you will see the following:
if ( addOnce == 0 )
AddTopic "-combat"
AddTopic "-follow"
AddTopic "-others"
StartScript 1gr_compLevel
set companion to 1
set addOnce to 1
endif
-Change the line in bold to the exact same thing that you changed the first instance to (example):
if ( addOnce == 0 )
AddTopic "-combat"
AddTopic "-follow"
AddTopic "-others"
StartScript MyCompLevel
set companion to 1
set addOnce to 1
endif
note: At this point it gets a little tricky. If you were to try and save the main script at this point, it would give you an error message stating that it could not find the leveling script whose name you have now changed. What you want to do is open the leveling script in a second script window. Same procedure as above.
-Open a second instance of the script window by clicking on the script icon.
-Select "Script/Open" and then select "1gr_compLevel" from the drop-down list.
-You will need to change this name in two separate places:
At the very top of the script, change:
begin 1gr_compLevel
...to the exact same thing you renamed it to in the main script, so it might look like this (example):
begin MyCompLevel
...and bear in mind that spelling (syntax) have to be exact here...
-Now you need to go to the very bottom of the script and change the second instance of the name:
StopScript 1gr_compLevel
-Change this to (example):
StopScript MyCompLevel
-Now you can save the level script. You will probably need to save it twice. On the first save you will get an error message stating that the script name used in the "StopScript MyCompLevel" line could not be found. Just click on ok, then save it a second time. The new script name (MyCompLevel) is not a valid script name until it is saved the first time, so the name in the "StopScript" line is invalid, and that's the reason for the error. Once saved the first time, it then becomes valid, and a second save compiles the script just fine.
-Once saved, you can close the script window for the leveling script.
-Once this one is saved and closed, you can now also save/close the main script as well.
note: Once you change the name of the main script and save it, you will need to re-assign it to the companion. Open the property sheet again, click on the now blank "Script" window to get the pull down box, and then select your newly named script.
4-Once all of the above is completed, you can go ahead and close up the property sheet and save the mod.
As a final note, I strongly suggest that you open the mod up in TESAME and insure that it is clean. Just make sure that the old topic names have been removed. If they haven't, simply delete them with TESAME, and hopefully at this point you have a useable, clean companion mod.
Best of luck.
Credits and thanks:
-Emma for her continued support, friendship and advice
-Devlor and Reznod for great help on the original Companion Project mod (forebearer of this mod)
-Ulfgeir for the SWJ mod on which much of this mod and my previous mods are based
-Mana User for his understanding of a completely sensless question
-Simpleton for the math solution used in the "warp-behind" section
-Vorwoda the Black for his inspiration during my involvement with GYO and script help with the Cally/Gabran mods
-Ronin for his support and testing
-Sunsi for being Sunsi... (support and testing also...)
-and probably a hundred or so others (mostly from the CS forum) who have contributed to the creation of not only this mod, but many others as well
As with all of my mods, use at your discretion. Permission for useage is not required.
Dennis
aka Grumpy
grumpymods@lovkullen.net
|