Quote:
Originally Posted by TheArcher
Hop, new version out which covers something from my include, gotta take it a look... I might change some function directly accessed to the plugin (hook ofc)..
|
I wouldnt start immediatelly with that
Right now Im working on some bigger internal updates that might change some RNPC syntaxes, so maybe the inlcude wouldnt be compatible. Im always trying to keep new versions compatible so people dont need to rewrite their whole script, but this time I cant tell if I can keep it that way
Quote:
Originally Posted by [D]ry[D]esert
When i ran Crash Detect, ive seen some errors coming from rnpc.inc..
It happens when i restart the server (Without reconnecting them) and then createbuild ( for any purpose such as: creating movement build)
EDIT: I notice something, Createbuild crash the server after restarting the server (/rcon gmx) everything work great when you start the server, but not after restarting.
I tried to kick then and connect them again after the restart, same results.. server will crash at the end.
|
That server restart thing has always been an issue with RNPC. I havent seen crashes yet, mostly the NPCs just get "stupid" and wont be doing anything, sometimes they dont even spawn. Im also looking at that, hopefully this is a fixable problem, and not a general NPC bug.
Quote:
Originally Posted by [uL]Pottus
It may even be good to update the NPC mode as well to support custom playbacks as well so I hope you do that too as well.
RNPC_SetPlaybackRec(npcid, recfilename[])
Now please try and follow these ideas.
Connecting NPC's I propose to create a NPC registry system in PAWN that associates a playerid with an indexed array so it won't matter what slot a NPC gets its reference is determined by a sequential array. This will get around the trouble of the expected connection being on the wrong playerid which has always been an issue but there is more that should be done as well and I will explain some more ideas built on this idea of integrating and using RNPC with pawn.
What RNPC needs is a group connection command RNPC_GroupConnect(npcamount) it's not a very good idea from my experience to try and use NPCs dynamically the system is much easier to control when NPCs are connected statically when OnGameModeInit() is called however the function should be allowed to be called at anytime but only once.
Now that all NPCs are connected we need a watchdog to ensure that NPCs will be reconnected if one disconnects and it does happen from time to time and I don't think it is acceptable to assume that it won't happen no matter how stable things may seem with the plugin it's self there is no way to ensure the samp server it's self and NPC server won't falter.
I think all callbacks which can be triggered by NPCs should be processed in the RNPC include internally so that the gamemode will never see these messages this can cause significant issues trying to integrate NPCs into a gamemode. Furthering this concept all callbacks should use CallRemoteFunction() to call a corresponding RNPC event such as RNPC_OnPlayerSpawn(npcid).
If you are interested in seeing how these concepts can be applied I can develop a RNPC rebuild include and some other development includes such as a filterscript patch which would just cause the filterscript to ignore any NPC related callback events.
|
You already can play any recordings
RNPC_StartPlayback(npcid, rec[])
It was bugged in the earlier versions, but now with 0.3.3 it should work again.
"Isolating" Npcs from the normal players as you say might have some advantages. That would match my earlier ideas about having a streamable "npc pool" without the need to connect and disconnect them all the time.
But it also has some disadvantages. Working with custom indexes instead of the playerids is slower. Not a lot, but when having a lot of NPCs that also are controlled a lot, this might already be a noticeable difference.
To get around the ID problems, as long as the NPCs are connected on server start, the current version is absolutely fine. It may only return wrong IDs now, if another player connects in the small timeframe between ConnectRNPC and the connections. Thats just a matter of a few milliseconds. Very unlikely, but I also got some ideas on how to avoid even this problem.
Also there are scenarios where you dont want NPCs to be that isolated. Sometimes NPCs should be treated like any other player, e.g. for weapon and damage systems. Blocking NPCs from normal callbacks is a matter of one line, but once they are all blocked, and you want them to be considered by a callback again, you got a problem. Having custom RNPC_OnWhatever callbacks for everything would be a way around that though, but IMO with all the current callbacks, rnpc would explode and get even more confusing than it already is.
RNPC is meant to offer maximum scripting possibilities and freedom, so right now I wouldnt like to limit it that drastically. But Ill reconsider your idea.