WhatsApp Discord
Rune effect Main 5.2 - Página 2 - Source Mu - Mu Server Files
 

Noticias:

SMF - Just Installed!

Menú principal

Rune effect Main 5.2

Publicado por Dakosmu, Mar 04, 2026, 07:27 AM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Dakosmu

un cuadro de texto flotante) que diga "TOP CLASS" o el nombre del rango sobre el personaje?

letrero flotante (etiqueta de texto) que aparezca justo encima de la cabeza de los jugadores que tengan el rango de TOP CLASS.

Esto se hace utilizando la función RenderText (o similar, dependiendo de tu cliente, a veces llamada DrawText). En el código de abajo, he integrado todo: el interruptor de auras, los niveles, la corona y ahora el título honorífico.


void RenderCharactersClient()
{
    // --- CONTROL DE TECLADO ---
    if (IsPress(VK_F10)) {
        g_ShowAuras = !g_ShowAuras;
    }

    for (int i = 0; i < MAX_CHARACTERS_CLIENT; ++i)
    {
        CHARACTER* c = gmCharacters->GetCharacter(i);
        OBJECT* o = &c->Object;

        if (g_ShowAuras && o->Kind == 1 && SceneFlag == MAIN_SCENE && o->Live)
        {
            if (!g_isCharacterBuff(o, eBuff_Cloaking))
            {
                vec3_t vLight, vPos, vFinalLumi;
                VectorCopy(o->Position, vPos);
                bool isGM = (c->CtlCode == 32 || c->CtlCode == 8);

                // --- SELECTOR DE COLORES POR CLASE ---
                switch (c->Class) {
                    case 0: Vector(0.2f, 0.4f, 1.0f, vLight); break; // Wizard - Azul
                    case 1: Vector(1.0f, 0.2f, 0.2f, vLight); break; // Knight - Rojo
                    case 2: Vector(0.2f, 1.0f, 0.4f, vLight); break; // Elf - Verde
                    case 3: Vector(0.7f, 0.2f, 1.0f, vLight); break; // MG - Morado
                    case 4: Vector(1.0f, 0.7f, 0.1f, vLight); break; // DL - Dorado
                    case 5: Vector(1.0f, 0.2f, 0.6f, vLight); break; // SU - Rosa
                    default: Vector(1.0f, 1.0f, 1.0f, vLight); break;
                }
                if (isGM) Vector(1.0f, 1.0f, 1.0f, vLight);

                // --- SISTEMA DE NIVELES (RESUMEN) ---
                if (c->Level >= 10 || isGM) {
                    EnableAlphaBlend();
                    RenderTerrainAlphaBitmap(BITMAP_GM_AURORA, o->Position[0], o->Position[1], 0.8f, 0.8f, vLight, WorldTime * 0.005f);
                    DisableAlphaBlend();
                }

                if (c->Level >= 400 || isGM) {
                    EnableAlphaBlend();
                    RenderTerrainAlphaBitmap(BITMAP_SUMMON_IMPACT, o->Position[0], o->Position[1], 2.2f, 2.2f, vLight, WorldTime * 0.015f);
                    DisableAlphaBlend();
                }

                // --- NUEVO: CORONA + TÍTULO TOP CLASS ---
                if (c->Rank == 1)
                {
                    // 1. Efecto Visual de Corona
                    vec3_t vCrownPos;
                    VectorCopy(o->Position, vCrownPos);
                    vCrownPos[2] += 230.f;
                   
                    float fLumi = sinf(WorldTime * 0.02f) * 0.2f + 0.8f;
                    Vector(1.0f * fLumi, 0.8f * fLumi, 0.0f, vFinalLumi); // Color Oro
                    CreateSprite(BITMAP_FLARE, vCrownPos, 1.2f, vFinalLumi, o, WorldTime * 0.05f);

                    // 2. TÍTULO FLOTANTE "TOP CLASS"
                    // Nota: Esta parte usa las coordenadas de pantalla del objeto
                    char szRankText[32];
                    sprintf(szRankText, "★ TOP %s ★", GlobalText[c->Class]); // Ej: ★ TOP KNIGHT ★
                   
                    // Configuramos el color del texto (Dorado)
                    g_pRenderText->SetFont(g_FontBold);
                    g_pRenderText->SetTextColor(255, 215, 0, 255); // Oro (RGBA)
                    g_pRenderText->SetBgColor(0, 0, 0, 150);       // Fondo negro semitransparente
                   
                    // Renderizamos el texto un poco más arriba de la cabeza
                    int x, y;
                    if (GetTargetPos(o->Position, x, y)) // Convierte 3D a 2D de pantalla
                    {
                        g_pRenderText->RenderText(x, y - 90, szRankText, 0, 0, RT3_WRITE_CENTER);
                    }

                    // 3. Partículas de Éxito
                    if (rand() % 5 == 0) {
                        vCrownPos[0] += (rand() % 40 - 20);
                        vCrownPos[1] += (rand() % 40 - 20);
                        CreateParticle(BITMAP_SPARK, vCrownPos, o->Angle, vFinalLumi, 1, 0.6f, o);
                    }
                }
            }
        }

        // Renderizado normal
        if (o->Live && o->Visible) {
            RenderCharacter(c, o, (i == SelectedCharacter || i == SelectedNpc));
        }
    }
}


Citarg_pRenderText->RenderText: Esta es la función estándar en clientes de Mu para escribir en pantalla. He configurado el texto en Negrita (g_FontBold) y color Dorado para que resalte.

RT3_WRITE_CENTER: Asegura que el texto esté centrado perfectamente sobre el personaje.

GetTargetPos: Es una función vital que traduce la posición del personaje en el mundo 3D a píxeles en tu pantalla 2D.

Título Dinámico: He usado GlobalText[c->Class] para que el sistema diga automáticamente "TOP WIZARD", "TOP KNIGHT", etc., dependiendo de la clase del jugador.
Bon Dia

🡱 🡳
Real Time Web Analytics