Solo usuarios registrados pueden comentar y agradecer, Logueate o Registrate

Autor Topic: Tutorial Duelos Rondas MuEMU soucer  (Visto 455 veces)

0 Miembros and 1 Guest are viewing this topic.

Offline jaes Posteado: June 26, 2025, 07:05:19 PM | Modificado: June 26, 2025, 07:07:52 PM by jaes

  • 0 puntos por ventas
  • *
  • Rank: Dedicado
  • Posts: 44
  • Gracias recibida: 9
  • ar
Buenas gente hoy les comparto lo que pude hacer, ya que los files que uso no lo tenían es aumentar o disminuir la cantidad de rondas en duelos que hacen los pj me funciono a mi con mis files s6

lo siento si no es como se hace primera vez que hago algo de esto publicado! Me disculpo si no es de esta manera ojala se entienda! la mejor con el mundo de mu!!
https://ibb.co/B2bn9dDj


Guía para agregar sistema de rondas configurables en duelos de MuEMU Season 6
==============================================================================

📅 Fecha: 26/06/2025
📂 Proyecto: GameServer MuEMU
🎮 Funcionalidad: Duelos con cantidad de rondas configurables

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

1. ARCHIVO DE CONFIGURACIÓN - Common.dat
------------------------------------------

Agregá la siguiente línea en tu archivo:
Ruta: Data\Common.dat

[Duel]
DuelMaxRounds = 5

Este valor define cuántas rondas debe ganar un jugador para finalizar el duelo.

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

2. MODIFICACIONES EN Duel.h
----------------------------

Dentro de la clase CDuel (al final, en private:), agregá:

    int m_DuelMaxRounds;

Y en la parte pública si querés cargar por función:

    void LoadConfig();

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

3. MODIFICACIONES EN Duel.cpp
------------------------------

🔹 En CDuel::CDuel(), agregá esta línea para leer el valor de rondas:

    this->m_DuelMaxRounds = GetPrivateProfileInt("Duel", "DuelMaxRounds", 5, ".\\Data\\Common.dat");

(Si usás una función LoadConfig(), ponelo ahí en su lugar).

🔹 En ResetDuel(), agregá:

    lpObj->DuelRound = 0;

🔹 En UserDieProc(), reemplazá el contenido completo por la función modificada que:
    - Suma rondas con DuelRound++
    - Anuncia al jugador la ronda ganada
    - Finaliza el duelo si se alcanzan las rondas máximas

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

4. MODIFICACIONES EN User.h
-----------------------------

Dentro de la estructura OBJECTSTRUCT, agregá:

    int DuelRound;

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

5. MENSAJE EN PANTALLA - Reemplazo de GCServerMsgStringSend
-------------------------------------------------------------

Si te da error "GCServerMsgStringSend no definido", usá este reemplazo:

    gNotice.GCNoticeSend(lpObj->Index, 1, 0, 0, 0, 0, 0, szMsg);

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

6. CODIFICACIÓN DEL ARCHIVO (IMPORTANTE)
-----------------------------------------

Cuando guardes Duel.cpp o Duel.h, si te aparece el mensaje:
"¿Desea guardar como Unicode?"

✅ Elegí **Sí** y guardá como UTF-8 (sin BOM si tu editor lo permite).

Esto evita que se pierdan caracteres especiales como acentos.

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

7. COMPILACIÓN
---------------

Luego de aplicar todos los cambios:

✅ Recompilá el GameServer.
✅ Reemplazá el ejecutable.
✅ Verificá en el cliente que los duelos ahora terminen según las rondas.

¡Listo! Ya tenés duelos con rondas configurables al estilo PvP competitivo.


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

8. FUNCION COMPLETA: CDuel::UserDieProc()
------------------------------------------

Reemplazá la función entera en Duel.cpp por esta versión modificada:

void CDuel::UserDieProc(LPOBJ lpObj, LPOBJ lpTarget) // OK
{
    if (this->CheckDuel(lpObj, lpTarget) == 0)
    {
        return;
    }

    // Aumentar puntuación
    lpTarget->DuelScore++;
    lpTarget->DuelRound++;

    this->GCDuelScoreSend(lpObj->Index, lpTarget->Index);

    #if(GAMESERVER_UPDATE>=402)
    DUEL_ARENA_INFO* lpInfo = this->GetDuelArenaByGladiator(lpObj->Index);

    if (lpInfo != 0)
    {
        this->GCDuelScoreSend(lpInfo);
    }
    #endif

    // Anunciar ronda ganada
    char szMsg[128];
    sprintf(szMsg, "[Duel] %s ha ganado la ronda %d", lpTarget->Name, lpTarget->DuelRound);
    gNotice.GCNoticeSend(lpTarget->Index, 1, 0, 0, 0, 0, 0, szMsg);
    gNotice.GCNoticeSend(lpObj->Index, 1, 0, 0, 0, 0, 0, szMsg);

    // Verificar si alcanzó la cantidad de rondas necesarias
    if (lpTarget->DuelRound >= this->m_DuelMaxRounds)
    {
        gAchievements.DuelWin(lpTarget->Index);

        this->ResetDuel(lpObj);
        this->ResetDuel(lpTarget);

        this->GCDuelEndSend(lpObj->Index, 0);
        this->GCDuelEndSend(lpTarget->Index, 0);

        GDRankingDuelSaveSend(lpTarget->Index, 1, 0);
        GDRankingDuelSaveSend(lpObj->Index, 0, 1);

        GCFireworksSend(lpTarget, lpTarget->X, lpTarget->Y);

        #if(GAMESERVER_UPDATE>=402)
        if (lpInfo != 0)
        {
            this->GCDuelWinSend(lpInfo, lpTarget->Name, lpObj->Name);

            gEffectManager.AddEffect(lpTarget, 0, EFFECT_GLADIATORS_GLORY, 3600, 20, 0, 0, 0);

            if (gServerInfo.m_DuelArenaAnnounceSwitch != 0)
            {
                gNotice.GCNoticeSendToAll(0, 0, 0, 0, 0, 0, gMessage.GetMessage(175), lpTarget->Name, lpObj->Name);
            }

            this->SetState(lpInfo, DA_STATE_CLEAN);
        }
        #endif
    }
    else
    {
        // Continuar siguiente ronda
        this->RespawnDuelUser(lpObj);
        this->RespawnDuelUser(lpTarget);
    }
}
====================================================================================================================
Si esta mal o necesita mejora y quieren ayudar y aportar sea bienvenido pero a mi me funciono perfectamente

Gracias:


Online sonytfm #1 Posteado: June 26, 2025, 08:16:13 PM

  • 0 puntos por ventas
  • *
  • Rank: Puto amo
  • Posts: 402
  • Gracias recibida: 3464
  • ar

Solo usuarios registrados pueden comentar y agradecer, Logueate o Registrate


 

Related Topics

  Subject / Started by Replies Last post
2 Replies
1946 Views
Last post December 03, 2016, 04:56:56 PM
by ZabiinoOo
12 Replies
4082 Views
Last post January 05, 2017, 07:21:58 PM
by jigokush
1 Replies
3339 Views
Last post August 16, 2017, 03:41:26 PM
by KREATHOR
1 Replies
2281 Views
Last post November 01, 2018, 11:41:25 AM
by Marote
3 Replies
1469 Views
Last post January 17, 2021, 10:30:56 PM
by lunaticodeveloper