Harpoon Gun

I made an epic Harpoon Gun in Expression 2. Download it at http://www.garrysmod.org/downloads/?a=view&id=103507 .

Could be a lot better.
I disagree with your applyforce formula.
E:applyForce(( (TarPos-E:pos())*20 - E:vel())*E:mass())
Put runOnTick, E = entity, Me = owner and set alpha under first. Change alphas otherwise using a delta check to reduce spam.
OTT [ E:applyForce(Me:eyeAngles():forward()*90000000000000000000000)]

I just learned applyForce() and applyAngForce() a few days ago. I was just messing around with it and came up with this. On the download page it says you can edit it if you like. I might add some more stuff to it. But I just made this for fun.

I take E2 very seriously. Things must be done properly.

Lol, okay… I still don’t get the full concept of applyForce() and how it works. But I’ll work on it a bit.

It applies force in a direction.

Playing games is serious business.

Lol, yea!

I applaud you. In fact, I don’t even know how to use e2 :downs:

It would be easier if you just put the code here in code tags or at least give a better description of what it does. I can’t be bothered downloading it.

@name Harpoon Gun
@persist Me:entity E:entity Use Mouse1 Mouse2 V:vector V2:vector Gyro:angle Holding


Me = owner()
Use = Me:keyUse()
Mouse1 = Me:keyAttack1()
Mouse2 = Me:keyAttack2()
P = E:elevation(Me:aimPos())
Y = E:bearing(Me:aimPos())
R = E:angles():roll()
Gyro = -ang(P,Y,R)*E:mass()*10
V = ((Me:pos() + vec(0,0,120) + Me:eye()*120) - (E:pos()))*E:mass()*2
if (Use & $Use) {
Holding = !Holding
if (Holding == 1) { E = Me:aimEntity() }

if (Holding == 1) {
E:applyForce(V + $V5)
E:applyAngForce(Gyro + $Gyro

if (Holding == 1 & Mouse1) {
Holding = 0

if (Holding == 0 & Mouse2) {
Holding = 1
E:applyForce(V + $V5)
E:applyAngForce(Gyro + $Gyro


Thanks for that, but in future, use

 tags :smile:

In terms of the expression, its pretty crazy. I guess it works but a couple of things I don't understand. What is the deal with 'Holding'?

Aside from that, being completely e2 you'll get a much better reception and help at the [wiremod forums](www.wiremod.com) if you haven't already been there.

No problem, I just made a facepunch account so I didn’t know any tags. The ‘Holding’ variable means is Me’s(owner()) aimEntity() being held in the air already. If so, and Me, presses keyUse() again, drop the aimEntity().

pics? :geno:

fixed to save ops

I’m not too good at e2, but I’m trying. I gotta re-learn the syntax…

Serious business.

Ah, I see how it works, I must have been tired as I was having trouble wrapping my head around it.

Assuming you made the whole thing yourself, I would say you have a pretty good understanding of applyforce :v:

I made everything on it but the shooting, thats one part I didn’t get.

Pics. Seriously, this is not wiremod forum.