Category:Troubleshooting

Revision as of 13:49, 14 September 2007 by imported>Dev akm (→‎Common Mistakes: moving to its own page)

Troubleshooting Introduction

This is a collection of articles on troubleshooting 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)



Common Bugs

These are annoying problems with the CS and game engine.

Vanishing Landscape in a New Worldspace

This general 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 occurs whenever the current modindex for the plugin differs from the modindex of the plugin during creation in the CS (because the end-user's load-order will rarely be the same as the load-order during creation). This usually means that the only way to get the plugin to work in-game is to make it the very first thing that loads after Oblivion.esm, which is a terrible limitation.

TES4Gecko now includes a Move Worldspaces function to help deal with this issue by "injecting" new worlspaces into the 00 modindex.

See this ESF thread for the discussions that led to this solution.

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.

This problem is fairly common with mods that do a lot of inventory manipulation, such as ingredient sorters.

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

Activating an object every frame

This didn't cause a CTD with me, but as it causes unpredictable results there is a chance CTD's might occur.

When you have a script that constantly activates a certain object (in my case, to wait for a result that was published inside that object and could be retrieved in this way), other scripts might become unresponsive. I had several onadd blocks in other scripts that weren't executing anymore.

If you have to do this, build in a timer.

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 )

Performance Problems

This section is intended as a place to list performance problems and tips, especially those related to scripting.

Gamemode Scripts

Avoid using gamemode scripts wherever possible. Use quest scripts if you can, or try to find ways to put as much of the script work into OnLoad, OnEquip, and ScriptEffectStart blocks as possible.

If you need to use a GameMode block, use an 'if' test or a flag so the code will only run when necessary. For instance, if you need to run an item script whenever the player hits a switch, place this on the switch:

scn YourSwitchScript

short Working

begin onActivate
  set Working to 1
end

and this on the item:

scn YourItemScript

begin GameMode
  if YourSwitchScript.Working
...
  endif
end

CPU-Hungry Script Functions

Generally, scripts have little affect on FPS, especially compared to graphics. However, if run every frame there are a few functions that will cause a noticeable (>1) drop in FPS:

  1. GetSecondsPassed
  2. GetNumItems (OBSE)
  3. GetInventoryObject (OBSE)
  4. GetFPS (OBSE)
    • However, you can run this every few frames without a drop. This is most useful as an alternative to GetSecondsPassed as ((Number of frames passed) / GetFPS) approximates the amount of time passed.
  5. GetDistance
    • I have tested the others above, but not this one. However, I have seen it mentioned several times that GetDistance is a CPU heavy function, so I'm including it here.
    • --Haama 17:54, 10 September 2007 (EDT)

Note that for all of these, they are incredibly fast functions. Even the slowest, GetInventoryObject, can be run 1000 times and the next frame will come up in less than a second. They will only cause problems if run them constantly (every frame or so).

The main problem with CPU-hungry scripts comes from Oblivion's "brick-wall" for FPS and script processing. Scripts won't touch FPS until you hit a certain limit, and then even a few extra small scripts can start dropping FPS.

See Code Optimizing for more details (in planning/progress).

AI Overload

If you use advanced AI on a lot of NPCs or creatures, the game may start to suffer from so-called "AI overload", causing NPCs and creatures to fail to process their AI as you approach them. This can do nasty things like giving roadside bandits a lobotomy -- they just stand around and do nothing as you approach.

Creatures that are swimming seem to put an extra large burden on the system, possibly because the pathfinding is trickier in the water?

Low-Level Processing

Avoid low-level processing for as many creatures and NPCs as possible. Use the "No Low Level Processing" option to keep them from processing their AI unless the player is in the same cell.

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

Helpful Programs

TES4Edit
Wrye Bash
TES4Gecko

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.