• Harpoon Gun
    23 replies, posted
I made an epic Harpoon Gun in Expression 2. Download it at [url]http://www.garrysmod.org/downloads/?a=view&id=103507[/url] .
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.
[QUOTE=whosdr;23238118]I take E2 very seriously. Things must be done properly.[/QUOTE] 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.
CODE: @name Harpoon Gun @persist Me:entity E:entity Use Mouse1 Mouse2 V:vector V2:vector Gyro:angle Holding runOnTick(1) 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 + $V*5) E:applyAngForce(Gyro + $Gyro*5) E:setAlpha(200) }else{ E:setAlpha(255) } if (Holding == 1 & Mouse1) { Holding = 0 E:applyForce(Me:eyeAngles():forward()*90000000000000000000000) E:setMass(1) } if (Holding == 0 & Mouse2) { Holding = 1 E:applyForce(V + $V*5) E:applyAngForce(Gyro + $Gyro*5) E:setAlpha(200) E:setMass(50) } E:setMass(50)
Thanks for that, but in future, use [code] 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 [URL="www.wiremod.com"]wiremod forums[/URL] 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:
[QUOTE=whosdr;23237987]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:eye()*90000000000000000000000)][/QUOTE] fixed to save ops
I'm not too good at e2, but I'm trying. I gotta re-learn the syntax...
Serious business.
[QUOTE=Ryan Fletcher;23248864]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().[/QUOTE] Ah, I see how it works, I must have been tired as I was having trouble wrapping my head around it. [QUOTE=Ryan Fletcher;23238192]I still don't get the full concept of applyForce() and how it works.[/QUOTE] 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.
Pictures.
[QUOTE=BBOOBBYY!;23282711]Pics. Seriously, this is not wiremod forum.[/QUOTE] Hey! We like pictures there too...
[QUOTE=BBOOBBYY!;23282711]Pics. Seriously, this is not wiremod forum.[/QUOTE] Implying there are no pictures on Wiremod forums.
If you made it spawn a harpoon, hold it infront of you, then fire when you release mouse1 it would be EPIC
Sorry, you need to Log In to post a reply to this thread.