Jump to content

Set scale for weapon in hands


ds1-e

Recommended Posts

function getPlayerWeaponAsElement(player)
	local weaps = getElementsByType('weapon')
	local x1, y1, z1 = getElementPosition(player)
	for i=1, #weaps do
		local x2, y2, z2 = getElementPosition(weaps[i])
		local distance = getDistanceBetweenPoints3D(x1, y1, z1, x2, y2, z2)
		if distance < 2 then
			return weaps[i]
		end
	end
	return false
end

No idea if something like this would work since the element type is weapon, not object, no way to set object scale.
And even though this seems pointless, getPlayerWeapon returns the players weapon slot and not the weapon its self.

What you could do is turn off visibility for the players weapon, and create an object, updating its position and rotation every frame, that way you would be able to rescale the weapon (visually that is).

Edited by ShayF
Link to comment

@majqq You can't interact with weapons directly. You should do it in common software like Zmodeller (dff) - easy way OR you can make invisible texture, create and attach custom weapon object to yourself using bone_attach functions, replace texture using shaders to make them visible again and manage it - hard way

  • Thanks 1
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...