I'm not really a Morrowind modder. Morrowind modders are like hackers, only for Morrowind and its Construction Set. I'm intimidated by their highly technical discussions on how to produce a certain effect that should be easy to produce, only the gamemakers, having made an RPG, thought that fans would want to create RPG-type mods with a few monsters to kill, some treasure to snatch, perhaps some dialogue and text for the diary. What fans in fact want to create is a complete personalized virtual playground using Morrowind's game engine. It's a bit like how Maxis underestimated the kind of customization that Sims fans wanted to make. Morrowind is slightly worse: firstly, not all syntactical features are covered in the helpfile, and some are broken. Secondly, conditions that should be easy to test for, are not. Take swimming. When a character is deep enough in water, the wading animation changes to a swimmming animation. So the game "knows" the character is in water. Now I need a script that asks "is the character swimming or not" because I've added a bottle that can be filled with water, but only when there is water near, and water is certainly very near when you're up to your neck in it. Well, even though the game "knows", there is no way of asking it. The only, very roundabout, way of knowing if your game character is swimming, as I learned on a forum discussion concerning a bathing mod, is to ask the game whether any of the splish-splash swimming sounds are being played. For your own character, that is. I don't know how I would go about testing this for a companion character. (I do now.)
What I am is, in all senses of the word, an amateur. The game booklet said I could add and change things, so I did. Or rather, I tried to. I made a relatively easy mod to set things right concerning a certain Fargoth, and embarked on a much more difficult mod to teach the arrogant Dunmer (or rather, one arrogant Dunmer) a lesson in humility, which I soon became stuck on. I don't even know if I'll ever finish it. But in the course of doing so, I educated myself on scripting, mostly through version 9 of the fan-written Morrowind Scripting for Dummies (MSFD9) and discovered a few things, not all of them mentioned in this document. So, for anyone surfing on the quirks of Morrowind modding, I thought I'd share.
After using the latest patch and finding out it wasn't really the latest
patch (which means some quirks may have due to not having used the most
up-to-date executable) I've split the list up into real quirks and technical
issues.
Technical issues:
Modding quirks:
Back to technical issues |
Back to technical issues |
The Siege at Firemoth plugin
The official plugin "Siege at Firemoth" causes problems with a lot of
fan-made plugins. This doesn't mean that there is anything wrong with the
fan-made plugins. I'm still thinking what to do about that. Changing the file
date to make that plugin load last hasn't helped. (The problem mysteriously
resolved itself, see DaysPassed turns up in Morrowind-only
installation.)
Back to technical issues |
Game lag in Windows 7
I thought this was a problem caused by playing an old 32-bit era game on a
computer with a 64-bit processor and a 64-bit version of Windows 7, until I
found I had a 64-bit processor and a 32-bit version of Windows 7. I'm still not
sure what the exact reason is, but it has to do with "rundll32.exe". Usually,
the game starts without problems. Sometimes, I have to click the icon twice
before the game runs, and it will be slow and choppy, a Desktop gadget showing
the CPU at 100%. Using Ctrl-Alt-Del to find what was running, I saw that the
process hogging the CPU was "rundll32.exe". Deleting this process did not stop
the game, but sped it up to its normal framerate. So I found a workaround: start
Morrowind (click icon twice if necessary), this opens the Morrowind Launcher.
Open the Task Manager and delete the "rundll32.exe" process. Then start the
game.
I revisited this problem when I wanted to install the Morrowind Script
Extender. This is as simple as putting the MSE executable in the same directory
as the Morrowind executable and clicking the MSE executable, which will then
start Morrowind. If I clicked the MSE executable, nothing happened; if I then
clicked the Morrowind executable, it would start, but crash if I wanted to start
a new game (as there were no save games to load). So I looked again at what
happened if I started the standard Morrowind: first "rundll32.exe" is run but
exits, it runs a second time and stays in memory this time, then the Morrowind
Launcher opens and the game can be started from there. If I don't use the
Morrowind shortcut but double-click on Morrowind.exe, the game starts directly
without loading "rundll32.exe", and without lagging. So the problem is the
Morrowind Launcher. Fortunately, the textfile included with the Morrowind Script
Extender explains how to make a shortcut that will bypass the Launcher and start
Morrowind directly.
Update: I've found that Oberon Media
games ran slowly under Windows 7 because Windows was constantly checking for
a network connection; disabling all network devices in the system settings
solved the problem. It also seemed to solve the "rundll32.exe" problem with the
Morrowind Launcher, although I haven't tested that further because nowadays, I
only run the game directly from "Morrowind.exe", and only start the Morrowind
Launcher to change what mods are loaded, then shut it down again; neither causes
lag, and I get to keep my internet connection.
Another update: having bought a new laptop with a 64-bit processor and
installed a 64-bit version of Windows 7 on it, I get the "rundll32.exe" problem
rarely, if at all; the game may take a bit of time to start, but even if I click
its icon twice, the first instance doesn't hang in memory but simply quits with
a "game already running" message.
Back to technical issues |
Back to technical issues |
Back to technical issues |
Back to technical issues |
Back to technical issues |
Back to technical issues |
Back to technical issues |
Back to technical issues |
Back to technical issues |
Back to technical issues |
DaysPassed turns up in Morrowind-only installation
It is common knowledge that the global variable DaysPassed only exists, and
is only kept up-to-date by the game engine, in installations that include
Tribunal. Having created, on a new laptop, two side-by-side installations -
plain Morrowind, and Morrowind plus both expansion packs - from the Elder
Scrolls Anthology (as opposed to the Morrowind GOTY pack that I'd used to
install the games to an older laptop), and added all of Bethesda's official
plugins and the Unofficial Morrowind Patch, plus a few essential mods like
legible signposts, I found that not only did the Siege at
Firemoth plugin suddenly work without problems in both installations, but
plain Morrowind had a global DaysPassed (seen by using "showvars" in the
console) and it was being updated, too! I opened Morrowind.esm and the
Unofficial Morrowind Patch and mods in the TESCS to see which one had added this
global, but none of the data files displayed it. So how and in what file was it
fixed? I'm baffled.
NB. Along with the global DaysPassed, some scripts use a local variable
daysPassed, which, by being declared local, hides and blocks the value of the
global variable from the script, because you can't have a local and a global
variable with the same name. Morrowind simply chooses the local over the global
and lets it slide, but OpenMW, up to version 0.39, seems
to have a problem with this, given that scripts using the local daysPassed (the
ones that make Maurrie and Nelos elope, and put Glathel in Gadayn's shop) are
not working.
Back to technical issues |
TESCS, Morrowind and GOTY
The TESCS that comes with the original Morrowind does not ask to save a
changed plugin before reloading. The TESCS with Morrowind GOTY fortunately does.
The GOTY TESCS also lets me indicate which journal line is the quest title,
and which line is the quest ending. This is for the ordered display of quests
which was so sorely lacking in the original, and was introduced in its
expansions. The space used for these indications is space left blank in a
Morrowind-only journal, so a plugin with journals created in the GOTY TESCS can
probably be safely used in plain Morrowind, providing that the plugin does not
contain any Evil GMSTs (expansion game settings) or startscripts.
Here's something that both TESCS's do: I add a lot of dialogue for Fargoth,
about half of it also for the cell "Seyda Neen, Fargoth's house" since it has to
be said in the privacy of his own house. I filter all dialogue for "fargoth" to
check it. The dialogue that is also connected to a place, like Fargoth's house,
does not show up. That's strange, because otherwise I get all Fargoth-related
dialogue, not only what Fargoth personally says, but also lines for anyone of
his race and/or faction.
I've read that the different TES versions compile animations differently
because the animations are coded in a different way internally not only between
Morrowind and Tribunal, but also between patched versions of the same game.
One funny thing that happened in the GOTY TESCS: I load a Morrowind-only
plugin, so of course the TESCS automatically adds all Tribunal/Bloodmoon GMSTs
(the so-called Evil GMSTs) to the file. Discovering this, I load it again, this
time with Wrye's "GMST vaccine" plugin which ensures that these GMSTs are not
added to the active plugin. Clicking on Data Files in the menu and then on
Details in the data files box, I select, and mark for deletion, all GMSTs in
what I think is my plugin, only there is a suspiciously large number of them,
and they cover many basic settings; yes, I didn't select my plugin properly, and
am now marking GMSTs in Morrowind.esm. The TESCS will not save changes made to
an ESM, but to be sure, I unmarked the deletions again before loading my own
plugin, marking the Tribunal/Bloodmoon GMSTs, reloading it and saving it to be
rid of those GMSTs forever.
Or so I thought. Because the next time I started a game, menu buttons
suddenly had "s" prefixed to them, for instance "sWait" in the sleeping menu and
"sGold" in the bartering menu. Extra "s" characters turned up in other places as
well, like the dates in the journal. I saved the game, quit, looked at
Morrowind.esm which did suddenly have today's date even if its size hadn't
changed, copied the original from a backup installation over it to be sure,
opened the TESCS again, chose my plugin and looked at the details. There they
were: all the GMSTs that I'd "deleted" from the Morrowind ESM, even if I'd
cancelled that action, even if they could never be deleted in the first place,
had been instantly added to my plugin, and it didn't even show until I'd closed
the TESCS and opened it again. Of course, deleting them solved the problem.
Again in the GOTY TESCS, although this probably applies to the Morrowind-only
version too: it's said that the script compiler is too lenient, which I'd
already discovered regarding GetDeadCount (see GetDeadCount and
the prefix) and not complaining about the use of local variables which do
exist, but were not declared in that particular script (see Local, global, targeted, variables, somewhere in the middle of
that big block of text). But when I checked all the scripts I'd made in
MWEdit, a fan-made editor which emphatically informs the user on startup
that it's a BETA, I saw the following three errors that the TESCS ignores:
I've since encountered two other really stupid mistakes that the TESCS script
compiler (both versions) let pass without comment, although the game rightly
balked at them:
if ( Condition = true ) ; AAGH! single "=" instead of "=="
set localvar to localvar + 1 ; should be "( localvar + 1 )",
game doesn't seem to mind
if ( Condition = true )
ModSomething 50
endif
; GAH! Extra endif not detected because there's no check whether if-
blocks start with "elseif"!
elseif ( OtherCondition == true)
ModSomething -50
endif
endif
Especially the third mistake can really break a script. MWEdit, given its
beta status, isn't perfect either; in targeted scripts it fails to see that
"mycompanion.RemoteLocalVar" might actually exist, it calls big outdoor areas
like "Ascadian Isles Region" not a cell and won't accept such a string with
PositionCell, and in the result field, it refuses to process any lines under a
"Choice" line, even if they have nothing to do with it, saying that you can't
process anything within a Choice function. Well, that is true: I did once try to
set a global variable to 1 in a result field line starting with "Choice", and
Check Errors reported that this global didn't exist, even though it clearly did.
if ( Variable <> 0 ) ; should be "!="
set Var1 to = ( Var2 + Var 3 ) ; unwanted "=" sign
The second was a stupid copy/paste mistake causing a "Set" error message,
the first was a matter of using an operator that the game engine does not
recognize, and alternately interprets as "greater than" or "smaller than",
leading to inconsistent behaviour.
Back to modding quirks |
Back to modding quirks |
Back to modding quirks |
Back to modding quirks |
Missing persons and scripts
An object, whether NPC or creature or anything else, cannot be referred to in
a script unless it has been put in the game with the game editor and is loaded
when the game starts, as anyone who makes a script to adjust the AI settings of
Ranes Ienith can tell. The TESCS shows that there are 0 references of him in the
game, and he is only dropped into it with a PlaceAtPC when his brother is
attacked. The only way to refer to them in a script is to place them in the game
and then find a way to make them disappear until they are needed. From Tribunal
onwards, they can be disabled in a user-made start script. In a Morrowind-only
installation, which runs only the game's own startup script, statics and
containers are best disabled by their own script, items are best inserted
on-the-fly with the PlaceAtPC method, and unique NPCs,
although they can clearly be inserted with the PlaceAtPC method, are best put in
some hidden cell and then teleported to the right spot from a global script or
dialogue box result field. Although using PositionCell to teleport a NPC into a
cell where the player is will result in a crash if the player then addresses the
NPC, because its dialogue hasn't been loaded yet, see Position
and PositionCell: observations.
Something else that can't be referred to in scripts: new instances of
persons. The first instance of a NPC, say Fargoth, may appear to be "fargoth"
but is in fact "fargoth0000" (I don't know exactly how many zeros, it might be
up to 8). If I create a new Fargoth in the console or in a script, that will be
"fargoth0001". The next one will be number 2. Andsoforth. And these instances
cannot be separately addressed in a script. I cannot, for instance, kill off
both copies and keep only the original. Which is understandable since, like
Ranes Ienith, these copies have not been placed in the game by the editor. It
might be that a script can refer to instances that are placed in-game
with the editor, like the many guard clones.
Back to modding quirks |
Missing objects and scripts
If an object ID referred to in a script doesn't exist or hasn't been placed
in the game (or was created after the script was opened for editing but before
saving the plugin file, see Script says it doesn't exist) then
of course the script won't compile in the script editor. If such an object is
referred to in the little script known as the result field, I can only compile
it with "Check error results", which, instead of giving an error message, shuts
down TESCS. Fortunately, I had saved the file before running the check and so
didn't lose any changes.
In this case, I used GetDistance on Aurane Frernis's three alchemical
formulas. The first lies on a table/counter. The second is in a chest. The third
is in her personal inventory. The second and third don't count as "placed in the
game" since they are only in an inventory, therefore, I can't use GetDistance on
them in a script.
Back to modding quirks |
Back to modding quirks |
Back to modding quirks |
Standard display variables
There are a number of standard variables like %Name, %Class, %Race, %PCName,
%PCRace. Using these in dialogue will see them replaced with the variable's
value in the game. So "I am %Name, %Class" will appear in the game as "I am
Yokel, Commoner" or "I am Fatcat, Merchant" depending on who says it. Now,
"dialogue", ie. displayed text, can also be put in the result field, using
"MessageBox" and the text string; the text will be displayed in a different
colour and the same variables can be used, but with a caret instead of a percent
sign: ^Name, ^Class, ^Race, ^PCName, ^PCRace. I haven't tested them all, but for
^PCRace, this does not work. No race was displayed for my PC, just "^PCRace".
Now this may have been because I didn't use the variable with MessageBox, but
with Choice, another command that displays text from the result field.
As said in MSFD9, ^Name will just display the value of ^PCName, so in result
fields the name of the addressed NPC should be used, while in a script a
paraphrase is needed ("your companion", "your slave"). ^Cell applies only to the
cell the player is in, and can't be used to locate companions gone missing.
Since it is strictly for display, neither can it be used in the following way:
"npcname"->PositionCell 0 0 0 0 "^Cell"
Too bad, eh. But see Position and PositionCell:
observations below.
Back to modding quirks |
Back to modding quirks |
Back to modding quirks |
Back to modding quirks |
Back to modding quirks |
Back to modding quirks |
Back to modding quirks |
Back to modding quirks |
Back to modding quirks |
Back to modding quirks |
Back to modding quirks |
Back to modding quirks |
Back to modding quirks |
Topics, the blue stuff
Making topics appear blue on time, so that they can be clicked on: I ask
Fargoth about "(The imperials have) taken everything", which sets my journal to
10, and he tells me he would die for some nix-hound meat, which reply leaves a
line in my journal, setting it to index 20. The topic "nix-hound meat" is
programmed to turn blue at journal index 20, but doesn't. This is because the
journal index is set to 20 after the dialogue is displayed, and the dialogue is
not updated to make an already displayed phrase turn blue. To keep the
conversation flowing smoothly, I have to program the topic "nix-hound meat" to
appear even before the journal index goes to 20, in order to make it light up in
blue when Fargoth mentions it. If another character has mentioned it previously,
it will now appear as a topic in the topic column even before Fargoth brings it
up, but fortunately he is the only one who does.
The dialogue is updated to change blue lettering back to normal
lettering when a topic is no longer valid, for instance, if I bring Ajira the
flowers she wants while she tells me to go to lake Amaya, my chances of finding
out more about lake Amaya are shot as the letters lose their colour.
See also Straight from the result field for the effect on
topic processing of letting a script add the journal entry.
If one plugin (esp file) has a certain topic, say "skills", and another
plugin has that same topic "skills" (though obviously with different lines) and
that topic does not exist in an esm (master) file, then the topic will only have
the lines of the last-loaded plugin. This means that a topic may no longer turn
blue when you expect it to, because it has been superseded by a newer version of
that topic with new conditions for when the topic is supposed to be blue. The
solution is said to be using "AddTopic skills" in the result field to at least
make the topic appear in the list of topics, although whether this will produce
the desired response is another matter. AddTopic can also be used in Fargoth's
example to make "nix-hound meat" appear in the topics list before it turns blue,
where hopefully the player notices it being added. Which may not be the case if
the list is already quite long and the topic starts with a letter way at the
back of the alphabet.
Speaking of modders' topics, an informal standard set by the "Got The Time"
plugin is to have completely generic but often used topics start with a double
dash, to place them above all other topics. I decided to adopt this standard
with the "Coordinates please" plugin.
Related to blue (ie. active) topics: if a topic's condition is, say, a
journal entry having appeared or a global variable having been set, then as long
as this condition is not met, the topic will simply not be active. However, if a
topic's only condition is Disposition, meaning, it should only appear when a NPC
likes the PC well enough, the topic will always be active, but until the
disposition is at the right number, the NPC will say things like "I don't like
you well enough to talk about that". So to make a topic rely on disposition yet
keep it absolutely hidden until the disposition is right, extra measures are
required.
Back to modding quirks |
Back to modding quirks |
Back to modding quirks |
Back to modding quirks |
Back to modding quirks |
Special local variables
This is a continuation of Local, global, targeted,
variables but was given its own header because that block is already quite
large. Most slaves in Morrowind have a local script called "slaveScript" which
keeps track of whether they are owned or freed. The slave called Yakov (found at
the Suran Slave Market) does not. So I made a script called something like
YakovSlaveScript and ran it targeted on Yakov. That's how I discovered three
things:
1. There are special local variables that can be defined in an NPC's local
script to give that NPC certain abilities: nolore, companion,
stayOutside. They can't be defined in a targeted script. Well, they can,
but they'll have no effect.
2. And, of course, if you define a local variable like slavestatus in
the targeted script and then make a response in the dialogue editor depend on
that variable, it won't work either because dialogue responses can only depend
on local variables in the local script of the NPC being interacted with.
Moreover, the variable can't be used in the result field. I tried something like
"MessageBox "Slavestatus %g" YakovSlaveScript.slavestatus", without success.
3. And, even more importantly, local variables from a targeted script can't
be queried by another targeted script. Makes sense, as both scripts are targeted
on an object (which does not have these local variables) and not on each other.
The other targeted script could do something with, for instance,
"YakovSlaveScript.nolore", but that way, it affects the script and not the
individual NPC (as opposed to the slaves with "slaveScript", who each have their
own instance of this variable). Not that it matters, as a targeted script is
still a global script and only one instance of a global script may be run at a
time, ie. there would be no other YakovSlaveScript running.
In vainly trying to give Yakov normal slave features (other than by adding
the slavescript to the NPC, a change that might be made undone by a newer plugin
changing, say, his appearance or abilities) I discovered, in an effort to add
choices to slave dialogue through a script that displayed the same choice
options after every response, what is mentioned in Local, global,
targeted, variables: local variables from a local script can only be queried
by a targeted script if the actor that the script belongs to is specified. As an
example, say I add companion and stayOutside to "slaveScript",
which means every slave can now carry my stuff and be told to wait outside. I
then add a dialogue topic "follow" with a response for Khajiit slaves (the
"third person" people) and other slaves. So I don't have to put the same list of
choices (including: "Follow, but stay outside") in the result fields of both
responses, I stick them in a script called "SlaveFollowChoices" (which
terminates itself as soon as it has displayed the choices) and put "StartScript
SlaveFollowChoices" in both result fields, which means the script is targeted on
the speaker. This script is run for every slave with whom the PC talks about
"follow" and so it uses the slave's local variable stayOutside (added to
the enhanced slavescript) without identification:
Most special local variables, particularly stayOutside, were added in
Tribunal. Another local variable added in Tribunal, specifically for Calvus
Horatius, a mercenary that the player can hire, is minimumProfit. This
variable keeps track of everything the companion NPC carries - both possessions
and money - that wasn't part of the companion's base equipment. Hm, so if I
created a companion with no money or possessions, but with "minimumProfit"
defined in its script, this would work like the function "PC Clothes Modifier"
which returns the value of what the PC is wearing, and so is zero when the PC is
naked. It wouldn't quite work because minimumProfit also counts
non-wearables and money; still, maybe this could be an easy way to check for
dialogue options like "PLEASE put on some pants".
It is not. The base value stored by minimumProfit has values added to
or subtracted from it when the player uses "companion share" to put things in or
take them out of the companion's inventory, but the base value itself is raised
each time something is added to the companion's inventory by an AddItem command
in a script or dialogue result field. For the average companion mod, that means
the base value of minimumProfit bounces all over the place, and
"minimumProfit == 0" says nothing about how much the NPC is wearing or carrying.
Special local variables that were not present in plain Morrowind, and would
therefore have no effect even if defined in a NPC's script, may be made to work
by importing the related GMST from Tribunal into the companion mod, even though
this GMST only holds the string value for the variable, and doesn't contain any
code. I understand that this is how a Morrowind-only companion mod can make
companion work, allowing the player access to the companion's inventory,
although I haven't gotten this to work yet.
if ( stayOutside == 1 )
instead of
if ( menelras.stayOutside == 1 )
since it should work for every slave. It won't. When the script encounters
this remote local variable, it stops running. I had to ditch the script and put
the choices directly in the result fields instead.
Back to modding quirks |
Back to modding quirks |
Back to modding quirks |
Back to modding quirks |
Back to modding quirks |
Back to modding quirks |
Back to modding quirks |
Back to modding quirks |
Back to modding quirks |
Back to modding quirks |
GameHour
The global variable GameHour wraps. All by itself. This occurred in Morrowind
with all expansions installed, and wasn't tested further, but this is what I
discovered through a script to advance the game time. If it's 23:00 and I add 2,
the game time automatically becomes 01:00 - no need to calculate the value.
Global variables pertaining to date - Day, Month, Year - also run from 1 to a
certain number and then go back to 1, although I haven't tested whether they
wrap around automatically when their value is raised in a script. According to
MSFD9, Month wraps around wrong in the game itself: it goes from its highest
number to 1, even though the first month's number is 0, so basically a month is
lost every year. Maybe this has been fixed in a fan patch, I haven't checked.
Because the aforementioned script calculated the date 8 hours into the
future, which meant that I also needed to know the new day if the 24-hour mark
was passed, and, due to wraparound, today's Day might be 30 and tomorrow's Day
might be 1, I used DaysPassed instead. This global variable, introduced in
Tribunal, keeps track of the days passed since the start of the game, so
tomorrow's value will always be higher than today's. It should also work in
Bloodmoon, but hasn't been declared there, so anyone who uses DaysPassed with
BloodMoon alone has to add it in the TESCS. Whether DaysPassed would be updated
by the game if declared in a Morrowind-only mod, I don't know. (In a test in an
older installation, it did not. However, see DaysPassed turns up
in Morrowind-only installation.)
Back to modding quirks |
Back to modding quirks |
Back to modding quirks |
Back to modding quirks |
How to make a NPC drink a potion
The short answer is: you can't. Neither in Morrowind alone, nor with
Tribunal. Apparently NPCs could be made to use a potion with Equip in Morrowind,
where the function is broken; I haven't seen this myself. In Tribunal/Bloodmoon,
where Equip does work, the PC can be made to "equip" (drink/eat) potions and
foodstuffs/ingredients, but not put on wearables, while NPCs can be made to
equip wearables (clothes and armour) but not potions - they are "equipped", ie.
separated from the stack like a worn item of clothing, but not drunk - or
scrolls, or ingredients/edibles, to which the same applies; and all "equipped"
scrolls, potions and ingredients are unequipped as soon as any of them are
lifted from the inventory via companion share. The only item type both PC and
NPC can be made to equip is weapons.
So, how about AIActivate? Apparently this can make NPCs open loaddoors and
pick up weapons. This function was likewise broken and said only to work with
potions before Tribunal, although it doesn't seem to work with potions at all. I
tested some situations and the results were inconsistent, probably because I
didn't know what I was doing: did the item have to be in the NPC's inventory, or
(as with loaddoors) outside and close to the NPC? AIActivate was said to make
NPCs pick up a weapon, which suggested the latter. In any case, AIActivate will
not work with a potion name (if the code was in the result field, an error check
in TESCS produces a message that a creature/NPC of that name can't be found; the
same message also appears when typing the code in the console) and won't do
anything while the dialogue window is open. In the console, while leading
Menelras (a buyable slave) around, I used PlaceAtMe to create a Scroll of Vigor
and "menelras->AIActivate sc_vigor" to make him pick it up and read it: this
caused a loop in which new scrolls were being opened for taking or closing (by
the PC!) all the time until the game crashed - because scrolls (like soulgems,
see What NPCs will and won't use) are always aimed at the PC?
Maybe that's why NPCs won't use scrolls that were not in their inventory when
they were created. When a potion is placed near the NPC and the NPC is told
"NPC->AIActivate potion" in a script, nothing happens.
On a potion in a companion's inventory, AIActivate seemed to work if there
was only one of the chosen item in the inventory. If it wasn't in the inventory
at all, then AIActivate didn't work unless I used AddItem to add something
different as well. To quote my (tidied-up) notes:
I took up the suggestion of MSFD9: make a spell that does the same as the
potion (which is a spell cast on the drinker) and use that spell instead, also
removing one potion from the inventory to give the impression of having used it.
There were several options:
What absolutely doesn't work: giving the NPC a weapon with a "cast once"
enchantment. Say, a sword that, each time it's wielded, makes the NPC's health
go up by 20. That would stack every time the sword was re-wielded, right? Just
make the NPC wield the sword with StartCombat, quickly followed by StopCombat to
nip the accompanying verbal abuse in the bud. Nope. Apparently such enchantments
can't be cast, least of all on self, except through a scroll, which NPCs can't
be scripted to use. Weapons only have "cast when used", so the NPC has to clock
someone, or "permanent effect" which is no use when simulating potion-quaffing.
Or there's the option where the actor casts a spell added to the spell list by
wielding/wearing an item (like Fargoth's healing ring), which actors also can't
be scripted to do.
Case: NPC has no potions in inventory, "NPC->AIActivate potionname".
The first time this is used, nothing happens. After a different potion is
added and used with AIActivate, it works. This seems to be reset by changing the
NPC's health from the console.
Case: NPC has no potions in inventory, "NPC->AddItem potionname 1", "NPC->
AIActivate potionname".
It works and the potion disappears from the inventory.
Case: NPC has no potions in inventory, "NPC->AddItem potionname 1", "NPC->
Equip potionname".
It works and the potion disappears from the inventory. (Equip should not
need AddItem, but else the encumbrance might be messed up.)
But then it didn't work any more, or maybe it never really had worked, so I
gave up and tried a different approach.
Back to modding quirks |