-
Notifications
You must be signed in to change notification settings - Fork 114
NPC Component (WIP) #916
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
NPC Component (WIP) #916
Conversation
Good job! |
error in native? |
Edited. |
The first tests look interesting)) |
I don't think NPCs are supposed to connect with ipv6 as your logs show |
I removed the spawn, the server is working, the npcs have connected, but are physically absent) logs looks like good.
later )
ipv6 turns into a localhost after the first player connects, hm..)
|
I tried to spawn NPCs 10 seconds after connecting - the server also crashed |
One more bug, in OnNPCConnect(npcid) |
As we talked in discord, regarding the crash issue, it should be fixed now. @eakwarp was kicking them and kicking an NPC wasn't implemented since it was on network level. Also removing/destroying NPCs on connect callbacks would result into crashes as well, which is now fixed too. Also callback names are updated |
what about new builds?) |
7d97857
to
5ad4db9
Compare
Some natives from FCNPC for Mysy
|
Thanks |
any chance to get FCNPC_Respawn() soon? :) |
Is it not possible to just call NPC_Spawn again? |
@AmyrAhmady: Yes, you're right. I tested the latest build of the NPC component with this script: https://pastebin.com/62zSMpSq. I'm not sure if I'm just being stupid or if there are actual bugs:
Is this the correct way to report these issues/questions, or should I use Discord instead? Thanks! |
6bda100
to
69d38ae
Compare
Following up on my post above: When I spawn two NPCs, I can kill one, but the other becomes invulnerable. It doesn’t matter which one I kill — the remaining NPC always becomes invulnerable.
|
Typo.
|
Sometimes NPCs will connect but not physically show up in-game. This seems to be related to them using a playerID that has been used by a player before. All functions still work, they still show up in the logs the same as all the other ones, and COMMAND:npccreate(playerid, params[]){
// Get nickname
format(iStr, sizeof(iStr), "NPC_%d", NPC_number);
NPC_number++;
// Create it
new npcid = NPC_Create(iStr);
NPC_Spawn(npcid);
NPC_SetPos(npcid, 1368.7627, -1089.5592, 24.3783);
NPC_EnableInfiniteAmmo(npcid, true);
NPC_SetAmmo(npcid, 100);
NPC_SetHealth(npcid, 10.0);
NPC_SetWeapon(npcid, NPC_weapon);
return 1;
} NPCs do not receive or give damage. You can shoot them, even on 10 HP, and nothing will happen. They will also shoot, and nearly all of the bullets will hit and show blood on the target, but no damage is being done to them. function:NPCShootPlayer(playerid){
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
foreach(new i : NPCs){
NPC_Shoot(i, NPC_weapon, playerid, 1, x, y, z, 0.0, 0.0, 0.0, true, true);
}
} And lastly, I think it'd be a good idea if these were threaded, similar to the native NPCs using samp-npc.exe. Most high population servers already struggle with the fact the AMX thread is single core, so adding a few hundred NPCs with advanced logic will definitely cause some issues. |
Info
This PR is made to follow progress of NPC component development
Also creating this PR allows our build CIs to run so people can grab server builds from this PR to test NPCs
(Note: Some stuff are taken from this branch https://github.com/openmultiplayer/open.mp/tree/Alasnkz/npc like NPC network class and some move calculations)
Current Pawn scripting API
Natives:
Callbacks:
Videos:
Short video of basic usage:
https://cdn.discordapp.com/attachments/966398440051445790/1229681168878669895/ompnpc.mp4