Jump to content

Talking Npc Vendors 1.4.8

$25.00 $23.75
   (4 reviews)

1 Screenshot

  • 44.4k
  • 530
  • 20.15 kB

This area is for discussion and questions. Please use the support area for reporting issues or getting help.

Recommended Comments



hc4stillo

Posted

09/04 15:49:25 | Failed to call hook 'OnServerInitialized' on plugin 'TalkingNpc v1.4.6' (ArgumentNullException: Value cannot be null.
Parameter name: source)
at System.Globalization.CompareInfo.IndexOf (System.String source, System.String value, System.Globalization.CompareOptions options) [0x00003] in <f98723dd4586469db5213ec59da723ca>:0
at UnityEngine.StringEx.Contains (System.String haystack, System.String needle, System.Globalization.CompareOptions options) [0x0000a] in <a4cad030731741a9afce2404ea192428>:0
at Oxide.Plugins.TalkingNpc+<>c__DisplayClass68_0.<OnServerInitialized>b__0 (MonumentInfo m) [0x00025] in <4a64c536fc81422aa85f2d8f4927101f>:0
at System.Linq.Enumerable+WhereListIterator`1[TSource].MoveNext () [0x00037] in <8b0c76c7efa244bc95eeee75bf1314cd>:0
at Oxide.Plugins.TalkingNpc.OnServerInitialized () [0x00172] in <4a64c536fc81422aa85f2d8f4927101f>:0
at Oxide.Plugins.TalkingNpc.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x013a6] in <4a64c536fc81422aa85f2d8f4927101f>: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 <112d89ea5d3348c8b949af0ab1a866d2>:0
at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <112d89ea5d3348c8b949af0ab1a866d2>:0

After performing different tests, the error is due to the name of the monument that is not recognized as it was in this example:

"Monument": "assets/bundled/prefabs/autospawn/monument/small/sphere_tank.prefab",

By deleting the monument name the plugin works fine again, but I have a big problem, I don't have time to manually reassign the NPC position in more than 20 monuments.

Consulting with ChatGPT the recommendations were these:

1- 

using System.Globalization;

2-  

private static bool ContainsCI(string haystack, string needle)
{
    if (string.IsNullOrEmpty(haystack) || string.IsNullOrEmpty(needle))
        return false;

    return CultureInfo.InvariantCulture.CompareInfo.IndexOf(
        haystack, needle, CompareOptions.IgnoreCase) >= 0;
}

3- A 

private static string GetMonumentName(MonumentInfo monument)
{
    if (monument == null || monument.gameObject == null)
        return string.Empty;

    var monumentName = monument.gameObject.name;

    // Solo verifica el marcador si realmente hay nombre
    if (!string.IsNullOrEmpty(monumentName) && monumentName.Contains("monument_marker.prefab"))
        monumentName = monument.gameObject.transform?.parent?.gameObject?.transform?.root?.name;

    // Siempre regresa string no nulo
    return monumentName ?? string.Empty;
}

3- B 

GetMonumentName(m).Contains(talkerSpawn.Value.Monument, CompareOptions.IgnoreCase)

3- C  

foreach (var monument in TerrainMeta.Path.Monuments.Where(m =>
{
    if (m == null) return false;
    var name   = GetMonumentName(m);                 // puede ser ""
    var target = talkerSpawn.Value?.Monument;        // puede ser null o ""
    return ContainsCI(name, target);
}))
{
    if (SpawnTalkingNpc(talkerSpawn.Value, talkerSpawn.Key, monument) != null)
        SaveTalkerSpawns();
}

Here everything worked again, automatically recognizing monuments and NPC positions no matter which map you generate.

Razor

Posted

5 hours ago, hc4stillo said:

09/04 15:49:25 | Failed to call hook 'OnServerInitialized' on plugin 'TalkingNpc v1.4.6' (ArgumentNullException: Value cannot be null.
Parameter name: source)
at System.Globalization.CompareInfo.IndexOf (System.String source, System.String value, System.Globalization.CompareOptions options) [0x00003] in <f98723dd4586469db5213ec59da723ca>:0
at UnityEngine.StringEx.Contains (System.String haystack, System.String needle, System.Globalization.CompareOptions options) [0x0000a] in <a4cad030731741a9afce2404ea192428>:0
at Oxide.Plugins.TalkingNpc+<>c__DisplayClass68_0.<OnServerInitialized>b__0 (MonumentInfo m) [0x00025] in <4a64c536fc81422aa85f2d8f4927101f>:0
at System.Linq.Enumerable+WhereListIterator`1[TSource].MoveNext () [0x00037] in <8b0c76c7efa244bc95eeee75bf1314cd>:0
at Oxide.Plugins.TalkingNpc.OnServerInitialized () [0x00172] in <4a64c536fc81422aa85f2d8f4927101f>:0
at Oxide.Plugins.TalkingNpc.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x013a6] in <4a64c536fc81422aa85f2d8f4927101f>: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 <112d89ea5d3348c8b949af0ab1a866d2>:0
at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00060] in <112d89ea5d3348c8b949af0ab1a866d2>:0

After performing different tests, the error is due to the name of the monument that is not recognized as it was in this example:

"Monument": "assets/bundled/prefabs/autospawn/monument/small/sphere_tank.prefab",

By deleting the monument name the plugin works fine again, but I have a big problem, I don't have time to manually reassign the NPC position in more than 20 monuments.

Consulting with ChatGPT the recommendations were these:

1- 

using System.Globalization;

2-  

private static bool ContainsCI(string haystack, string needle)
{
    if (string.IsNullOrEmpty(haystack) || string.IsNullOrEmpty(needle))
        return false;

    return CultureInfo.InvariantCulture.CompareInfo.IndexOf(
        haystack, needle, CompareOptions.IgnoreCase) >= 0;
}

3- A 

private static string GetMonumentName(MonumentInfo monument)
{
    if (monument == null || monument.gameObject == null)
        return string.Empty;

    var monumentName = monument.gameObject.name;

    // Solo verifica el marcador si realmente hay nombre
    if (!string.IsNullOrEmpty(monumentName) && monumentName.Contains("monument_marker.prefab"))
        monumentName = monument.gameObject.transform?.parent?.gameObject?.transform?.root?.name;

    // Siempre regresa string no nulo
    return monumentName ?? string.Empty;
}

3- B 

GetMonumentName(m).Contains(talkerSpawn.Value.Monument, CompareOptions.IgnoreCase)

3- C  

foreach (var monument in TerrainMeta.Path.Monuments.Where(m =>
{
    if (m == null) return false;
    var name   = GetMonumentName(m);                 // puede ser ""
    var target = talkerSpawn.Value?.Monument;        // puede ser null o ""
    return ContainsCI(name, target);
}))
{
    if (SpawnTalkingNpc(talkerSpawn.Value, talkerSpawn.Key, monument) != null)
        SaveTalkerSpawns();
}

Here everything worked again, automatically recognizing monuments and NPC positions no matter which map you generate.

Cuttent error is related to fp messing up monument markets and said they will relese hotfix

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Like 3

Razor's Collection

User Feedback

1.9m

Downloads

Total number of downloads.

9.1k

Customers

Total customers served.

133.8k

Files Sold

Total number of files sold.

2.8m

Payments Processed

Total payments processed.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.