From 6baa5da6c96789f24ac02ff050f203dcaeaec27a Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 6 Aug 2019 21:30:21 +0200 Subject: [PATCH 1/2] Fix scripts not executing on respawn --- apps/openmw/mwclass/creature.cpp | 6 ++++++ apps/openmw/mwclass/npc.cpp | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwclass/creature.cpp b/apps/openmw/mwclass/creature.cpp index 4c50634e0..fd89ef4a3 100644 --- a/apps/openmw/mwclass/creature.cpp +++ b/apps/openmw/mwclass/creature.cpp @@ -27,6 +27,7 @@ #include "../mwworld/containerstore.hpp" #include "../mwphysics/physicssystem.hpp" #include "../mwworld/cellstore.hpp" +#include "../mwworld/localscripts.hpp" #include "../mwrender/renderinginterface.hpp" #include "../mwrender/objects.hpp" @@ -844,7 +845,12 @@ namespace MWClass if (ptr.getCellRef().hasContentFile()) { if (ptr.getRefData().getCount() == 0) + { ptr.getRefData().setCount(1); + const std::string& script = getScript(ptr); + if(!script.empty()) + MWBase::Environment::get().getWorld()->getLocalScripts().add(script, ptr); + } MWBase::Environment::get().getWorld()->removeContainerScripts(ptr); ptr.getRefData().setCustomData(nullptr); diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index f22ac06b9..02f06c1df 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -1,4 +1,4 @@ -#include "npc.hpp" +#include "npc.hpp" #include @@ -37,6 +37,7 @@ #include "../mwworld/customdata.hpp" #include "../mwphysics/physicssystem.hpp" #include "../mwworld/cellstore.hpp" +#include "../mwworld/localscripts.hpp" #include "../mwrender/objects.hpp" #include "../mwrender/renderinginterface.hpp" @@ -1376,7 +1377,12 @@ namespace MWClass if (ptr.getCellRef().hasContentFile()) { if (ptr.getRefData().getCount() == 0) + { ptr.getRefData().setCount(1); + const std::string& script = getScript(ptr); + if (!script.empty()) + MWBase::Environment::get().getWorld()->getLocalScripts().add(script, ptr); + } MWBase::Environment::get().getWorld()->removeContainerScripts(ptr); ptr.getRefData().setCustomData(nullptr); From ff41302c696d87ddb38988a664c82872fd3d0b33 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 7 Aug 2019 10:59:56 +0200 Subject: [PATCH 2/2] Add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index da0aaa762..aa4f03420 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -120,6 +120,7 @@ Bug #5104: Black Dart's enchantment doesn't trigger at low Enchant levels Bug #5105: NPCs start combat with werewolves from any distance Bug #5110: ModRegion with a redundant numerical argument breaks script execution + Bug #5123: Script won't run on respawn Feature #1774: Handle AvoidNode Feature #2229: Improve pathfinding AI Feature #3025: Analogue gamepad movement controls