Category:Troubleshooting

From the Oblivion ConstructionSet Wiki
Revision as of 13:31, 9 July 2007 by imported>Dev akm (→‎Introduction: removed draft status, revised intro)
Jump to navigation Jump to search

Introduction

This is a collection of articles on TES IV problems -- gotchas, common mistakes, CS bugs, etc. The basic ideas and topics were originally discussed in this ESF thread.

These topics could be organized in a lot of different ways, but for now we can start with a simple list.

I've created it as a category so we can add more specific topic articles in the category.

What follows is essentially a long list of some common mistakes and their effects on players and/or the CS. Please suggest more ideas if you can.--Dev akm 17:56, 20 February 2007 (EST)

CTD (Crashes)

Nested If Versus And

Don't assume that if-tests stop at the first non hit. For example,

 if (myref.isactor and myref.isincombat)

could cause a crash because myref.isincombat is always checked, even if myref isn't an actor. Use a nested IF statement instead.

Existing Object Names as Variable Names

Don't use existing object names as variable names. The existing ones get priority. If you write:

 ref bed
 set bed to ThisBedref
 player.moveto bed

this will probably cause a CTD because 'bed' is also a topic id and will get priority here.

Other possible mistake names: enemy, accept, contract, creatures, gift, help, inventory, positions, placeholder, tasks, themage.

Quest Targets

Deleting a quest target will crash the CS. You can get around this by setting the conditions so that it's never displayed.

Referencing Deleted Objects

It's easy to cause a crash by using a reference to an object that was deleted, or, in some cases to a dead actor.

For example, when using GetSelf in ScriptEffectUpdate or ScriptEffectFinish blocks for area of effect scripted spells, GetSelf can point to a dead body

This will cause a crash if you try a function that requires the object to be an actor, or even null if a summoned creature has been killed in the area.

Bow Reach Bug

This bug is fairly well-known but still crops up on occasion. The game will CTD if a bow with Reach = 0 is equipped by anyone (player or NPC). Some of the vanilla Oblivion bows have this problem, so be sure not to replicate the error in your mod.

Activate Self

When you script an object

  1. to Activate itself
  2. from a block that continously runs (i.e., GameMode, MenuMode, etc.)
  3. and not bypass the OnActivate block, as such:
begin GameMode
Activate player, 1
end

begin onActivate
...

you can cause an CTD. It seems that self-activation causes the entire script to run from the top, including the GameMode block, and so will Activate itself infinitely. You can prevent this by placing the OnActivate block before the self-activation, as such:

begin onActive
...
end

begin GameMode
Activate player, 1
end

Activating a Container

If you meet all of these conditions:

  1. Activate a Container, so that you run it's OnActivate block, that is:
YourContainer.Activate player, 1
  1. from an Object Script (and maybe a Magic Effect Script, but a Quest Script or direct activation would be safe)
  2. when a scripted item is in it (even a Scriptname declaration is too much)

you will get a CTD upon activation. The easiest way around it is to place the script on another object (an Activator, etc.) and activate it instead of the container. You can also use a Quest Script to activate the container, as such:

scn YourOpenerQuest

ref   rContainerToOpen
float fQuestDelayTime

begin GameMode
  if (fQuestDelayTime != .01) ;to activate the container quicker
    set fQuestDelayTime to .01
  endif
  rContainerToOpen.Activate player, 1
  StopQuest YourOpenerQuest
end

and use this whenever you want to activate a container:

scn ActivatingScript
set YourOpenerQuest.rContainerToOpen to YourContainer
StartQuest YourOpenQuest

Common Mistakes

These are things that all mod-creators should know not to do.

AddTopic Dialogue Bugs

Even though it's well-known and documented in the wiki, the 'add topic' bug regarding dialogue continues to be is one of the most common mistakes mod-creators make.

If two or more mods try to alter the same topic, only the changes in the mod loaded last will take effect. This causes serious problems because the GREETING topic is shared by all NPCs.

The problem occurs even if you have removed unwanted GREETING dialogue from your NPC.

Motub has written a detailed description of the AddTopic problem with steps for solving it.

Also, you should avoid having a topic added by both a script and in the AddTopic box. This can sometimes cause problems where NPCs may suddenly start conversing with you from far away, through objects, etc., as if they had been given a "forced greeting" directive (i.e., StartConversation).

Moving the addtopic lines out of the NPC's script and into the topic's result script box will avoid the issue.

Persistent Doors

Vanilla doors can't be moved in mods without incompatibilities with most existing savegames since their position is stored in the savegame data once you come near them. Modders should try to avoid moving doors from the original game.

Changing Script Variables

This issue is best summarized in Wrye's ESF thread Overriding Scripts and CTDs based on discussions started in MentalElf's ESF thread In desparate need of a save game editor

This info really hasn't made it into popular circulation yet.

Savegame Bloating

Your savegame contains info about changes to the gameworld. The more changes that occur, the more info that needs to be saved, thus the bigger your savegame file becomes.

One big culprit is the placeAtMe function. New objects that are created in the world using placeAtMe never disappear. This is particularly a problem with mods that use invisible activators to cast spells at the player or enemies - you end up with lots of invisible activators which are no longer used but persist in the savegame indefinitely.

Items stored in inventories are another common culprit, especially with the negative item count bug mentioned below.

Avoid Using PlaceAtMe

It's very surprising that there's no mention of this issue whatsoever in the high-profile tutorial Casting Spells From An Activator, which apparently gives very bad advice by giving script examples that will leave garbage in your savegame.

Unfortunately, using disable doesn't remove the reference from your savegame. It's mentioned on the Etiquette page, but this is a pretty weak warning:

  ... avoid using PlaceAtMe to create new copies of an object when you could simply use MoveTo on an existing object.

The PlaceAtMe page has a good warning and the Talk:PlaceAtMe page has some additional details, but these issues are not mentioned in the places where people really look for answers (i.e., tutorials), so I'm not sure how effective this is.

Quite a few mods still use this technique to repeatedly place hidden activators near the player when a MoveTo would work just as well without any negative side effects.

Perhaps the reason this issue hasn't been more widely discussed is that it's just not as easy to use MoveTo on a persistent object as it is to use PlaceAtMe/disable on a temporary reference. There's some discussion about this on the Talk:MoveTo page, but it's far from being concise or clear.

We really need a good tutorial on how to properly use MoveTo instead of PlaceAtMe/disable.

One of the main issues with MoveTo is that the collision shape doesn't always move with the object. Calling disable after moveTo, and then enable a frame later, may fix this problem.

The bloating caused by PlaceAtMe is not as severe as some of the other problems, but a single mod using it repeatedly can still add several megabytes to a savegame over time. If you have several mods that all do this, it starts to add up rather quickly.

Avoid Using DuplicateAllItems on a Companion

This seems to be by far the major offender in savegame bloating problems.

Some Companion Share mods have caused outrageous savegame bloating problems by using DuplicateAllItems excessively. The most common example is a mod using DuplicateAllItems (duplicating them to a duplicate of the NPC) in order to calculate and display encumbrance. If any of the NPC's items are scripted items, then they become permanently duplicated (and impossible to destroy) every time the DuplicateAllItems call is made. Since that call is made every frame while the companion's inventory screen is open, you get bloat very quickly (tens of megabytes in a few seconds).

Instead of duplicating items, you can use RemoveAllItems to transfer items to the companion and then back. That does fix the original bug (scripted items don't cause bloat anymore), but it still leaves the negative items bug with RemoveAllItems (see below).

Avoid Using RemoveAllItems on a Companion

This can also cause savegame bloating problems, but it is easier to avoid than the DuplicateAllItems issue.

Calling removeAllItems on an actor or container that has a negative count of one or more items will cause those items to be duplicated. Negative quantities mean the item is restocked when it's depleted.

You can avoid the problem by not giving the companion any items with a negative quantity.

So, you should avoid doing:

 NPC.RemoveAllItems NewContainer

then

 Newcontainer.RemoveAllItems NPC

on a NPC that has a negative item count. This doubles the items every time you do companion share. That means that the NPC will have 65536 items of a kind after 16 shares, 16777216 items after 24 shares and 4.2 bilion after 32 shares. Serious bloat!

Don't Do These Things

Here's a list of more things to avoid:

  • Don't ever hit the CS button "Recompile All"
  • Don't run "Generate All" pathgrids or "Generate Entire World"
  • Don't try to copy things from one ESP into another ESP unless the items come from Oblivion.esm
  • Don't modify cells in Oblivion.esm in another master.
  • Don't modify cells by accident. Cells not intentionally changed by your mod shouldn't have an asterisk next to them (use TES4Gecko to "clean" your mods before release)
  • Don't use underscores in primary resource filenames. Underscores are reserved by the game for finding various file types, such as normal maps (xxx_n.dds), glow maps (xxx_g.dds), etc.
  • Don't use full paths when creating retextured items. Texture paths need to be relative to the Data folder, not higher (not C:\Program Files\...)

Tips

  • Package mods so they can be unzipped in the Data folder without extra subdirectories.
  • The README should be named ModName-README.txt so as not to overwrite existing READMEs from other mods.
  • .7z (7-zip) is the currently preferred format for mod distribution [This can cause a debate, but new modders need to know about it.]

Avoid Using Common IDs

Although this is less of a problem in Oblivion than it was in Morrowind, it's still good advice.

Do not create objects or variables with generic names, such as "SECRETPASSAGEDOOR". Use a unique identifier that you prepend/append to the name of the stuff you create, such as: "IchininSECRETPASSAGEDOOR".

This will make your mod less likely to collide with other mods when merging.

Vanishing Landscape

This problem is also listed under Common Bugs because it can also be caused whenever the current modindex for the plugin differs from the modindex of the plugin during creation in the CS. In this case, however, it happens when you try to use an ESM to alter the landscape for another master (such as Oblivion.esm).

The easy solution?. Never use a master to modify another master.

Game Settings

Game settings are not like global variables. If you use

set SomeVar to fiSomeGameSetting

your script will save, but won't run in game. You have to use the GetGameSetting function, as such:

set SomeVar to (GetGameSetting fiSomeGameSetting)

Common Bugs

These are annoying problems with the CS and game engine.

Vanishing Landscape

This problem is also listed under Common Mistakes because it can also be caused by using an ESM to alter the landscape for another master. In this case, however, it is occurs whenever the current modindex for the plugin differs from the modindex of the plugin during creation in the CS. This usually means that the only way to get the plugin to work in-game is to make it there very first thing that loads after Oblivion.esm.

There are workarounds and some good proposals for solutions, but few certain answers so far. See this ESF thread for details.

Remove Item

The 'remove item' function doesn't work properly with more than one item sometimes. The in-game message (produced by the game) is correct, but the number of items the player loses is not. For example, you may get the message '5 ogre teeth removed', but only 3 were actually removed from your inventory. This happens randomly, no matter which item you remove or how many 'remove item' functions (or other functions) you use in a single frame.

Oblivion Realm Resets

Whenever the player closes an Oblivion gate, the entire Oblivion cell and everything inside of it is reset. This includes inventories of containers and NPCs, and for NPCs their spell list and location. It may also be possible that variables on world objects (containers, NPCs, activators, etc.) are also reset. These two threads have more information and tips to avoid the problem: [1] [2]

See post 96 in the Gotchas! thread in the CS section of The Elder Scrolls Forum for links to threads containing more information and tips to avoid this problem. (sorry I can't just put in the links, something's not working quite right)

Adding Multiple Items with the Same Script

There are some oddities (well, the right words for it I won't use here) when you

  1. add two or more items
  2. with the same script
  3. to the same container
  4. at or about the same time.


This seems to happen for several situations:

  • You add an item, which in turn adds another item
    • So I would guess it also includes using AddItem for two separate items
  • An item that runs when the player adds them to a container, or the player takes them from a container
    • For example, if you have 2 of an item in a container (same base object), and the player double-clicks them, thus adding one after the other, you'll hit this bug
    • But using 'AddItem SomeItem 2' seems to work without hitting the bug

are some more examples
What exactly is going is anyone's guess, and the problems that can occur are very, very bizarre making them hard to trace. Also, the bug seems to be intermittent, sometimes working and sometimes not, and some scripts don't seem to run into the problem. The a few points to take away from this:

  • Adding two or more items with the same script can produce weird results
  • If you're adding multiple items and getting weird results, put a frame or two between when you add one and when you add the other
    • In the right situation, you can avoid the problem by changing the Scriptname of the items
  • If there is a possibility of the player running into this situation, be sure to test for it

Debugging

When something just isn't working right, look here for possible causes.

Comma Instead of Period

This can cause severe headaches for the scripter: The compiler will accept a comma in place of a period in reference syntax, but the script will silently fail in the game when the line is encountered.

 player.modAV health 200 <- Fine
 player,modAV health 200 <- Suddenly your script is no longer running and you're wondering why

Easy to miss when you're looking for logic errors.

Numerals

Don't start an ID or variable with a numeral.

 short 5forFighting; BAD
 long benFolds5; GOOD!
 myGuy.moveTo 0marker; BAD

Mismatched If/Endif

The compiler will ignore extra endifs when you save your script, but they can cause the script to stop running when encountered during gameplay. Make sure each if in your script is paired with exactly one endif:

if ( something == happened )
  do something
endif ; GOOD
endif ; BAD, extra endif may cause errors in the game

The best way to avoid this problem is to use proper indentation of if-blocks.

Quest Topic Scripts

The Scripting section in the Quest/Topic editor seems to be for very generic scripting like setting global variables and doing things like setstage. Be aware that while some things may compile clean here and seem perfectly fine, they just don't work in-game.

Getself != player

Be careful if you use:

 Getself != player

When called in a scripteffect spell, the statement sometimes evaluates true for the player. The easiest solution is to add another condition to double-check it, such as:

 getdistance player >0

However, getDistance is unreliable if the player is swimming. The best solution is to use:

 ref refVar
 set refVar to getSelf
 if ( refVar.getIsReference player == 0 )

Obscure Problems

These issues don't occur very often, and we don't even really know what causes them, but they hurt nonetheless.

Pathgrid CTDs

Does anyone really know why the pathgrid CTDs happen? The last thread about it I remember didn't find a solution.

This is an older problem that plagued both UL and OOO for a while. Basically, changing pathgrids is risky and requires a lot of testing to avoid CTD issues. I didn't find any surefire solutions for this either. Does anyone know if this topic has been written about in any more detail than the introductory Path Grid Generation article and Path Grids (simple)?

Black Screen Bug

This is the Infamous Nvidia + HDR Black Screen Bug.

This bug can usually be fixed by the mod-creator. It is usually caused by problems in a custom mesh. This can happen if the mesh creator forgot to assign a valid material to part of the mesh. It can also happen if you have an opaque texture assigned to a transparent portion of your mesh. It can even sometimes be caused by a standard shader like the GhostEffect.

It can also usually be solved by updating the tangent space of certain mesh nodes in a .nif file. NifSkope has a spell to do this.

Once you've narrowed down which .nif is causing the problem, simply open it in NifSkope, right-click each NiTriStrips/NiTriShape node and select Mesh -> Update Tangent Space. This works most of the time.

Related Articles

Subcategories

This category has only the following subcategory.

S

Pages in category "Troubleshooting"

The following 11 pages are in this category, out of 11 total.