Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - habi2

#2
Coloured area? Nope
#3
Run as administrator.
#4
Hi PSL, the remote function calls (RFC) in npcmodule unfortunately cannot return value from server. It can only execute code.
See RFC documentation https://npc-for-vcmp.sourceforge.io/wikiw/index.php/LibRPC_RFC for Return Values:
QuoteThis will return a function object which can be used as if it is the remote function itself.(except of return values)
So r will always be true.

I wrote a code to do this in two parts - serverscript and npcscript
//--npcscript
npclist<-array(100, false);
function RegisterNPC(playerid, isnpc)
{
npclist[playerid]=isnpc;
}
function OnPlayerStreamIn(playerid)
{
    print("I see the " GetPlayerName(playerid) " enter my field of view, and his ID is: " playerid ".");

    local r=npclist[playerid];

    if(r)print(" He is an npc\n");
}
//--server side
//when a new player joins inform all npcs if the player is PC(Playable Character) or NPC(Non Playable Character).

function onPlayerJoin(player)
{
local plr;
for(local i=0;i<GetMaxPlayers();i )
{
plr = FindPlayer(i);
if(plr && plr.IsNPC)
{
//Send information
RFC(i, "RegisterNPC")(player.ID, player.IsNPC);
}
}
//When an npc joins the server send information about all existing Characters (Playable or Non Playable) to it.
if(player.IsNPC)
{
for(local i=0;i<GetMaxPlayers();i++)
{
plr= FindPlayer(i);
if(plr)
RFC(player.ID, "RegisterNPC")(i, plr.IsNPC);
}
}
}


1. IsNPC or IsNPC()
#5
No need to apologize! I'm glad that the problem is fixed.
#6
Hi PSL, i fixed the second issue. Now the error "vehicle not acquired by npc" is not shown. Also it drives vehicle good.
Here is a windows only patch of npcclient.exe
rel006
windows https://www.mediafire.com/file/yx1onimsqn8uq5e/npcclient-v1.8-beta-p1a.zip/file
linux-64 https://www.mediafire.com/file/p8z51uteldg6h9b/npcclient64-linux-v1.8-beta-p1a.zip/file
rel004
windows https://www.mediafire.com/file/wz00axkfzeid81d/npcclient_r004-v1.8-beta-p1a.zip/file
linux-64 https://www.mediafire.com/file/6nkxeepdkpbk37q/npcclient64_r004-linux-v1.8-beta-p1a.zip/file
I will release all editions soon. Please report any bugs you find like this.
#7
Hi PSL,
i have found that npc do not exist properly from vehicle. It does not exit via car door, but stands outside - only co-ordinates are changed.

Here is a temporary solution involving editing the rec file :
1. Open rec file and find the packet which corresponds to npc exit vehicle. It will have packet number =  3.
2. Optionally, Use Help->Show Legends to see all packet types.
3. Double click on 'Time' column and reduce the value by 1100 (ms)
4. Save or Save As new file.

My laptop is not with me. I will issue a patch as soon as possible.
#8
Hi PSL, i have fixed the two bugs
QuoteFixed Npc not able to enter into ships
Fixed Server crashing when calling ConnectMultipleNpcs.
Now patch1 available for download:

NPC v1.8 Beta - Patch 1 - Updated Files

Released on: 29-02-2024

Downloads
npc_vcmp_rel006_windows_v1.8-beta-p1.zip (Size: 1.00 MB)
npc_vcmp_rel006_linux_x86_v1.8-beta-p1.zip (Size: 3.10 MB)
npc_vcmp_rel006_linux_x64_v1.8-beta-p1.zip (Size: 1.03 MB)
npc_vcmp_rel004_win_lin_v1.8-beta-p1.zip (Size: 2.23 MB)
npcclient-setup-v1.8-beta-p1.exe (Size: 2.19 MB)

source-code
NPC-VCMP-master-v1.8-beta-p1.zip (Size: 10.10 MB)

Note: Please make sure to update to these latest files for an enhanced NPC experience!
#9
Quote from: PSL on Feb 18, 2024, 06:06 AMHi Habi. I started recording perfectly fine, generating hrec and some rec files, and when I did ConnectMultipleNpcs, the main console just shut down.
Here is the link to the file: https://file.io/lWGmWVUgd8ea
function onPlayerCommand(player,cmd,text)
{
    if(cmd=="test2")
    {
        ConnectMultipleNpcs("testfile","127.0.0.1",7); // Create a recording file and run this command
    }
}
By main console, i assume that you mean the console of npc which opens up was shutdown. The ConnectMultipleNpcs will connect npcs with same name as those players when hrec file was recorded. So from your file, the npc will have name pq. So if your game-name is also pq, those npcs fail to be connected.
QuoteKicking connecting player at ID 1, name already in use.
#10
Hi PSL,
I understand that you create a vehicle with model ID 141 and put npc inside it and using RFC executed the playback recording.
That is correct, field2 is indeed model ID of the vehicle.

Playback type PLAYER_RECORDING_TYPE_ALL checks  whether vehicle.ID is same as that of recfile. This is saved in field1.
You can avoid this vechicleID check by using
StartRecordingPlayback(3,"cartest",PLAY_IGNORE_VEHICLEID)
#11
Hi PSL, i understand your server console is shutting down once you call ConnectMultipleNpcs function.
Unfortunately, i am on a travel and could not look at the problem.
#12
Hi PSL, the two codes should not be used together. The correct way is
PutServerInRecordingMode("testfile",PLAYER_RECORDING_TYPE_ALL,REC_ALLNAME)
and
StopServerInRecordingMode()
This will automatically start recording data of all players.
Now when you call stop, it finishes recording. You will get testfile.hrec and n rec files, where n is the number of players who was in the server in between PutServerInRecordingMode and StopServerInRecordingMode.
Next use the plugin npc04relxx to start playback. Use
ConnectMultipleNpcs(testfile, "127.0.0.1",7);
which will connect the same 'n' npcs.
Notes
1. Use PutServerInRecordingMode (with flags
REC_ALLNAME) when server is empty. If this function is called when a players are already spawned, the npc when connected will have spawning problem.
#13
Quote from: PSL on Feb 17, 2024, 04:02 AMI found a problem in testing this version. When I hide an NPC's console, the NPC doesn't join the server.
ConnectNPC("[NPC]Jack","npcplayback.nut",false,"127.0.0.1","rpclib z-finder");  //Not Join
ConnectNPC("[NPC]Jack","npcplayback.nut",true,"127.0.0.1","rpclib z-finder");  //Join
This issue has been fixed. It was related to npc creating logfiles. Logfiles can now be found in folder npcscripts/logs whenever ConnectNPC is called with console parameter false.
Also,
QuoteCorrected API version to 1.6
Windows
Linux x64
Linux x86
rel004
Source-1.8-beta-zip
Setup (Installer)

What's New in v1.8 Beta?

From Release Notes on the wiki:

Quote
  • New Recording Type: Introducing PLAYER_RECORDING_TYPE_ALL for StartRecordingPlayerData, eliminating the need to specify whether the player is on foot or in a vehicle.

  • Captured Events: PLAYER_RECORDING_TYPE_ALL now supports capturing various events, including player updates, death, pickup events, checkpoint events, object touch/shot events, player chat, player command, private messages, and ClientScriptData.

  • StartRecordingAllPlayerData: A unified function to start recording on all players, including those who may join later.

  • Server Recording: Similar to StartRecordingAllPlayerData, but produces an hrec file with player join times and corresponding rec files for replay. Connected players act as NPCs, replicating player actions.

  • ConnectMultipleNpcs: Connects multiple NPCs from an hrec file produced by PutServerInRecordingMode.

  • recdir Configuration: Introduce recdir 2 in server.cfg to save playback recordings to npcscripts/recordings, with recdir 1 as the default.

  • Npcs with Strings: Npcs can now be called with strings, allowing for custom actions like "function OnNPCSpawn(){SendChat("I have spawned");}".

  • Logfiles: Each NPC now writes logfiles in the npcscripts folder.

  • New NPC Functions: Various new functions added for use by npcscripts, including Suicide, SetMyHealth, GetMyHealth, LookAtPos, LookAtPlayer, GetMyClass, RequestClassAbs, AmISpawned, GetMySkin, GetMyTeam, GetMyArmour, SendPrivMsg, SetConfig, GetPlayerColor, IsPlaybackRunning, IsPlaybackPaused, IsServerInRecordingMode.

  • Additional npc04relxx Plugin Functions: KickAllNPC, IsPlayerRecording, StartRecordingAllPlayerData, StopRecordingAllPlayerData, PutServerInRecordingMode, StopServerInRecordingMode, IsServerInRecordingMode.

  • Configurable max_npc: Added max_npc in server.cfg, optional and limits the number of NPCs in the server (values: 0 to 100, -1 for any number).

  • Console Notifications: Npcs now print their names in the console upon connection, e.g., "Connected. ID: 03 Name: John".

  • Bug Fixes: Fixed issues with NPC getting kicked, not holding weapons on spawn, and incorrect angles for newly streamed players.

  • Private Messages: NPCs can now send private messages.
#14
Hi PSL, can you confirm if this release candidates of v1.8 beta solves the issue of car not accelerating.

windows
linux-x64
linux-86
rel004
source-1.8-beta-zip
setup (installer)

Also thanks for confirming about location of server.

I decreased sleep time between cycles from 30 to 5 ms and found that cars are accelerating without lags. Also the time taken by npc to omplete the race now matches against the original time.
#15
Hi PSL thank you for reporting the issue.
This is a video of me racing with npc:
Video
As you can see, the npc car is racing ahead of me at full speed.

Was the server run on your pc or remote computer?