get good get legendware
-
Автор темы
- #1
well in this guide we will learn how to make a proper defensive doubletap for lw since 99% of this forum has been struggling with it for two years
first the shift cmd function :-
then next we move to the actual defensive doubletap :-
next we go to our cool tickbase fix
first the shift cmd function :-
C++:
void tickbase::shift_cmd(CUserCmd* cmd, int amount)
{
int cmd_number = cmd->m_command_number;
int cnt = cmd_number - 150 * ((cmd_number + 1) / 150) + 1;
auto new_cmd = &m_input()->m_pCommands[cnt];
auto net_chan = m_clientstate()->pNetChannel;
if (!new_cmd || !net_chan)
return;
std::memcpy(new_cmd, cmd, sizeof(CUserCmd));
new_cmd->m_command_number = cmd->m_command_number + 1;
new_cmd->m_buttons &= ~0x801u;
for (int i = 0; i < amount; ++i)
{
int cmd_num = new_cmd->m_command_number + i;
auto cmd_ = m_input()->GetUserCmd(cmd_num);
auto verifided_cmd = m_input()->GetVerifiedUserCmd(cmd_num);
std::memcpy(cmd_, new_cmd, sizeof(CUserCmd));
if (cmd_->m_tickcount != INT_MAX && m_clientstate()->iDeltaTick > 0)
m_prediction()->Update(m_clientstate()->iDeltaTick, true, m_clientstate()->nLastCommandAck, m_clientstate()->nLastOutgoingCommand + m_clientstate()->iChokedCommands);
cmd_->m_command_number = cmd_num;
cmd_->m_predicted = cmd_->m_tickcount != INT_MAX;
std::memcpy(verified_cmd, cmd_, sizeof(CUserCmd));
verified_cmd->m_crc = cmd_->GetChecksum();
++m_clientstate()->iChokedCommands;
++net_chan->m_nChokedPackets;
++net_chan->m_nOutSequenceNr;
}
*(int*)((uintptr_t)m_prediction() + 0xC) = -1;
*(int*)((uintptr_t)m_prediction() + 0x1C) = 0;
}
then next we move to the actual defensive doubletap :-
C++:
void tickbase::double_tap_deffensive(CUserCmd* cmd)
{
int shift_amount = 14 - g_cfg.ragebot.shift_amount; /*we dont want to shift more than 14 and it goes as follows*/
/* (16 ticks in total we can send without byte patching) 1 tick is for simulating our other 15 commands , 1 tick is for desync, 13 for dt, and 1 is enough to break lc*/
// predictpos
Vector predicted_eye_pos = g_ctx.globals.eye_pos + (engineprediction::get().backup_data.velocity * m_globals()->m_intervalpertick);
for (auto i = 1; i <= m_globals()->m_maxclients; i++)
{
auto e = static_cast<player_t*>(m_entitylist()->GetClientEntity(i));
if (!e->valid(true))
continue;
auto records = &player_records[i];
if (records->empty())
continue;
auto record = &records->front();
if (!record->valid())
continue;
// apply player animated data
record->adjust_player();
// look all ticks for get first hitable
for (int next_chock = 1; next_chock <= 6; ++next_chock)
{
predicted_eye_pos *= next_chock;
fireBulletData_t fire_data = { };
/*we scan for pelvis because relativly it has a very low desync amount and its the first body part we detect when peeking*/
fire_data.damage = CAutoWall::GetDamage(predicted_eye_pos, g_ctx.local(), e->hitbox_position_matrix(HITBOX_PELVIS, record->matrixes_data.main), &fire_data);
/*you can do the same for default lw autowall*/
if (fire_data.damage < 1)
continue;
g_ctx.globals.m_Peek.m_bIsPeeking = true;
}
}
if (g_ctx.globals.m_Peek.m_bIsPeeking && !g_ctx.globals.isshifting) /*we dont want to shift while we're recharching because it will cause our dt and tickbase to break*/
{
shift_cmd(cmd, shift_amount);
g_ctx.globals.tickbase_shift += shift_amount;
g_ctx.globals.m_Peek.m_bIsPeeking = false;
/*now its up to you to set a timer from 50ms up to 400ms i'd recommend, refer to using TICKS_TO_TIME function for that*/
/*but personally shifting constantly is fine*/
}
}
next we go to our cool tickbase fix
C++:
{
/*inside PhysicsSimulate before calling original*/
auto tickbase = g_ctx.local()->m_nTickBase();
if (cctx->cmd.m_command_number == g_ctx.globals.shifting_command_number)
tickbase -= g_ctx.globals.shift_ticks + m_globals()->m_simticksthisframe + 1;
else if (cctx->cmd.m_command_number == g_ctx.globals.shifting_command_number + 1)
tickbase += g_ctx.globals.shift_ticks - m_globals()->m_simticksthisframe + 1;
if (g_cfg.ragebot.defensive_doubletap && !g_ctx.globals.isshifting && g_ctx.globals.m_Peek.m_bIsPeeking)
tickbase -= (14 - g_cfg.ragebot.shift_amount);
g_ctx.local()->m_nTickBase() = tickbase;
}
Последнее редактирование: