Hi,
the sound recording function does not work for me in HumanNPC v0.6.8.
I created a new recording using /npc_sound add kobani01, held the voice key and spoke, then used /npc_sound save. The recording is saved, but when the NPC is interacted with, the following error is always generated:
Failed to call hook 'OnEnterNPC' on plugin 'HumanNPC v0.6.8' (ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: startIndex)
at System.BitConverter.ToInt32 (System.Byte[] value, System.Int32 startIndex) [0x00010] in <41d29b352f6a475ab1bf7c6628b82790>:0
at Oxide.Plugins.HumanNPC.FromSaveData (System.Byte[] bytes) [0x0000e] in <1105daf5b94b4e59a2c5d374b8186923>:0
at Oxide.Plugins.HumanNPC+SoundFileConverter.ReadJson (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Object existingValue, Newtonsoft.Json.JsonSerializer serializer) [0x0001c] in <1105daf5b94b4e59a2c5d374b8186923>:0
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable (Newtonsoft.Json.JsonConverter converter, Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Object existingValue) [0x00055] in <271c58b7a8684db5a2c92be17a81f252>:0
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue (Newtonsoft.Json.Serialization.JsonProperty property, Newtonsoft.Json.JsonConverter propertyConverter, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty, Newtonsoft.Json.JsonReader reader, System.Object target) [0x0004e] in <271c58b7a8684db5a2c92be17a81f252>:0
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject (System.Object newObject, Newtonsoft.Json.JsonReader reader, Newtonsoft.Json.Serialization.JsonObjectContract contract, Newtonsoft.Json.Serialization.JsonProperty member, System.String id) [0x00267] in <271c58b7a8684db5a2c92be17a81f252>:0
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject (Newtonsoft.Json.JsonReader reader, System.Type objectType, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, System.Object existingValue) [0x0015c] in <271c58b7a8684db5a2c92be17a81f252>:0
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType, Newtonsoft.Json.Serialization.JsonContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerMember, System.Object existingValue) [0x0006d] in <271c58b7a8684db5a2c92be17a81f252>:0
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Boolean checkAdditionalContent) [0x000d9] in <271c58b7a8684db5a2c92be17a81f252>:0
at Newtonsoft.Json.JsonSerializer.DeserializeInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00053] in <271c58b7a8684db5a2c92be17a81f252>:0
at Newtonsoft.Json.JsonSerializer.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00000] in <271c58b7a8684db5a2c92be17a81f252>:0
at Newtonsoft.Json.JsonConvert.DeserializeObject (System.String value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) [0x0002d] in <271c58b7a8684db5a2c92be17a81f252>:0
at Newtonsoft.Json.JsonConvert.DeserializeObject[T] (System.String value, Newtonsoft.Json.JsonSerializerSettings settings) [0x00000] in <271c58b7a8684db5a2c92be17a81f252>:0
at Oxide.Core.Configuration.DynamicConfigFile.ReadObject[T] (System.String filename) [0x00028] in <15f61ddda771464d8246ebdce8ff4811>:0
at Oxide.Core.DataFileSystem.ReadObject[T] (System.String name) [0x00018] in <15f61ddda771464d8246ebdce8ff4811>:0
at Oxide.Plugins.HumanNPC.LoadDataSound (System.String name) [0x0002d] in <1105daf5b94b4e59a2c5d374b8186923>:0
at Oxide.Plugins.HumanNPC.OnEnterNPC (BasePlayer npc, BasePlayer player) [0x0015d] in <1105daf5b94b4e59a2c5d374b8186923>:0
at Oxide.Plugins.HumanNPC.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x003d6] in <1105daf5b94b4e59a2c5d374b8186923>:0
at Oxide.Plugins.CSharpPlugin.InvokeMethod (Oxide.Core.Plugins.HookMethod method, System.Object[] args) [0x00079] in <42f9bedc659b4f4786eb778d3cd58968>:0
at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x000de] in <15f61ddda771464d8246ebdce8ff4811>:0
at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <15f61ddda771464d8246ebdce8ff4811>:0It happens every time when the NPC tries to play the recorded sound.
I also tested with a freshly recorded sound, so it does not seem to be an old/corrupted recording.
Could you please check the sound recording/saving system? It appears that the saved voice data is either empty or cannot be read correctly by FromSaveData().
HumanNPC version: 0.6.8