NPC/Bots implementation in VCMP 0.4 Servers

Started by habi, Apr 01, 2022, 05:37 PM

Previous topic - Next topic

MEGAMIND

Quote from: habi2 on Nov 09, 2024, 04:11 PMHi @MEGAMIND, i see your messages and will fix it one by one.
Quotenpc is dead how he gonna spawn back?, bcz i see a msg that i have spawned but not actully spawned, even though i get npc it says player not spawned
Use RequestSpawn to spawn the npc.when it is dead. It will spawn in the same class.
function OnPlayerDeath(playerid)
{
if(playerid==GetMyID())
              RequestSpawn();
}
About crashing of server (i hope it is server that is crashing), when you use RFC repetitiously there might be some bug which i will look now.
why does it change skin? though i have a skin already in connect ConnectNPCEx("[A.I]ChatGPT", Vector (-1735.81, -266.977, 14.8683),  -0.172573, 212, 24, 4,"npc.nut",true,"wno-host.ddns.net","rpclib z-finder actionlib npcmodule");
its changing into lovefist skin

MEGAMIND

#151
Quote from: habi2 on Nov 09, 2024, 04:11 PMAbout crashing of server (i hope it is server that is crashing), when you use RFC repetitiously there might be some bug which i will look now.
yes serverside.exe gets closed

Suggestion lookatplayer should be as syncd as whn npc is targetting and shooting player, add the same mechanics to lookatplayer too @habi2

habi2

#152
Hi Megamind i was not well for two days and now recovering fast.
The mechanism of creating npc with skin was created when npc didn't die. Now it dies and gets skin of the class which in your case maybe lovefist. I will fix it in next update. But you can
SendCommand("_npc_skin_request 65");
to set npc skin anytime. The above code set it to 65, as we discussed before. OnNPCSpawn might be the right place.

About server crashing issue, it is the 64-bit version of windows (and perhaps linux too) that has bug when using RFC. I will correct it.

MEGAMIND

Quote from: habi2 on Nov 12, 2024, 08:10 AMHi Megamind i was not well for two days and now recovering fast.
The mechanism of creating npc with skin was created when npc didn't die. Now it dies and gets skin of the class which in your case maybe lovefist. I will fix it in next update. But you can
SendCommand("_npc_skin_request 65");
to set npc skin anytime. The above code set it to 65, as we discussed before. OnNPCSpawn might be the right place.

About server crashing issue, it is the 64-bit version of windows (and perhaps linux too) that has bug when using RFC. I will correct it.
thanks habi i also found a work around from serverside for facing the npc towards me but it will be alot better if just single line of code can do the work easily instead of doing a full math, also get well soon

habi2

Hi Megamind,

Here is 64-bit version of plugin with RFC function fixed:
npc04rel64-windows.zip (170.53 KB)

I was writing 8 bytes in allocated memory of 4 bytes for integer. Now casted the 8 byte integer to 4 byte and write in the 4 bytes memory.

MEGAMIND

Quote from: habi2 on Nov 14, 2024, 02:59 PMHi Megamind,

Here is 64-bit version of plugin with RFC function fixed:
npc04rel64-windows.zip (170.53 KB)

I was writing 8 bytes in allocated memory of 4 bytes for integer. Now casted the 8 byte integer to 4 byte and write in the 4 bytes memory.
thats graet habi i had stoped working on npc kindof paused but ill checkit out and resume my work, thanks for your time, ill get back to u with results/bugs

MEGAMIND

#156
@habi2 Hi just tested it and i have did some crazy amount of testing on it and now its perfectly fine..! Thanks again

MEGAMIND

hey @habi2 sup man, ok so i was trying to give it a more like gta vc npc feeling but i saw in the plugin that only SendCommand("_npc_skin_request 211");
    SendCommand("_npc_weapon_request 24");
were available from npcscripts but what about if we want like anims or alot more can be asked like to send commands from npc side to server..

+ u know what people do at my server?

spawn me a car, fight me walk with me so i think i could comeup with those codes but can we have some more of these

SendCommand("_npc_anim_request someanim"); also access serverside commands from npcside, ik theres RFC but tahts from server side what im trying is to give npc a new feel also it would easily work with my chatgpt integration with it te npc will become more life like being..

habi2

#158
Quote from: MEGAMIND on Nov 14, 2024, 10:01 PMhey @habi2 sup man, ok so i was trying to give it a more like gta vc npc feeling but i saw in the plugin that only SendCommand("_npc_skin_request 211");
    SendCommand("_npc_weapon_request 24");
were available from npcscripts but what about if we want like anims or alot more can be asked like to send commands from npc side to server..
Hi Megamind, there is an RFC in npcscripts side also.
You can execute commands serverside. As you can read in link, npc.IsAdmin=true is required for this.

I will come up with examples later on.

It is nice to know people interacting with your chatgpt a.i.

Please read examples(under See Also)  in wiki like setting cash. There is also one about setting weapon. good luck.

MEGAMIND

@habi2 hi i was testing some local npc running in server at different points randomnly where  i thought how about to hide it so looked at https://npc-for-vcmp.sourceforge.io/wikiw/index.php/NPCHide even downloaded the plugin i faced this Plugin error >> LoadLibrary() 'plugins/npc.dll' failed: Code 126
Failed to load plugin: npc

if the plugin istn the way out to hide can u make me a snippet where the playernames gets hidden from browser and from ingame server

habi2

Quote from: MEGAMIND on Nov 15, 2024, 12:16 PM@habi2 hi i was testing some local npc running in server at different points randomnly where  i thought how about to hide it so looked at https://npc-for-vcmp.sourceforge.io/wikiw/index.php/NPCHide even downloaded the plugin i faced this Plugin error >> LoadLibrary() 'plugins/npc.dll' failed: Code 126
Failed to load plugin: npc
Hi megamind, the name of the plugin associated for hiding npc in browser is npchide. For 64-bit, 64 is suffixed. Please verify that name of plugin in server.cfg is same as the name of dll in plugins directory.

MEGAMIND

#161
Quote from: habi2 on Nov 15, 2024, 04:20 PM
Quote from: MEGAMIND on Nov 15, 2024, 12:16 PM@habi2 hi i was testing some local npc running in server at different points randomnly where  i thought how about to hide it so looked at https://npc-for-vcmp.sourceforge.io/wikiw/index.php/NPCHide even downloaded the plugin i faced this Plugin error >> LoadLibrary() 'plugins/npc.dll' failed: Code 126
Failed to load plugin: npc
Hi megamind, the name of the plugin associated for hiding npc in browser is npchide. For 64-bit, 64 is suffixed. Please verify that name of plugin in server.cfg is same as the name of dll in plugins directory.

i use this in server.cfg npchide64
plugins squirrel04rel64 sqlatestfeatures04rel64 xmlconf04rel64 announce04rel64 ini04rel64 sqlite04rel64 sockets04rel64 hashing04rel64 mysql04rel64 rcon04rel64 vcmp-squirrel-mmdb-rel64 logfile64 webnet64 appchat04rel64 json04rel64 httprequest04rel64 npc04rel64 npchide64

and this is what i get
 Vice City Multiplayer Server
 -------------------------------
 v0.4, (c) 2007-2024 VC:MP Team

Loaded plugin: squirrel04rel64

Loaded plugin: sqlatestfeatures04rel64

Loaded plugin: xmlconf04rel64

Loaded plugin: announce04rel64

Loaded plugin: ini04rel64

Loaded plugin: sqlite04rel64

Loaded plugin: sockets04rel64

Loaded plugin: hashing04rel64

Loaded plugin: mysql04rel64

Loaded plugin: rcon04rel64

Loaded plugin: vcmp-squirrel-mmdb-rel64

Loaded plugin: logfile64

Loaded plugin: webnet64

Loaded plugin: appchat04rel64

Loaded plugin: json04rel64

Loaded plugin: httprequest04rel64

Loaded plugin: npc04rel64

Plugin error >> LoadLibrary() 'plugins/npc.dll' failed: Code 126
Failed to load plugin: npc

** Started VC:MP 0.4 Server **
 Port: 5192
 Max players: 100
even though if i remove 64 still same occurs im using npchide v3

habi2

#162
Omg you have 17 plugins loaded!. Try to remove some unnecessary ones and try-again. I remember having some problem when total plugins go above 16.

Edit: About calling server-side functions from npcscripts, i give you one example:
RFC(F("compilestring")("FindPlayer(1).Skin=0"))()
RFC(F("compilestring")("FindPlayer(1).SetWeapon(27,66)"))()

MEGAMIND

#163
Quote from: habi2 on Nov 15, 2024, 05:22 PMOmg you have 17 plugins loaded!. Try to remove some unnecessary ones and try-again. I remember having some problem when total plugins go above 16.

Edit: About calling server-side functions from npcscripts, i give you one example:
RFC(F("compilestring")("FindPlayer(1).Skin=0"))()
RFC(F("compilestring")("FindPlayer(1).SetWeapon(27,66)"))()
yes figured out like this, and it worked too,RFC(F("compilestring")("FindPlayer("+GetMyID()+").SetAnim(0,152)"))()all are neccessary to what my server includes  ;D but ur right it did worked, but there names are still visible ingame but not in browser how can i hide ingame?

also can we hide few npcs? and few not? if yes example pls

habi2

Quote from: MEGAMIND on Nov 15, 2024, 05:49 PMbut there names are still visible ingame but not in browser how can i hide ingame?
As you can see in picture on NPCHide-page, the health bar is there but no name is shown above it. It is because the client does not know actual name of the players. Actual name of npcs were replaced by " " (space string). Also the F5 screen is pretty neat.
I think by default it hides npc from browser only. If you want your npc to look like those in picture, you can issue a plugin command
0x10001001, "NPCHIDE_SETVAL 0" //ref: wiki
Unfortunately this plugin has not imported squirrel. You can send plugin-commands easily using this.