Project

General

Profile

Bug #4289

Script compilation fails if an NPC deleted in a content file is disabled

Added by Good Better 3 months ago. Updated 23 days ago.

Status:
Confirmed
Priority:
Normal
Assignee:
-
Category:
Scripting
Target version:
-
Start date:
01/10/2018
% Done:

0%

Reproducibility:
Always
Operating system:
Other
Severity:
Normal

Description

One of mods, which I tried, deleted several NPC's from game world, but left untouched calls in scripts like "Deleted NPC ID"->Disable.
Such scripts still works in vanilla game, but fail with runtime errors in openmw:

Execution of script test_ref failed:
unknown ID: caius cosades

To better illustrate problem, I made an example mod. In vanilla mw, though I have deleted reference to Caius Cosades from his home, such start script worked and message box was shown:

begin Test_Ref
    short doOnce
    if (doOnce == 0)
        set doOnce to 1
        "caius cosades"->Disable
        MessageBox "Hello there!" 
    endif
end Test_Ref

In openmw, I got aforementioned runtime error.
I'd like to suggest handle such cases more gracefully, and dont stop script execution.

OpenMW version 0.43.0
Revision: b86118f76f

test_disable.ESP (5.28 KB) Good Better, 01/10/2018 11:49 AM

History

#1 Updated by rot tor 3 months ago

If it's any help, target calls like

"NPCID"->

that are compiled in CS scripts only target the instance placed in the CS, which is not truly deleted in vanilla when SetDelete 1 is used. I found that it only deleted other instances created by scripts (PlaceAtMe, PlaceAtPC)

#2 Updated by scrawl . 3 months ago

not truly deleted in vanilla when SetDelete 1 is used. I found that it only deleted other instances created by scripts (PlaceAtMe, PlaceAtPC)

We already have this behavior. But there is a difference between deleting at runtime (SetDelete) vs. deletion by a content file. In the latter case, IIRC openmw will completely remove the instance on loading, because that made things simpler and I didn't realize there would be any use in keeping it around.

That things still run in vanilla might also be down to non-existent error checking (i.e. "some_random_never_existing_id"->disable would not throw errors, either?)

#3 Updated by rot tor 3 months ago

"some_random_never_existing_id"->disable would not throw errors, either?)

Some errors are not checked but that's not exactly one of them: if the ID doesn't exist or doesn't have a CS instance vanilla would throw an error on compilation, and if the script is still run ingame it targets "disable" on the caller instead.

#4 Updated by scrawl . 2 months ago

Some errors are not checked but that's not exactly one of them: if the ID doesn't exist or doesn't have a CS instance vanilla would throw an error on compilation,

There can't be a compilation error if the plugin that deletes the ID/instance is not loaded while editing.

and if the script is still run ingame it targets "disable" on the caller instead.

... so that means no error, and a random behavior instead. Wouldn't 'disable' on the caller have a high chance to break the whole quest or whatever?

#5 Updated by Alexei Dobrohotov 23 days ago

  • Subject changed from script execution fails after applying disable func to deleted npc to Script compilation fails if an NPC deleted in a content file is disabled
  • Status changed from New to Confirmed
  • Reproducibility changed from Have not tried to Always

Also available in: Atom PDF