Is is it possible to UNweld?

If i remember correctly there are some tools and entities that allowed for unwelding.
However (and although the title doesn’t clarify this) I am looking for a weapon that unwelds.
I remember a long time ago I had some ninja pack that had a mp5 that when shot at something it unwelded.

If anyone can help me find a weapon (not entity or tool) that unwelds or a way to quickly throw one together (as I have no lua coding experience) it will be greatly appreciated.

The reason I don’t wont a tool or entity is because I want to make an rp class that has unweld capabilities so if it was a tool or entity anyone would be able to use it.

rates Dumb because the tool-related text tells you

Press R. Completely unwelds something.

rates above poster dumb for not reading the OP

He wants it for an RP class.

He never specified that. Box for you.

Hmm what could this mean then…

I think I said WEAPON and I did say RP 7 lines down.

no, that un-freezes everything on the screen that belongs to you.

If you have weld tool out it unwelds the prop you aim at.

Wow is this like the thread of making other people look dumb :smiley:
But seriously no-one has ever seen such a thing?

Hmm I don’t think I have seen a weapon like that, the close I could find was the magical un-weld brick, à la War of the Servers, but I can’t find anything like you said, try getting a request in the lua section :confused:

No again, if you’re using the weld tool, it’ll unweld all the welds on that object.

hurrrrrrrr…
But yeah, that’s a pickle.

To get stuff straight:
Carlise: Single clicking R with the physgun unfreezes the contraption you are aiming at (if it belongs to you)
Double clicking R with the physgun unfreezes everything on the map that belongs to you
Clicking R with the weld tool unwelds the prop you are aiming at from everything (if it belongs to you).

And to oblivioncth
You could try to find the lua code for the weld tool and looking at the code for clicking R.
Alternatively you can make a Builder class that is able to unweld with the weld tool+R.

Edit: There are several Nukes on Gmod.org that unweld (unconstraints more like) everything as the shockwave hits. You can take a look at that too.

I found an unweld brick that has the line


local  bool = constraint.RemoveConstraints( data.HitEntity, "Weld" )


in its init.lua

The problem is though it is an entity so I’m not sure if it applies for weapons so I might try and find the code for the weld tool.

I can try and put that into this sledgehammer I found on garrysmod.org but I have no lua experience so wish me luck.

[editline]08:42PM[/editline]

If found some lua code like this


if trace.HitPos:Distance(self.Owner:GetShootPos()) <= 75 then
self.Weapon:SendWeaponAnim(ACT_VM_HITCENTER)
	bullet = {}
	bullet.Num    = 1
	bullet.Src    = self.Owner:GetShootPos()
	bullet.Dir    = self.Owner:GetAimVector()
	bullet.Spread = Vector(0, 0, 0)
	bullet.Tracer = 0
	bullet.Force  = 1
	bullet.Damage = 25
self.Owner:FireBullets(bullet) 
self.Weapon:EmitSound("")
else
self.Weapon:EmitSound("" .. math.random( 1, 4 ) .. ".wav")
	self.Weapon:SendWeaponAnim(ACT_VM_MISSCENTER)


I’m assuming that in the other code I found the part


constraint.RemoveConstraints( data.HitEntity, "Weld" )

is saying remove welds when the brick hits somthing.

I actually wouldn’t mind having this weapon remove all constraints, so if I were to add


constraint.RemoveConstraints

in some way like


	
bullet.Damage = 25
self.Owner:FireBullets(bullet) 
self.Weapon:EmitSound("")
self.Weapon:RemoveConstraints


except I’m assuming that’s wrong, it would make the sledgehammer remove all constraints on hit.

Anyone?

Take a look at http://wiki.garrysmod.com/?title=Constraint

Ok well now I know how to remove constraints but I’m still unsure how to direct it to the object that the weapon is hitting and were to put it in the code.



bullet.Damage = 25
self.Owner:FireBullets(bullet) 
self.Weapon:EmitSound("")
constraint.RemoveConstraints


Possibly?

Sorry for being such a noob but I had (Now I have some idea) idea what I’m doing :smiley:

I’m not too good with lua either… Maybe you would have better luck asking in the Requests subforum under Lua Scripting: http://www.facepunch.com/forumdisplay.php?f=53

I put a request there yesterday and only one reply saying that it would be cool :frowning:

Well guess I’m going to either, A. Hope someone makes it. OR B. Start learning lua.