Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public MoveZombie(zombieid)
- {
- if(GetRNPCHealth(dZombie[zombieid][dZombieID]) > 0 && dZombie[zombieid][dZombieID] != INVALID_PLAYER_ID)
- {
- new Float:x, Float:y, Float:z, Float:x2, Float:y2, Float:z2;
- new dDirection;
- new victim = GetZombieVictim(zombieid);
- if(victim == INVALID_PLAYER_ID)
- {
- GetPlayerPos(dZombie[zombieid][dZombieID], x, y, z);
- dDirection = RandomEx(1, 9);
- RNPC_FinishBuild(0);
- RNPC_StopPlayback(dZombie[zombieid][dZombieID]);//RNPC_PauseRecordingPlayback(dZombie[zombieid][dZombieID]);
- RNPC_CreateBuild(dZombie[zombieid][dZombieID], PLAYER_RECORDING_TYPE_ONFOOT, zombieid);
- new dPathTries = 0;
- new dNode = 0;
- createbuild:
- dPathTries ++;
- for(new i = 0; i < 5; i ++)
- {
- new dTries = 0;
- takepos:
- if(dTries == 5)
- {
- break;
- }
- z2 = z;
- switch(dDirection)
- {
- case 1://N
- {
- x2 = x + floatrand(-0.2, 0.2);
- y2 = y + floatrand(0.5, 1.5);
- CA_FindZ_For2DCoord(x2, y2, z2);
- }
- case 2://NO
- {
- x2 = x + floatrand(-0.3, -0.7);
- y2 = y + floatrand(0.3, 0.7);
- CA_FindZ_For2DCoord(x2, y2, z2);
- }
- case 3://O
- {
- x2 = x + floatrand(-0.5, -1.5);
- y2 = y + floatrand(-0.2, 0.2);
- CA_FindZ_For2DCoord(x2, y2, z2);
- }
- case 4://SO
- {
- x2 = x + floatrand(-0.3, -0.7);
- y2 = y + floatrand(-0.3, -0.7);
- CA_FindZ_For2DCoord(x2, y2, z2);
- }
- case 5://S
- {
- x2 = x + floatrand(-0.2, 0.2);
- y2 = y + floatrand(-0.5, -1.5);
- CA_FindZ_For2DCoord(x2, y2, z2);
- }
- case 6://SE
- {
- x2 = x + floatrand(0.3, 0.7);
- y2 = y + floatrand(-0.3, -0.7);
- CA_FindZ_For2DCoord(x2, y2, z2);
- }
- case 7://E
- {
- x2 = x + floatrand(0.5, 1.5);
- y2 = y + floatrand(-0.2, 0.2);
- CA_FindZ_For2DCoord(x2, y2, z2);
- }
- case 8://NE
- {
- x2 = x + floatrand(0.3, 0.7);
- y2 = y + floatrand(0.3, 0.7);
- CA_FindZ_For2DCoord(x2, y2, z2);
- }
- }
- dTries ++;
- z2 += 1.0;
- if(z2 == 1.0 || z > z2 + 2.0 && dTries != 5) goto takepos;
- RNPC_AddMovement(x, y, z, x2, y2, z2, RNPC_SPEED_WALK, 0);
- x = x2, y = y2, z = z2;
- dNode = i;
- printf("Zombie %d - %d", zombieid, i);
- }
- if(dNode == 0) RNPC_AddMovement(x, y, z, x, y, z, RNPC_SPEED_WALK, 0), printf("Zombie %d dNode = 0", zombieid);
- RNPC_FinishBuild();
- printf("Zombie %d FinishBuild", zombieid);
- if(dNode == 0)
- {
- printf("Zombie %d dNodes = 0", zombieid);
- if(dPathTries == 3) SetRNPCHealth(dZombie[zombieid][dZombieID], 0.0, INVALID_PLAYER_ID, 51), printf("Zombie %d Killed", zombieid);
- else { printf("Zombie %d goto createbuild", zombieid); goto createbuild; }
- }
- else
- {
- RNPC_StartBuildPlayback(dZombie[zombieid][dZombieID], zombieid);
- printf("Zombie %d StartBuildPlayback", zombieid);
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement