Barnacle gun request

Hey I was thinking of a gun idea for half life 2.
So is it posible to make a barnacle gun that acts like a grapleing hook? But olso can grab players and npcs?

I don’t see why it couldn’t be done, should be easy even but I can’t create this atm. got other things to do. This is what I had in mind:

Do a trace, get the entity it hit and store it in target

Entity: move_rope

  • Parent: target
  • Next Keyframe: name of the keyframe below

Entity: keyframe_rope

  • Parent: Owner of the swep

on some event, move the player closer to the targets vector with some set speed. That would pretty much act like you want it wouldn’t it?

Ok now I am still learning how to script at the moment so is there anyone who would you do it? And thankyou for ansering my question

You mean like the one in Opposing Force?

Shouldn’t “Owner of the swep” be “!self”?

Yes like the one in opposing force. I was sure that there was a barnacle already but I guess I forgot.

Yes a Barnacle would be sweet.

!self is for console commands, like ent_fire. Lua has it’s own system for getting whose doing things.

In a SWEP it would be “Owner”.

Anyone willing to make it.:{

good request, just noone will do it…

Grapple Hook remember that gun !

What about use it as an example ?

Make sure that when you attach to a player and touch him, he takes damage, because in opposing force multiplayer it bites the other player when you are on him.

Yeah, you’ll need to make it gib people though. For some reason I just like SWEPS which gib.

I am currently making this… problem is that i don’t know how to make the target ragdoll and pull it to towards the player instead of the player being to pulled to the target…

taken from the grappling hook player_constraint shared:


AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )

include('shared.lua')

ENT.vGravity = true
ENT.vOffset = Vector(0,0,60) --How far up the player the invisible object is
ENT.vMass = 1

/*---------------------------------------------------------
   Name: Initialize
---------------------------------------------------------*/
function ENT:Initialize()
	self.Entity:SetModel( "models/Combine_Helicopter/helicopter_bomb01.mdl" )
	self.Entity:SetColor( 0, 0, 0, 0 )
	self.Entity:SetMaterial("Models/effects/splodearc_sheet")
	self.Entity:SetCollisionGroup(1)
	self.Entity:DrawShadow( false )
	self.Entity:PhysicsInit( SOLID_VPHYSICS )
	self.Entity:SetMoveType( MOVETYPE_VPHYSICS )
	self.Entity:SetSolid( SOLID_VPHYSICS )
 
	local phys = self.Entity:GetPhysicsObject()
	if (phys:IsValid()) then
		phys:Wake()
	end
	vMass = self.Entity:GetPhysicsObject():GetMass()
	self:Massify()
end

function ENT:Massify()
	if( self.Entity:GetPhysicsObject():GetMass() == self.Entity:GetOwner():GetPhysicsObject():GetMass() ) then
		self.Entity:GetPhysicsObject():SetMass( self.vMass )
	else
		self.Entity:GetPhysicsObject():SetMass( self.Entity:GetOwner():GetPhysicsObject():GetMass() )
	end
end	

function ENT:Think()
end

function ENT:FreePlayer()
		if(!SERVER) then return end
		if (self.vGravity ~= true) then
			self.Entity:GetOwner():GetPhysicsObject():EnableGravity(true)
			self.vGravity = true
		end
		
		self.Entity:SetPos(self.Entity:GetOwner():GetPos() + self.vOffset - self:GetAdjust() )
		local vVelocity = self.Entity:GetVelocity() * Vector(1,1,0)
		self.Entity:SetLocalVelocity( vVelocity )
		self.Entity:GetPhysicsObject():SetVelocity( self.Entity:GetOwner():GetVelocity() )
end

function ENT:OffSet()
	return self.vOffset
end

function ENT:FixPlayer()
	local trace = {}
	local vStart = self.Entity:GetPos()
	trace.start = vStart
	trace.endpos = vStart - self.vOffset + self:GetAdjust()
	trace.filter = self.Entity
	trace.filter = self.Entity:GetOwner()
	local tr = util.TraceLine( trace )
	if (tr.Hit) then
		self.Entity:SetPos( vStart + (self.vOffset + self:GetAdjust()) * Vector( 0, 0, 1-tr.Fraction ) )
		self:FreePlayer()
		return true
	end
	return false
end

function ENT:GetAdjust()
	if ( self.Entity:GetOwner():Crouching() ) then
		return Vector(0,0,32)
	else
		return Vector(0,0,0)
	end
end

function ENT:Constrain()
	if(self:FixPlayer()) then return end
	if (self.vGravity) then
		self.Entity:GetOwner():GetPhysicsObject():EnableGravity(false)
		self.vGravity = false
	end
	local vVelocity = self.Entity:GetOwner():GetVelocity() * Vector(1,1,0)
	self.Entity:GetOwner():SetLocalVelocity( vVelocity )
	self.Entity:GetOwner():SetVelocity( self.Entity:GetVelocity() )
	self.Entity:GetOwner():SetPos( self.Entity:GetPos() - self.vOffset + self:GetAdjust() )
end


You have to create a ragdoll with the players world model, then hide the players local and world player models, done.

I made one already some time ago:
[IMG_THUMB]http://filesmelt.com/dl/sc_barnaclegun_01.jpg[/IMG_THUMB] [IMG_THUMB]http://filesmelt.com/dl/sc_barnaclegun_02.jpg[/IMG_THUMB]

It will be part of the new version of my Half-Life: Renaissance addon.

does it grab on to targets? like a zombie or a player?

this was on hl opposing force wasnt it?

Cool. Is that still going to be in your addon? Because you said that it WASN’T going to be in Half Life: Renaissance…I won’t pester you. Take your time.