NPC/Bots implementation in VCMP 0.4 Servers

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

Previous topic - Next topic

habi2

Quote from: [TDA]Speed on Feb 04, 2025, 04:42 PMHello hapi, i wonder if you will add something like Npc.Walkto and Npc.Run like normal player walking and running because walktopoint is walking without anim and not so perefct i hope you added these two

I understand you want npc.walkto( position ) and npc.run( ) like normal player walking and running. It would be great to have it pre-built.

i will check if anything can be done about this issue.

[TDA]Speed

Quote from: habi2 on Feb 05, 2025, 03:53 PM
Quote from: [TDA]Speed on Feb 04, 2025, 04:42 PMHello hapi, i wonder if you will add something like Npc.Walkto and Npc.Run like normal player walking and running because walktopoint is walking without anim and not so perefct i hope you added these two

I understand you want npc.walkto( position ) and npc.run( ) like normal player walking and running. It would be great to have it pre-built.

i will check if anything can be done about this issue.
alright, thank you

PSL

Hi, Habi.
I have been using the NPC plug-in you developed. The appearance of NPC has enriched the gameplay of the game. I would like to express my heartfelt thanks to you. After a period of use, I found that if you can add some specific functions to the plug-in, it may further improve its functionality and practicality. I would like to add some functions related to getting properties. I made a feature that fits my needs. Although I have already built it, I still want to integrate it into the plugin.
function OnPlayerStreamIn(playerid)
{
    print("npctest: OnPlayerStreamIn(playerid="+playerid+")\n");

//When you find a player, save player attributes first
getPlayerImmunity(playerid);
}

function OnPlayerStreamOut(playerid)
{
    print("npctest: OnPlayerStreamOut(playerid="+playerid+")\n");

//Here I have written a function that empties the player's attributes
}

function onGetImmunity(playerID, immunity){
print(GetPlayerName(playerID)+"'s Immunity: "+immunity+" \n");

//I store the data in a table and use the following function to get it when needed
}

function getPlayerImmunity(playerID){
//Get the player attributes I want from the table
}

function toGetPlayerImmunity(playerID){
RFC("getPlayerImmunity")(playerID, GetMyID());
}

//server
function getPlayerImmunity(playerID, npcID){
local plr = FindPlayer(playerID);
if(plr){
RFC(npcID, "onGetImmunity")(plr.ID, plr.Immunity);
}
}

Now you can use getPlayerImmunity to get the player's immunity in NPC scrpit. I've done a lot of things with this approach, such as player transparency, player cash, player deposits, whether a player can be attacked, player IP, UID, etc, Your varholder plugin has also helped me a lot.

I understand that adding these functions may increase your workload, but I believe that these new functions will not only meet my personal needs, but may also benefit more users, thus further increasing the value and popularity of the plug-in.
If you are willing to consider my request, I would be more than happy to provide you with more information about the specific details and usage scenarios of these functions to help you better understand my requirements. If there is anything I can do to help during the development process, such as testing new features, please feel free to ask and I will assist in any way I can.
Thank you again for developing such an excellent plugin and look forward to hearing from you.

habi2

Yes PSL,
I am happy that you find the plugin useful.

It is an excellent idea to make the properties of different players available in the npc script. I made a list to begin with:
Immunity, IP, Cash, UID, Alpha (transparency), CanAttack, CanDriveby, Ping
and many more.

I will try to add these into the plugin soon.