Jump to content

Disable hit animation


srslyyyy

Recommended Posts

  • Moderators
8 minutes ago, majqq said:

It's already canceled.

Ah that is a petty :(

I do not think there are much options left.

 

 

Except if the player is `standing still` and `doing nothing`.

local x, y, z = getElementPosition(localPlayer)
setElementPosition(localPlayer, x, y, z, true) -- warp argument is by default `true` but just so you know that it is doing something ...

Optional Arguments

  • warp: teleports players, resetting any animations they were doing. Setting this to false preserves the current animation.

https://wiki.multitheftauto.com/wiki/SetElementPosition

Link to comment
  • 4 weeks later...
  • Scripting Moderators
On 05/03/2019 at 18:36, IIYAMA said:

Ah that is a petty :(

I do not think there are much options left.

 

 

Except if the player is `standing still` and `doing nothing`.


local x, y, z = getElementPosition(localPlayer)
setElementPosition(localPlayer, x, y, z, true) -- warp argument is by default `true` but just so you know that it is doing something ...

Optional Arguments

  • warp: teleports players, resetting any animations they were doing. Setting this to false preserves the current animation.

https://wiki.multitheftauto.com/wiki/SetElementPosition

Hmm what do u think about finding block and name of this animation, and then make a check onClientPlayerDamage if player got this animation resets it? Shouldn't it work?

  • Like 1
Link to comment
  • Moderators
1 hour ago, majqq said:

Hmm what do u think about finding block and name of this animation, and then make a check onClientPlayerDamage if player got this animation resets it? Shouldn't it work?

Might be possible, as long as it is detected by MTA.

Not all animations are for some unknown reason detected.

Just test it!

Edited by IIYAMA
  • Like 1
Link to comment
  • 1 year later...
  • Scripting Moderators
On 31/03/2019 at 13:59, IIYAMA said:

Might be possible, as long as it is detected by MTA.

Not all animations are for some unknown reason detected.

Just test it!

Hi. I've just found out that it's a task.

unknown.png

Is there any way to disable it?

It cause some hits to not confirm.

Link to comment
  • Moderators
36 minutes ago, majqq said:

Hi. I've just found out that it's a task.

unknown.png

Is there any way to disable it?

It cause some hits to not confirm.

You mean that there is no damage given?

 

If that is the case:

You could maybe use: https://wiki.multitheftauto.com/wiki/OnClientPlayerWeaponFire

to save the latest player shot and set that as attacker. (with some tricks)

 

Edited by IIYAMA
Link to comment
  • Scripting Moderators
13 minutes ago, IIYAMA said:

You mean that there is no damage given?

Either there is no damage, body part is invalid (unknown) or hit counts but damage doesn't.

Test code:

local vHits = 0
local tMuzzle = {}
local vParts = {
	[3] = "Torso",
	[4] = "Ass",
	[5] = "Left arm",
	[6] = "Right arm",
	[7] = "Left leg",
	[8] = "Right leg",
	[9] = "Head",
}

function onClientPlayerWeaponFire(pWeapon, pAmmo, pAmmoInClip, pHitX, pHitY, pHitZ, pHitElement, pStartX, pStartY, pStartZ)
	if not pHitElement then 
		return 
	end
	
	local vStartX, vStartY, vStartZ = getPedWeaponMuzzlePosition(source)
	local vCol = {processLineOfSight(pStartX, pStartY, pStartZ, pHitX, pHitY, pHitZ, true, true, true, true, false, true, true, false, nil, false, false)}
	local vHitPart = vParts[vCol[11]] or "UNKNOWN"
	tMuzzle = {pStartX, pStartY, pStartZ, pHitX, pHitY, pHitZ}

	vHits = vHits + 1
	outputChatBox("[HIT #"..vHits.."]: X, Y, Z: "..pHitX..", "..pHitY..", "..pHitZ.." | Hit element: "..tostring(pHitElement).." | Hit bodypart: "..vHitPart)
end
addEventHandler("onClientPlayerWeaponFire", root, onClientPlayerWeaponFire)

--

function onClientPlayerDamage()
	outputChatBox("Damage confirmed at hit: "..vHits)
end
addEventHandler("onClientPlayerDamage", root, onClientPlayerDamage)

--

function onClientRender()
	if #tMuzzle == 6 then
		dxDrawLine3D(tMuzzle[1], tMuzzle[2], tMuzzle[3], tMuzzle[4], tMuzzle[5], tMuzzle[6], tocolor(200, 0, 0, 255), 3)
	end
end
addEventHandler("onClientRender", root, onClientRender)

lGmo7Ev.png

On screen below, there was no collision check. But hits #6, #7 confirmed that element got hit, but no damage was given. (don't mind bodypart, there was no collision check on it)

BdbV6Yh.png

Edited by majqq
Link to comment
  • Moderators
11 minutes ago, majqq said:

Either there is no damage, body part is invalid (unknown) or hit counts but damage doesn't.

Also without mods? There are some mods that do have some collision issues.

Link to comment
  • Scripting Moderators
9 minutes ago, IIYAMA said:

Also without mods? There are some mods that do have some collision issues.

I don't think it's a mods issue, i remember that i had similiar case on tactics gamemode. Tested it without replaced models and seems like it's the same.

 

Link to comment
  • Moderators
18 hours ago, majqq said:

On screen below, there was no collision check. But hits #6, #7 confirmed that element got hit, but no damage was given. (don't mind bodypart, there was no collision check on it)

When that occurs, what was the loss value?

Link to comment
  • Moderators
2 hours ago, majqq said:

41. It's same w/out stun animation.

If the health loss isn't subtracted, you will be able to detect the issue with the pre-event: https://wiki.multitheftauto.com/wiki/OnClientPlayerWeaponFire

Since the health didn't change. + getTickCount to check if the damage is done within the same frame. And maybe include the ped task as well for validation.

Edited by IIYAMA
  • Like 1
Link to comment
  • 4 months later...
  • Scripting Moderators

@IIYAMA I've looked into it again probably realised why there's a lot of non-confirmed hits. Apparently, there's some delay before bullet will hit player. Do you think scripting dealing damage via onClientPlayerWeaponFire + processLineOfSight will work out? Damage would be handled by victim. I'm curious, because i do not have opportunity to test it, and would like to know what you think about it.

Edited by majqq
Link to comment
  • Moderators
12 hours ago, majqq said:

@IIYAMA I've looked into it again probably realised why there's a lot of non-confirmed hits. Apparently, there's some delay before bullet will hit player. Do you think scripting dealing damage via onClientPlayerWeaponFire + processLineOfSight will work out? Damage would be handled by victim. I'm curious, because i do not have opportunity to test it, and would like to know what you think about it.

Well, yes it worked in the past for me.

There were a few issues with transparent/shoot through element components.

Like the watch towers in area69. Those banister were blocking the line, while the arguments were set correctly. Not sure if they fixed that by now.


@majqq

I can send you another script, which was an experimental serverside bullet detection. It does use processLineOfSight, but not for player hit detection. Just mapping the end point of the bullet. Instead it compares the bone position of the ped VS the line. Which means you can also hit feed and hands (which normally does not have collision). Do you want to take a look at that for inspiration or use it like it is? (the code is a monstrosity by the way... sorry :D)

Edited by IIYAMA
  • Like 1
Link to comment
  • Scripting Moderators
2 hours ago, IIYAMA said:

Well, yes it worked in the past for me.

There were a few issues with transparent/shoot through element components.

Like the watch towers in area69. Those banister were blocking the line, while the arguments were set correctly. Not sure if they fixed that by now.


@majqq

I can send you another script, which was an experimental serverside bullet detection. It does use processLineOfSight, but not for player hit detection. Just mapping the end point of the bullet. Instead it compares the bone position of the ped VS the line. Which means you can also hit feed and hands (which normally does not have collision). Do you want to take a look at that for inspiration or use it like it is? (the code is a monstrosity by the way... sorry :D)

Why not, probably won't use it, but would be nice to look at it.

  • Like 1
Link to comment
  • 2 weeks later...
  • Scripting Moderators

On topic:

Just for anyone wondering, i solved that by using cancelEvent() in onClientPlayerDamage attached to root (had already existing handler, but just for localPlayer).

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...