RNPC Plugin, Attack while Running build code
#1

Hi, I am using RNPC Plugin
My server version is low. (not 0.3.7)
So I can not use FCNPC Plugin


I want to make NPC attack while running
I tried a lot but all failed.
NPC is get weapon id 3.

If you AddPause the NPC, the movement stops..
I really want to see the attack while running
I need help.

Please Help me ...!



That's the build code I tried. (below)
result: fail.
Код:
RNPC_CreateBuild(npcid, PLAYER_RECORDING_TYPE_ONFOOT, 1);
RNPC_AddPause(250);

RNPC_SetWeaponID(3);
RNPC_AddPause(500);

RNPC_AddMovement(2331.5586,-1695.4564, 13.5436,
	2311.1862,-1695.4564,13.5436, RNPC_SPEED_SPRINT, 0);

RNPC_SetUDKeys(KEY_UP);
RNPC_SetKeys(4 + KEY_SPRINT);
RNPC_AddPause(500);

RNPC_SetKeys(0);
RNPC_AddPause(100);

RNPC_SetUDKeys(KEY_UP);
RNPC_SetKeys(4 + KEY_SPRINT);
RNPC_AddPause(1000);

RNPC_SetKeys(0);
RNPC_AddPause(100);


RNPC_ConcatMovement(2297.4673,-1695.4564,13.5436, RNPC_SPEED_SPRINT, 0);
RNPC_AddPause(50);

RNPC_SetUDKeys(KEY_UP);
RNPC_SetKeys(KEY_SPRINT);
RNPC_AddPause(150);

RNPC_AddPause(250);
RNPC_FinishBuild();
Reply
#2

RNPC is a bit limited in that aspect, but its possible.
Easiest way is to use a timer with an adequate interval (about 700ms for unarmed iirc), that alternates the FIRE_KEY and then adds the rest of the movement.

Код:
new firekey[MAX_PLAYERS];
public sometimer(npcid) {
RNPC_CreateBuild(npcid, PLAYER_RECORDING_TYPE_ONFOOT, 1);

RNPC_SetWeaponID(3);
RNPC_SetKeys((firekey[npcid]) ? 0: 4) + KEY_SPRINT);
firekey[npcid] = !firekey[npcid];
RNPC_AddMovement(2331.5586,-1695.4564, 13.5436,
	2311.1862,-1695.4564,13.5436, RNPC_SPEED_SPRINT, 0);

RNPC_FinishBuild();
RNPC_StartBuildPlayback(npcid, 1);
}
Theres a pretty easy way to do it without timers, by changing the RNPC source for AddMovement to automatically alternate the FIRE_KEY every few updates, e.g. if a certain parameter is set. Youll need some basic knowledge of c++ for that though.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)