[Support] Zombie Counter! Help

Topic created · 10 Posts · 423 Views
  • Any way to put a zombie counter on the screen that shows the remaining zombies from the current round left to kill?

  • drawZombiesCounter()
    {
        level.zombiesCountDisplay = createServerFontString("Objective" , 1.7);
        level.zombiesCountDisplay setPoint("RIGHT", "CENTER", 315, "CENTER");
    
        thread updateZombiesCounter();
    }
    
    updateZombiesCounter()
    {
        level endon("stopUpdatingZombiesCounter");
    
        while(true)
        {
            zombiesCount = get_current_zombie_count();
            level.zombiesCountDisplay setSafeText("Zombies: " + zombiesCount);
    
            waitForZombieCountChanged("stopUpdatingZombiesCounter");
        }
    }
    
    recreateZombiesCounter()
    {
        level notify("stopUpdatingZombiesCounter");
    
        thread updateZombiesCounter();
    }
    
    waitForZombieCountChanged(endonNotification)
    {
        level endon(endonNotification);
    
        oldZombiesCount = get_current_zombie_count();
    
        while(true)
        {
            newZombiesCount = get_current_zombie_count();
    
            if(oldZombiesCount != newZombiesCount)
            {
                return;
            }
    
            wait 0.05;
        }
    }
    
  • @ted said in Zombie Counter! Help:

    setSafeText

    Yes, I found that on google, only I tried it and the function "setSafeText" does not work, so I changed it to "SetText" and there it worked.

    https://gyazo.com/44edd9c1785a71186def0b0093843248

    Here the source: https://cabconmodding.com/threads/zombies-counter-display.149/
    And also here the other "SetText" solution: https://www.ugx-mods.com/forum/scripts/55/how-to-add-a-zombie-counter/4152/

  • @Kalitos Hola buen día, disculpa, soy nuevo con esto de modificar el juego y todo eso. ¿Podrías explicarme exactamente en qué lugar necesito copiar y pegar este código que has compartido? Para que me aparezca el contador de zombies. Gracias 🙂

  • @Don-Mishi Búscame en el Discord de Plutonium y escríbeme

  • Disculpa, me dice que tu Discord es incorrecto. ¿Podrías agregarme?
    Discord: El Shesho#5381

  • f675f088-7d8b-4bd9-91a9-081d5271d7e8-image.png

    Anexo un error que me da, copié el código de esta página que pusiste: https://cabconmodding.com/threads/zombies-counter-display.149/

    Corregí el error que daba sobre el "setSafeText" y lo cambié a "setText" y se solucionó.

  • @Don-Mishi Entonces ya pudiste hacerlo funcionar ?

  • @Kalitos Pude solucionar el error del "setSafeText", el problema que aparece en la imagen aún no.

  • @Don-Mishi prueba esto

    /*
    *	 Black Ops 2 - GSC Studio by iMCSx
    *
    *	 Creator : vkarl
    *	 Project : arma
    *    Mode : Zombies
    *	 Date : 2020/03/25 - 10:53:48	
    *
    */	
    
    #include common_scripts\utility;
    #include maps\mp\zombies\_zm;
    #include maps\mp\zombies\_zm_utility;
    #include maps\mp\gametypes_zm\_hud_util;
    #include maps\mp\gametypes_zm\_hud_message;
    
    init()
    {
    	level.clientid = 0;
    	level.perk_purchase_limit = 9;
    	level thread onplayerconnect();
    	drawZombiesCounter();
    }
    
    onplayerconnect()
    {
    	for ( ;; )
    	{
    		level waittill( "connecting", player );
    		player.clientid = level.clientid;
    		level.clientid++;
    	}
    }
    
    
    createServerText(font, text, fontScale, point, relativePoint, x, y, color, glowColor, alpha, glowAlpha, sort, team) {
    	elem = createServerFontString(font, fontScale, team);
    	elem setPoint(point, relativePoint, x, y);
    	elem setText(text);
    	elem.color = color;
    	elem.glowColor = glowColor;
    	elem.alpha = alpha;
    	elem.glowAlpha = glowAlpha;
    	elem.sort = sort;
    	
    	return elem;
    }
    
    drawZombiesCounter()
    {
        level.zombiesCountDisplay = createServerFontString("Objective" , 1.7);
        level.zombiesCountDisplay setPoint("RIGHT", "CENTER", 315, "CENTER");
    
        thread updateZombiesCounter();
    }
    
    updateZombiesCounter()
    {
        level endon("stopUpdatingZombiesCounter");
    
        while(true)
        {
            zombiesCount = get_current_zombie_count();
            level.zombiesCountDisplay SetText("Zombies: " + zombiesCount);
    
            waitForZombieCountChanged("stopUpdatingZombiesCounter");
        }
    }
    
    recreateZombiesCounter()
    {
        level notify("stopUpdatingZombiesCounter");
    
        thread updateZombiesCounter();
    }
    
    waitForZombieCountChanged(endonNotification)
    {
        level endon(endonNotification);
    
        oldZombiesCount = get_current_zombie_count();
    
        while(true)
        {
            newZombiesCount = get_current_zombie_count();
    
            if(oldZombiesCount != newZombiesCount)
            {
                return;
            }
    
            wait 0.05;
        }
    }
    
Log in to reply