NPC creation timer...
#5

Quote:
Originally Posted by Marricio
Посмотреть сообщение
I see you're utilizing y_timers, however I won't make it any more complicated for you! Here it is.

pawn Код:
// OnGameModeInit
SetTimerEx("CreateZombies", 500, false, "i", 0);

forward CreateZombies(count);
public CreateZombies(count)
{    
    new str[24];
    new Random = random(sizeof(ZombieSpawns));
    format(str,sizeof(str),"Zombie[%d]",MAX_PLAYERS-(count));
    FCNPC_Create(str);
    FCNPC_Spawn(count,DayZ_Z_RandSkinZombie[random(sizeof(DayZ_Z_RandSkinZombie))],ZombieSpawns[Random][0],ZombieSpawns[Random][1],ZombieSpawns[Random][2]+0.7);
    FCNPC_SetAngle(count,ZombieSpawns[Random][3]);
    ZombiesAlive ++;
    ZombieTimer[count] = repeat ZombieMove(count);
    SetPlayerColor(count,0xFF0000FF);
    IsAZombie[count] = 1;

    SetTimerEx("CreateZombies", 500, false, "i", count + 1); // The trick is here!
    return 1;
}
Yeah, let's create zombies non-stop!

...

-----------------------------------------

1. Create a global variable with no cells
2. Create a timer that is set to repeat every 800-1000 ms
3. In the timer, spawn the zombie according to the value in the variable
4. Increment the value of the variable by 1
5. When the value of the variable is equal to the amount of zombies you want to spawn, kill the timer
Reply


Messages In This Thread
NPC creation timer... - by iLearner - 15.10.2016, 15:06
Re: NPC creation timer... - by iLearner - 15.10.2016, 16:40
Re: NPC creation timer... - by iLearner - 15.10.2016, 16:59
Respuesta: NPC creation timer... - by Marricio - 15.10.2016, 17:45
Re: NPC creation timer... - by SickAttack - 15.10.2016, 17:46
Respuesta: Re: NPC creation timer... - by Marricio - 15.10.2016, 17:56
Re: NPC creation timer... - by iLearner - 15.10.2016, 19:01
Re: NPC creation timer... - by iLearner - 15.10.2016, 19:16
Respuesta: NPC creation timer... - by Marricio - 15.10.2016, 21:03
Re: NPC creation timer... - by NaS - 16.10.2016, 05:28

Forum Jump:


Users browsing this thread: 2 Guest(s)