Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autowall returning wrong damage #13

Closed
LuanGraa opened this issue Jun 2, 2020 · 10 comments
Closed

Autowall returning wrong damage #13

LuanGraa opened this issue Jun 2, 2020 · 10 comments
Labels
❌ invalid this doesn't seem right
Milestone

Comments

@LuanGraa
Copy link

LuanGraa commented Jun 2, 2020

So i am in the process of making a very simplified ragebot for matchmaking but when i used the GetDamage function from the autowall it returns a completely wrong number

`float CRageBot::GetBestHitboxPos(CBaseEntity* pLocal, CBaseEntity* Target,Vector& Hitbox) {
float flHigherDamage = 0.f;

Vector BestHitBox;

static int hitboxesLoop[] =
{
	HITBOX_HEAD,
	HITBOX_PELVIS,
	HITBOX_UPPER_CHEST,
	HITBOX_CHEST,
	HITBOX_NECK,
	HITBOX_LEFT_FOREARM,
	HITBOX_RIGHT_FOREARM,
	HITBOX_RIGHT_HAND,
	HITBOX_LEFT_THIGH,
	HITBOX_RIGHT_THIGH,
	HITBOX_LEFT_CALF,
	HITBOX_RIGHT_CALF,
	HITBOX_LEFT_FOOT,
	HITBOX_RIGHT_FOOT
};

int loopSize = ARRAYSIZE(hitboxesLoop);
for (int i = 0; i < loopSize; ++i)
{
	Vector HitBoxPos = Target->GetHitboxPosition(hitboxesLoop[i]);

	FireBulletData_t dataOut;
	float WrongDamage = CAutoWall::Get().GetDamage(pLocal,HitBoxPos,&dataOut);
	//WrongDamage = returns 0 all the time

	if (!dataOut.flCurrentDamage)
		continue;

	if (dataOut.flCurrentDamage > flHigherDamage)
	{
		flHigherDamage = dataOut.flCurrentDamage;
		Hitbox = HitBoxPos;
	}
}
return flHigherDamage;

}`

The damage it returns, btw at the time of the picture i was only using head hitbox instead of a hitbox loop

Sem Título

@rollraw
Copy link
Owner

rollraw commented Jun 3, 2020

seems like u using old commit?
should be fixed after f1c052f

@LuanGraa
Copy link
Author

LuanGraa commented Jun 3, 2020

Ok will try that one thanks for the help and the sdk

Edit: nvm just compared my autowall.cpp and autowall.h and its the same version

@rollraw
Copy link
Owner

rollraw commented Jun 3, 2020

tested that right now
image
that is what i got for 4 enemies with deagle
seems u not updated smth
image
and for 1 enemy

code what i've using

for (int i = 1; i <= I::Globals->nMaxClients; i++)
	{
		auto pEntity = I::ClientEntityList->Get<CBaseEntity>(i);

		if (pEntity == nullptr || !pEntity->IsAlive() || pEntity->IsDormant())
			continue;

		float flHigherDamage = 0.f;

		Vector vecHitBoxPos = pEntity->GetHitboxPosition(HITBOX_HEAD);

		FireBulletData_t dataOut;
		float flDamage = CAutoWall::Get().GetDamage(pLocal, vecHitBoxPos, &dataOut);

		if (flDamage > flHigherDamage)
			flHigherDamage = flDamage;

		L::Print(fmt::format("current damage: {}", flHigherDamage));
	}

@LuanGraa
Copy link
Author

LuanGraa commented Jun 3, 2020

Ok i just noticed my VectorAngles function might be outdated so im gonna update that then ill report back

Edit: yep it was the VectorAngles function, closing the issue and thanks for the attention

@LuanGraa LuanGraa closed this as completed Jun 3, 2020
@LuanGraa LuanGraa reopened this Jun 3, 2020
@LuanGraa
Copy link
Author

LuanGraa commented Jun 3, 2020

Sorry had to reopen, apparently its still wrong behind thick walls
Sem Título

@rollraw
Copy link
Owner

rollraw commented Jun 4, 2020

its should be ok with hkp2000
test with another weapon and prefer not a workshop map

@LuanGraa
Copy link
Author

LuanGraa commented Jun 4, 2020

Tried on dust2 and mirage, same result, the funny thing is that up until a point it works fine like it goes down as you aim into a corner but after aiming at a spot that you cant shoot through at all it spikes back up to 33 instead of zeroing out

@rollraw
Copy link
Owner

rollraw commented Jun 4, 2020

hm, i will test this today
but i think issue on ur side cuz triggerbot works fine 🤔

@LuanGraa
Copy link
Author

LuanGraa commented Jun 4, 2020

Yeah i think triggerbot works fine because the enemy is always visible so maybe you never noticed it, anyway if you manage to find it and fix it i would greatly appreciate it since im absolutely clueless when it comes to autowall

@rollraw
Copy link
Owner

rollraw commented Jun 4, 2020

shown it visually and recorded video for you
https://youtu.be/GLGpq16cUsQ
all works fine, like im said issue only on ur side
anyway found some bugs and fixed it with latest commit

code what i've used for that

QAngle angView;
I::Engine->GetViewAngles(angView);

Vector vecStart, vecEnd, vecForward;
M::AngleVectors(angView, &vecForward);

vecStart = pLocal->GetEyePosition();
vecForward *= MAX_DISTANCE;
vecEnd = vecStart + vecForward;

float flDamage = CAutoWall::Get().GetDamage(pLocal, vecEnd);
pDrawList->AddRectFilled(ImVec2(vecScreenSize.x * 0.5f - 2, vecScreenSize.y * 0.5f - 2), ImVec2(vecScreenSize.x * 0.5f + 2, vecScreenSize.y * 0.5f + 2), (flDamage > 1.0f) ? Color(0, 255, 0).GetU32() : Color(255, 0, 0).GetU32());
pDrawList->AddText(ImVec2(vecScreenSize.x * 0.5f, vecScreenSize.y * 0.5f + 10), Color(255, 255, 255).GetU32(), std::to_string(flDamage).c_str());

@rollraw rollraw closed this as completed Jun 4, 2020
@rollraw rollraw added the ❌ invalid this doesn't seem right label Jun 4, 2020
@rollraw rollraw added this to the v1.0 milestone Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❌ invalid this doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants