diff --git a/apps/openmw/mwlua/types/npc.cpp b/apps/openmw/mwlua/types/npc.cpp index 83e51c1b89..f2d78610eb 100644 --- a/apps/openmw/mwlua/types/npc.cpp +++ b/apps/openmw/mwlua/types/npc.cpp @@ -248,6 +248,9 @@ namespace MWLua }; npc["setWerewolf"] = [context](const Object& obj, bool werewolf) -> void { + if (dynamic_cast(&obj) && !dynamic_cast(&obj)) + throw std::runtime_error("Local scripts can modify only self"); + const MWWorld::Ptr& ptr = obj.ptr(); if (!ptr.getClass().isNpc()) throw std::runtime_error("NPC or Player expected"); diff --git a/files/lua_api/openmw/types.lua b/files/lua_api/openmw/types.lua index b5c57f289e..ff07f8dce3 100644 --- a/files/lua_api/openmw/types.lua +++ b/files/lua_api/openmw/types.lua @@ -1095,9 +1095,9 @@ -- @param openmw.core#GameObject actor The NPC or player to transform -- @param #boolean werewolf True to transform into werewolf, false to transform back to normal -- @usage -- Transform player into werewolf in a global script --- types.NPC.setWerewolf(player, true) +-- player.type.setWerewolf(player, true) -- @usage -- Transform self back to normal in a local script --- types.NPC.setWerewolf(self, false) +-- self.type.setWerewolf(self, false) --- -- Returns the read-only @{#NpcRecord} of an NPC