Çözüldü C++ Code Error

  • Konuyu açan Konuyu açan M29
  • Açılış Tarihi Açılış Tarihi
  • Yanıt Yanıt 2
  • Gösterim Gösterim 93
Bu konu çözüme ulaştırılmıştır. Çözüm için konuya yazılan tüm yorumları okumayı unutmayın. Eğer konudaki yorumlar sorununuzu çözmediyse yeni bir konu açabilirsiniz.
Durum
İçerik kilitlendiği için mesaj gönderimine kapatıldı.

M29

MT Üye
MT Üye
Mesaj
309
Çözümler
7
Beğeni
179
Puan
749
Ticaret Puanı
0
Hello guys
I was trying to create a code that wakes the player up without a waiting time.
A clearer explanation
When the player wears ring number 71136, the waiting time responsible for the character's resurrection from death will be ignored, so that resurrection is instantaneous instead of waiting 9 seconds. The time condition is removed when the player wears ring number 71136. I tried everything: filling health works, the character's appearance works, and everything else works, but here's an error: the character's position doesn't work. He remains dead on the ground. I can't move, even though I added the condition responsible for the character's position. I don't know if I should add the code somewhere else or where to specify it. I wrote the code and added it inside the ACMD(do_restart) function. Is this the correct place, or should it be somewhere else? I hope someone will look at the code and try to help. Thank you.

C++:
Genişlet Daralt Kopyala
    LPITEM pUniqueItem = ch->GetWear(WEAR_UNIQUE1);
    if (pUniqueItem && pUniqueItem->GetVnum() == 71136)
    {
        if (ch->m_pkDeadEvent)
        {
            event_cancel(&ch->m_pkDeadEvent);
            ch->m_pkDeadEvent = NULL;
        }

        ch->SetPosition(POS_STANDING);
        ch->PointChange(POINT_HP, ch->GetMaxHP());
        ch->PointChange(POINT_SP, ch->GetMaxSP());
        ch->ReviveInvisible(5);
        ch->StartRecoveryEvent();

        ch->ChatPacket(CHAT_TYPE_COMMAND, "CloseRestartWindow");
        ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("The character was instantly revived by the special ring!"));

        return;
    }
 
Çözüm
if (ch->IsDead())
{
ch->ChatPacket(CHAT_TYPE_COMMAND, "CloseRestartWindow");
ch->SetPosition(POS_STANDING);
ch->GetDesc()->SetPhase(PHASE_GAME);
ch->StartRecoveryEvent();
ch->RestartAtSamePos();
ch->PointChange(POINT_HP, ch->GetMaxHP());
ch->PointChange(POINT_SP, ch->GetMaxSP());
ch->ReviveInvisible(5);
ch->Show();
ch->Stop();


ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("The character was instantly revived by the special ring!"));

return;
}
if (ch->IsDead())
{
ch->ChatPacket(CHAT_TYPE_COMMAND, "CloseRestartWindow");
ch->SetPosition(POS_STANDING);
ch->GetDesc()->SetPhase(PHASE_GAME);
ch->StartRecoveryEvent();
ch->RestartAtSamePos();
ch->PointChange(POINT_HP, ch->GetMaxHP());
ch->PointChange(POINT_SP, ch->GetMaxSP());
ch->ReviveInvisible(5);
ch->Show();
ch->Stop();


ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("The character was instantly revived by the special ring!"));

return;
}
 
  • Muhteşem
Tepkiler: M29
Çözüm
if (ch->IsDead())
{
ch->ChatPacket(CHAT_TYPE_COMMAND, "CloseRestartWindow");
ch->SetPosition(POS_STANDING);
ch->GetDesc()->SetPhase(PHASE_GAME);
ch->StartRecoveryEvent();
ch->RestartAtSamePos();
ch->PointChange(POINT_HP, ch->GetMaxHP());
ch->PointChange(POINT_SP, ch->GetMaxSP());
ch->ReviveInvisible(5);
ch->Show();
ch->Stop();


ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("The character was instantly revived by the special ring!"));

return;
}
Thank you, it works perfectly now. :love:
 
Durum
İçerik kilitlendiği için mesaj gönderimine kapatıldı.
Geri
Üst