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

Mauzen, i edited RNPC and implement new thread on function "CreateBuild" (is best )
Reply
#62

Quote:
Originally Posted by [FeK]DraKiNs
Посмотреть сообщение
Mauzen, i edited RNPC and implement new thread on function "CreateBuild" (is best )
I could do that too. But what happens with bug fixes and new features? Do you have all the time to see the changes? Of course if you modified CreateBuild you must modify it again if some features was added and was implemented on it.
Reply
#63

Help: after i created a build and do playback the rnpc walks to the center of the map. with vehicle recording happens the same. Does anybody know what im doing wrong here ? In createbuild the rnpc stands far away from 0.00,0.00,0.00.
Any other things of the build (like weapons) are added correctly I tried startbuildplayback and startplayback .
Reply
#64

you need to insert the absolute coordinates as parameters in the moving functions like
pawn Код:
RNPC_ConcatMovement(x,y,z,speed)
..if you are using relative coordinates, like 10.0000,0.0000,0.0000 (to move to the right), then the bot will goto the (absolute) map coords 10.0, 0.0, 0.0 - the middle of the map, located @ Blueberry Acres. if that ever happens, check out all your coordinate parameters.
Reply
#65

Quote:
Originally Posted by [FeK]DraKiNs
Посмотреть сообщение
Mauzen, i edited RNPC and implement new thread on function "CreateBuild" (is best )
Hehe nice, does it work well even with the current version?

Quote:
Originally Posted by Babul
Посмотреть сообщение
you need to insert the absolute coordinates as parameters in the moving functions like
pawn Код:
RNPC_ConcatMovement(x,y,z,speed)
..if you are using relative coordinates, like 10.0000,0.0000,0.0000 (to move to the right), then the bot will goto the (absolute) map coords 10.0, 0.0, 0.0 - the middle of the map, located @ Blueberry Acres. if that ever happens, check out all your coordinate parameters.
Guess I explained that function wrong, it doesnt move the NPC relatively, but moves him to the specified position starting from his current one, so you dont need to get his position for every movement manually.
However, rlative movements are a nice idea, I think im going to add that.
Reply
#66

I get it lol thanks its funny to see how you get new ideas Mauzen good luck!
Reply
#67

Sometimes, when i key fire on them, and they have a weapon they glitch on a position and ignore the new/current target.
Reply
#68

per-npc timer set to 100 ms - 16 rnpcs - ~1000 nodes close to navigate - quick dirty hit detection, bullets flying through bots, hitting more at once (was a bug, now i find it nice heh):
[ame]http://www.youtube.com/watch?v=RcYF3xQia-k&feature=plcp[/ame]
..and heres another one with 64 rnpcs with timers set to 250ms (using the jit plugin to compensate lag lol)
[ame]http://www.youtube.com/watch?v=vQUqbR7uuvU&feature=plcp[/ame]
...i know, the bots are acting retarded - thats due to the pathfinding, and the precise movements on 2 axis. atm theyre not using any trigonometric functions to aim for players. yet.
Reply
#69

Works well, and will not give problems because in the new thread does not contain functions that call pawn

I send you the code via mp, okay?


____

Hey Mauzen

pawn Код:
SendClientMessage(playerid, -1, "RNPC:102");
This acts as a "StopRNPC" (stopMove ) ?
Reply
#70

Will try a few things when this version gets a lot simpler, as I'm pretty noob in this plugin D:
Reply
#71

Just had a question:

Is there a way to 'lock' NPC's to the ground like RNPC_AddMovementAlt but then with MoveRNPC?
Reply
#72

@Babul: Nice vids, good to see that it can handle that many npcs with relatively low lag

@[FeK]DraKiNs: Sounds nice feel free to send me the PM, would be interesting to see how it works. However Ill probably just add it in 0.4, not in the next one or two versions, as these will be major bugfixes, and threading will make all the debugging harder
And right, the NPC script listens for client messages, and 102 is the code to stop the current playback. Theres also a list of all used codes in the RNPC.pwn source.

@RobinOwnz: Youll need to bring some patience then With my current plans I can just start creating the easier functions in version 0.4 or 0.5, till then developement is mainly stability, debugging, and performance.
Reply
#73

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
@RobinOwnz: Youll need to bring some patience then With my current plans I can just start creating the easier functions in version 0.4 or 0.5, till then developement is mainly stability, debugging, and performance.
Okay bebe.

Btw, any way to set facing angle of the NPC's? :P
Reply
#74

Quote:
Originally Posted by RobinOwnz
Посмотреть сообщение
Okay bebe.

Btw, any way to set facing angle of the NPC's? :P
what about

pawn Код:
native RNPC_SetQuat1(Float:w); // Better use SetAngleQuats than this
native RNPC_SetQuat2(Float:x);
native RNPC_SetQuat3(Float:y);
native RNPC_SetQuat4(Float:z);
?
Reply
#75

You can do that wiht RNPC_SetAngleQuats(a, b, c)
a and c rotate the y axis and so create strange rotations, but b is the facing angle
This also needs to be in a RNPC_CreateBuild block of course, e.g.
pawn Код:
RNPC_CreateBuild(npcid, PLAYER_RECRDING_TYPE_ONFOOT);
// Set angle
RNPC_SetAngleQuats(0.0, 80.0, 0.0);
// Add a short pause to apply the angle
RNPC_AddPause(100);
RNPC_FinishBuild();

// Playback sets the NPCs facing angle
RNPC_StartPlayback(npcid);
(Thats basically how a later SetRNPCFacingAngle function would look like
But the problem is that it needs to consider all the current attributes of the NPC, like where he is walking etc)

@Archer: this would also work of course, but SetAngleQuats got a plugin-sided angle-to-quat converter, so it will be faster than calculating the quaternions in pawn
Reply
#76

Quote:
Originally Posted by ipsBruno
View Post
Exactly. I do not understand why these values. - But the correct read is by the "path.ipl"
Cause the San Andreas area map has these values.
Reply
#77

Quote:
Originally Posted by ipsBruno
View Post
Exactly. I do not understand why these values. - But the correct read is by the "path.ipl"
I guess the values are unsigned and the "ipl 0/0" is the "gta -3000/-3000" so you basically just need to subtract 3000 from x/y to get it samp ready.
Reply
#78

Quote:
Originally Posted by Mauzen
View Post
I guess the values are unsigned and the "ipl 0/0" is the "gta -3000/-3000" so you basically just need to subtract 3000 from x/y to get it samp ready.
I thought the same. Maybe Kalcor have decreased the value to represent the map of GTA SA, anyway i noticed that the readings of paths.ipl are clearly legible. They are what you need?
Reply
#79

They cant shoot on a Linux Server.
Reply
#80

ConnectRNPC does not always return the correct ID when used in OnGameModeInit or main.
Fix: Create NPCs slightly delayed with a timer when the gamemode is fully loaded.


This happens because there's a delay to the NPC connects to the server. Try this:

Code:
new g_iTickCount = -1;

public OnGameModeInit( )
{
	g_iTickCount = GetTickCount( );

	ConnectRNPC( "Test" );

	return 1;
}

public OnPlayerConnect( playerid )
{
	printf( "Delay: %ims.", GetTickCount( ) - g_iTickCount );

	return 1;
}
As you see, OnPlayerConnect is called 250 ~ 300ms after we call ConnectRNPC.

ConnectRNPC basically checks for a empty slot and returns it. But a slot is only occupied when OnPlayerConnect is called.

I'm sayin that if we do this:

Code:
A = ConnectRNPC( "Test1" );
B = ConnectRNPC( "Test2" );
A and B will have the same ID value, because the function will return the same empty slot and will probably screw with your code when you call MoveRNPC, for example.

Ok, so how to fix that ?!

I've modified the rnpc.inc. Look:

Code:
static bool: g_bConnected[MAX_PLAYERS char];

stock ConnectRNPC(name[])
{
	new slotid = -1;

	for (new i = 0; i < MAX_PLAYERS; i++) {
		if (!g_bConnected{i}) {
			ConnectNPC(name, "RNPC");
			g_bConnected{i} = true;
			slotid = i;
			break;
		}
	}

	return slotid;
}

stock RNPC_OnPlayerConnect(playerid)
	g_bConnected{playerid} = true;

stock RNPC_OnPlayerDisconnect(playerid)
	g_bConnected{playerid} = false;
It works, returns the correct ID, you need to call RNPC_OnPlayerConnect and RNPC_OnPlayerDisconnect on the respective native SA:MP callbacks [I don't know how to use ASL], but still have a problem - if you connect a lot of NPCs, like 7 or more at the same time, g_bConnected will be set to true but SA:MP will block the connection of the NPCs because of a false 'attack'; OnPlayerDisconnect will be not called and g_bConnected will be defined as true, when it shouldn't.

So, we know what's the reason of the bug, but we haven't a solution yet.

Sorry for my bad english g.g
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)