Jump to content

BetterNpc / Airfield event conflict

Closed 1.2.8

Hi!

BetterNpc add challenge to my server and populate the map with interresting NPC, thank for that!

But I have a problem with the Airfield Event.

If BetterNpc is loaded, NPC of the airfield event can't spawn.
I can see the Airfield event plugin truing to spawn NPC, but they are immediatly removed.
( see also https://codefling.com/files/support/12015-npc-not-spawning-better-npc-conflict/ )

When BetterNpc is unloaded, Airfield event works like a charm.

But on my server, I need to use BetterNpc AND the Airfield event.

Is there a way to fix that ?

Maybe you can talk together with the author of Airfield event to fix that ?

Thanks in advance!

Jack

Share this comment


Link to comment

Hiya @Jack hopefully I can help out with this and if nothing else clear things up so that you can get a resolution sooner rather than later.

Firstly I want to mention that there is an option in BetterNpc to remove or not to remove other NPCs in the area.

 Remove other NPCs? [true/false] – It deletes the standard NPCs inside the limits of this monument 

So there is one option, a short term fix if nothing else as this is likely set to true for you at the moment and at that location. The only thing you may run into when setting this to false is you'll get a mix of default NPC, BetterNpc NPCs, and when the event runs you'll have those NPCs as well. If that's not an issue though then maybe this solves the issue.

 

As far as with the AirfieldEvent plugin you would need to ask that the Developer use the API available in the plugin description to remove BetterNpc NPCs during the event, and spawn them back in when the event ends. I'll share that text here for reference.

API
void DestroyController(string name) – It destroys the place of appearance NPC with the name {name}

void CreateController(string name) – It creates the place of appearance NPC with the name {name}

These APIs can be used with standard monuments, custom monuments (NPC locations) and roads.
The name of this monument is in standard monuments {name}.
It is the name of the file in the Custom and Road folder in custom monuments and roads 

They can use this API to have the plugin compatible with BetterNpc and to fully avoid this issue, and to have everything working in unison properly.

  • Like 1

Share this comment


Link to comment

Thank a lot for you answer!

I did that.

I my oxide> data > betternpc > monument > Airfield.json 

I have these 3 first lines :

 

  "Enabled? [true/false]": false,
  "The size of the monument": "(175.0, 30.0, 125.0)",
  "Remove other NPCs? [true/false]": false,

BetterNPC plugin and Airfield Event plugin reloaded.

But it does not work.
According to the configuration, I have no NPCs on my airfield (I am on the Essence map).

But when the plane generates its own NPCs, they are still immediately deleted by BetterNpc.
I said by BetterNpc, because when I remove the Better Npc plugin everything works fine.

I sent the link for this topic to the developer of the Airfield event.

I hope we find a solution.

These are two great plugins that players love!

Share this comment


Link to comment

They should not be getting removed by BetterNpc in this instance, if you have it configured as above and everything has been freshly loaded. If it is then yes wait to hear back from the other developer. They would need to troubleshoot with you the reason that those NPCs are not showing up with BetterNpc present.

Of course if there seems to be any issue you are the developer can let us know what you find. Hopefully implementing the fixes suggested using the API from the Description will sort things out.

Share this comment


Link to comment

I'm not a C# dev but I tried myself to update the plugin to test your answer.

I added this when the ArifieldEvent start.
          

 this.BetterNpc.Call("CreateController", "Airfield");


So when the Airfield event Start, it remove all the BetterNpc NPCs from the arifield.
That's ok.

But when the plane land all the drops, betterNpc still remove the NPCs from the Arifield Event.

The problem seems to comes from the OnEntitySpawned(NPCPlayer ent) function (line 1571) in the BetterNpc plugin.

If I add a return just after the function declaration, of course this will skip all the content of the function, but the NPC of the Airfield Event spawn correctly.
And the best, with that I can have the NPC from the Airfield Event AND Npc from BetterNPC at the same time.

The problem is : with that, I skip the content of the OnEntitySpawned function. And this content is not there to just look pretty!
So, I think they could be a lot of side effect.

I hope this could help!
I can try some other tests if you want, but again, I'm not a C# dev.

Thanks a lot for your help.

 

Share this comment


Link to comment

Another test :

If I comment this line, it works.



 

        private void OnEntitySpawned(NPCPlayer ent)

        {
            ControllerSpawnPoint controller = _controllers.FirstOrDefault(s => s.RemoveOtherNpc && s.IsOtherNpc(ent));
            if (controller != null)
            {
                // NextTick(() => { if (ent.IsExists()) ent.Kill(); }); <--------------
                return;
            }


 

Share this comment


Link to comment

SOLVED!

Ok, I found the problem.

I printed the controller name called in the OnEntitySpawned and it gives me the name of an old cutom file I created.
I really don't know why he use this file to manage NPCs on the airfield event, but I removed it, and now it's works : I have NPC from BetterNPC, and NPC from Airfield event at the same time.

Really sorry for the mess.
( but it's still strange ... )

And thanks a lot for your support!

Sorry for that again.

Share this comment


Link to comment

Nothing at all to apologize for @Jack if anything I'm actually sorry I didn't get back to you sooner as well. Really appreciate the updates and the feedback though and really glad to hear it's sorted!

Definitely sounds like good and thorough feedback for the developer so props for doing some diligence in your testing and sorting out the issue to give them some really good feedback, maybe it's something they will be willing to address in a future update.

Thanks again for letting us know and glad you have this running properly now. Have fun with it!

  • Like 1

Share this comment


Link to comment
1.1m

Downloads

Total number of downloads.

5.6k

Customers

Total customers served.

81.8k

Files Sold

Total number of files sold.

1.6m

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.