[Plugin] RNPC - Recordfree NPCs | Control NPCs without recording | DEV

Quote:
Originally Posted by xDarkuzSx
Посмотреть сообщение
Hi, I have other question...
As I can do to who the NPC's not float?
I use the function: RNPC_AddMovementAlt
But if I wear under of a bridge the NPC's rise up (above of the bridge) and is very annoying,їhow to i can make a function that does not float but they are always glued to the floor?

D.P: Sorry for my English, but it is I am from Mexico and I'm learning English.
The NPCs cant see or detect collision or whatever. RNPC uses the mapandreas data, and that data just contains the highest position at certain 2D coordinates. So NPCs also can just move on that highest position, they simply cant differ between a bridge or a all-solid building. Currently theres no alternative, might be possible to create mapandreas with multiple layers, but this would be quite complicated and probably slow.
Reply

I do not know how to use RNPC_AnimID.
Reply

my suggestion

pawn Код:
native RNPCStopAttackPlayer(npcid,playerid);
native RNPCAttackPlayer(npcid,tergetid,damage);
Reply

after i compile it it say

warning 203: symbol is never used: "RNPC_StopPlayback"

help :/
Reply

Quote:
Originally Posted by Guest123
Посмотреть сообщение
my suggestion

pawn Код:
native RNPCStopAttackPlayer(npcid,playerid);
native RNPCAttackPlayer(npcid,tergetid,damage);
You could script that feature, just point the NPC at the player direction and use SetKeys(0x128 + 4) to attack, i suggest that u use the ARNPC include, it has some functions to attack a player
Reply

can you give me ths script, i didn't uderstand the script pls help
Reply

Next round of answers incoming
Quote:
Originally Posted by LikeNPC
View Post
I do not know how to use RNPC_AnimID.
I also dont fully understand animations yet. Simply speaking, the NPC performs an animation as long as the same animation id is set (that the id you can get via GetPlayerAnimationIndex, pretty sure theres a list of all the animation ids somewhere). Then you could e.g. do this:
pawn Code:
RNPC_CreateBuild(npcid, PLAYER_RECORDING_ONFOOT);
RNPC_SetAnimID(1234); // Set animation
RNPC_AddPause(5000); // Perform it for 5 seconds
RNPC_SetAnimID(0); // Reset the animation
RNPC_AddPause(1000); // Do nothing for a second
RNPC_SetAnimID(1234); // Set animation again
RNPC_AddPause(5000); // performs animation from the beginning again
RNPC_FinishBuild();
Now theres the RNPC_SetAnimParams setter. It acutally doesnt set a single parameter, but that single variable contains multiple animation parameters at different bit offsets. Most likely in the same order as for ApplyAnimation, but I didnt experiment with animations a lot.

Quote:
Originally Posted by Guest123
View Post
my suggestion

pawn Code:
native RNPCStopAttackPlayer(npcid,playerid);
native RNPCAttackPlayer(npcid,tergetid,damage);
Thats a quite high-level function. So far not even the low-level stuff is working perfectly (simple movement, simple shooting, etc) so I wont create any mid- and highlevel stuff until the base is working as it should, else the new functions will be buggy too, and that wouldnt help anyone.
But if you need these functions, you can script them yourself easily . You could also try the FCNPC plugin, it is rather practical for direct controls like this.

Quote:
Originally Posted by Fitri
View Post
after i compile it it say

warning 203: symbol is never used: "RNPC_StopPlayback"

help :/
You can ignore that warning, it disappears if you use RNPC_StopPlayback once in your script, else it just informs you that you dont use it.

Quote:
Originally Posted by Fitri
View Post
can you give me ths script, i didn't uderstand the script pls help
I cant. I dont even know what script youre talking about. If this plugin is too complicated, dont use it. Its no shame as this one is really tricky to use. Better take a look at FCNPC then.
Reply

Quote:
Originally Posted by Fitri
View Post
after i compile it it say

warning 203: symbol is never used: "RNPC_StopPlayback"

help :/
Quote:
Originally Posted by Mauzen
View Post
You can ignore that warning, it disappears if you use RNPC_StopPlayback once in your script, else it just informs you that you dont use it.
What about adding this?

pawn Code:
#pragma unused RNPC_StopPlayback
Reply

Quote:
Originally Posted by Gryphus One
View Post
What about adding this?

pawn Code:
#pragma unused RNPC_StopPlayback
what about adding stock to RNPC_StopPlayback ?
Reply

There once was a reason why its no stock, but actually the whole function is nothing more but a define now, and I forgot to make it one before release.
Also, I dont like using #pragma unused, IMO its dirtier than having a warning on every compile. And it makes you forget about all your unused variables and functions, making the code even dirtier

If that warning annoys you, just edit the include and add stock or #pragma.
Reply

Is there a tutorial somewhere on how to use this? I don't understand how the functions don't have an NPC ID parameter - how do you handle multiple NPCs? Seems very counterintuitive.

After looking through the include file and finding this:

pawn Code:
native RNPC_CreateBuild(npcid, type, slot=0);
native RNPC_FinishBuild(clear=1);
I still have no idea what to do. Why is there absolutely NO documentation AT ALL..? Not exactly convincing me to use it.
Reply

Quote:
Originally Posted by MP2
View Post
Is there a tutorial somewhere on how to use this? I don't understand how the functions don't have an NPC ID parameter - how do you handle multiple NPCs? Seems very counterintuitive.

After looking through the include file and finding this:

pawn Code:
native RNPC_CreateBuild(npcid, type, slot=0);
native RNPC_FinishBuild(clear=1);
I still have no idea what to do. Why is there absolutely NO documentation AT ALL..? Not exactly convincing me to use it.
Sure, I never said its easy. If you know how the .rec files work, it will be rather intuitive. You create a new file, write a sequence of "actions" into it, and close it. Thats what the "Build" does. As this plugin is in very early developement, i didnt much spent time for making it easier to use, but rather worked on making it work in general. Just imagine the plugin to rather be a "rec file creator", than a "npc control plugin", yet.
Also, there is some documentation. I link to the wiki page in the first post https://sampwiki.blast.hk/wiki/Rnpc it explains all the functions and gives example code And as said, if its not good enough, read through my rec file documentation https://sampwiki.blast.hk/wiki/.rec_file to learn how samps npcs work, and you will also learn how to use this plugin.
Reply

Oh right, I see.
Reply

Works in Version 0.3x Running? I heard that only works on 0.3e
Reply

Quote:
Originally Posted by Mteck
View Post
Works in Version 0.3x Running? I heard that only works on 0.3e
Didnt test it, but technically it should work as it does in 0.3e
Reply

How i can solve this warning ?

Code:
C:\Users\ZombieLand\Desktop\Servidor\gamemodes\RNPCPRUEBA.pwn(33) : warning 235: public function lacks forward declaration (symbol "Follower")
Code:
stock FollowPlayer(npcid, targetid)
{
    SetTimerEx("Follower", 500, 1, "ii", npcid, targetid);
}

public Follower(npcid, targetid)
{
    new Float:x, Float:y, Float:z;
    GetPlayerPos(targetid, x, y, z);
    MoveRNPC(npcid, x, y, z, 0.006);
}
Reply

You must forward every public function. If you don't forward a public function, you will get the warning 235. Add the following line somewhere (along with other function declarations) at the top of your script:

pawn Code:
forward Follower(npcid, targetid);
Reply

Thanks Pooh7 it compiled me perfect , but i have a question :

Code:
public OnGameModeInit()
{
    new Name[24];
    for( new i = 0; i < 5; i++ )
    {
         format(Name, 24, "NPC_%d", i);
         NPC_ID[i] = (ConnectRNPC(Name), i);

         printf("NPC IDs: %d", NPC_ID[i]);
    }
	return 1;
}
I need to the bots spawn but i can't find any code like RNPC_Spawn or something like that ..
Reply

Quote:
Originally Posted by SnL
View Post
Thanks Pooh7 it compiled me perfect , but i have a question :

Code:
public OnGameModeInit()
{
    new Name[24];
    for( new i = 0; i < 5; i++ )
    {
         format(Name, 24, "NPC_%d", i);
         NPC_ID[i] = (ConnectRNPC(Name), i);

         printf("NPC IDs: %d", NPC_ID[i]);
    }
	return 1;
}
I need to the bots spawn but i can't find any code like RNPC_Spawn or something like that ..
I don't use the plugin, but I think SpawnPlayer() works for NPCs too. Give it a try.
Reply

Quote:
Originally Posted by SnL
View Post
Thanks Pooh7 it compiled me perfect , but i have a question :

Code:
public OnGameModeInit()
{
    new Name[24];
    for( new i = 0; i < 5; i++ )
    {
         format(Name, 24, "NPC_%d", i);
         NPC_ID[i] = (ConnectRNPC(Name), i);

         printf("NPC IDs: %d", NPC_ID[i]);
    }
	return 1;
}
I need to the bots spawn but i can't find any code like RNPC_Spawn or something like that ..
replace with

pawn Code:
public OnGameModeInit()
{
    new Name[24];
    for( new i = 0; i < 5; i++ )
    {
         format(Name, 24, "NPC_%d", i);
         NPC_ID[i] = ConnectRNPC(Name);

         printf("NPC IDs: %d", NPC_ID[i]);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)