script execution fails after applying disable func to deleted npc
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
If it's any help, target calls like
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)
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?)
"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.