• Divran's E2 Thread
    971 replies, posted
  • Avatar of Agent Texas
  • I want an E2, that when I put the E2 on a camera, it will make the camera follow me around while looking at me.
  • Avatar of whosdr
  • One I already had. [code] @name @inputs @outputs @persist E:entity Entity:entity Owner:entity Target:entity @trigger if (first()) { if (!entity():isWeldedTo()) {exit()} E = entity():isWeldedTo() Entity = entity() Owner = owner() E:setAlpha(0) Entity:setAlpha(0) E:setMass(1000) Entity:setMass(1) runOnChat(1) runOnTick(1) Target = Owner holoCreate(1) holoScale(1,vec(0.1,2,2)) holoMaterial(1,"models/rendertarget")#screen space holoPos(1,Owner:toWorld(vec(50,20,60))) holoAng(1,Owner:angles() + ang(0,180,0)) holoParent(1,Owner) } if (tickClk()) { Pos = Target:toWorld(vec(-150,0,50)) E:applyForce(( (Pos - E:pos())*20 - E:vel() + Target:vel()*5)*1000) # E:applyAngForce(( (Target:eyeAngles() - E:angles())*20 - E:angVel())*1000) Torque = E:toLocal(rotationVector(quat(Target:eyeAngles())/quat(E))+E:pos()) E:applyTorque((Torque*10-E:angVelVector()*10)*E:inertia()) } if (chatClk(Owner)) { if (Owner:lastSaid():explode(" ")[1,string] == "-target") { Target = findPlayerByName(Owner:lastSaid():explode(" ")[2,string]) print(""+Target:name()) hideChat(1) if (!Target) {Target = Owner} } } [/code]
  • Avatar of Kwout
  • A e2 that acts like a UAV (you get a top-down view of the map with a drone that you can control)
  • Avatar of whosdr
  • [code] @inputs Pod:wirelink Cam:wirelink E:entity @persist Pos:vector Ang:angle Zoom if (first()) { runOnTick(1) Pos = entity():pos()+vec(0,0,1000) Zoom = 0 } Cam["Activated",number] = Pod["Active",number] W = Pod["W",number] S = Pod["S",number] Shift = Pod["Shift",number] Space = Pod["Space",number] Ent = Pod["Entity",entity]:driver() Alt = Pod["Alt",number] if (W | S) {Pos += (E:forward()*10+(20*Shift))*(W-S)} if (Space) {Zoom+=10} if (Alt) {Zoom-=10} Zoom = clamp(Zoom,0,10000) Cam["Position",vector] = Pos-vec(0,0,Zoom) Cam["Direction",vector] = Ent:eye():setZ(-1) Cam["Parent",entity] = E Ang = Ent:angles():setPitch(0) Torque = E:toLocal(rotationVector(quat(Ang)/quat(E))+E:pos()) E:applyTorque((Torque*30-E:angVelVector()*10)*E:inertia()) E:applyForce(( (Pos - E:pos())*20 - E:vel())*E:mass()) [/code] Sorry it's not perfect, I kinda rushed it.
  • Avatar of whosdr
  • Not really fast. I've been working on a runescape-style inventory for 3 days. It's coming along. Had to edit E2 derma to include spawn icons, and I can't change the model afterwards.
  • Avatar of Tactical Beastz
  • anyone have the working blackes gun on there gmod i want the working copy not the crap off the gmod.org website that has 1000000000 errors in it
  • Avatar of whosdr
  • Erm... Maybe if you provided a picture and such. Also, we can only make 50 primitive shapes, and it's tedious. If it's a model you want, don't look here.
  • Avatar of Minelayer
  • Can you make me a noclip or flying e2? what i mean by flying is that it doesn't have to clip me through props etc. etc.
  • Avatar of ruffles
  • Is it possible to make the thing e2 (first post) first a turret or pew pew gun right before the prop kills the person?
  • Avatar of snipeissilent
  • Hello all... I'm trying to make an ejection seat consisting of a seat weld latched to a plate. The seat has thrusters on the bottom and a balloon deployer on the back. What I need is for the weld latch to remain activated until I press the space bar, after which it cannot reactivate. 0.1 seconds after space is pressed, the weld latch disengages. 0.1 seconds after that, the thrusters activate and stay on for 2 seconds. They turn off, and the balloon deploys from the deployer. I more or less know how to do the timing using timer("name", time) and if (clk("name")), but I do not know how to make the weld latch be engaged at first then disengaged, unable to be activated again. I also don't know how to make it so I don't have to hold down the space bar. May someone make a full e2 for this dilemma? Thanks.
  • Avatar of whosdr
  • [code] @name Ejector @inputs Space @outputs Latch Balloon Thrusters if (first()) {Latch = 1} if (Space & ~Space & Latch) {timer("latch",100)} if (clk("latch")) {Latch = 0,timer("thruster",100)} if (clk("thruster")) {Thrusters = 1,timer("balloon",2000)} if (clk("balloon")) {Thrusters = 0,Balloon = 1} [/code]
  • Avatar of snipeissilent
  • Thank you, although I ultimately ended up getting outside help. The code I decided on is: [code]@name Ejection Seat @inputs Space @outputs Weld Thrusters Balloon @persist @trigger runOnTick(1) if (first()|duped()) { Weld=1 } if (Space) { Weld=0 timer("weld", 10) } if (clk("weld")) { Thrusters=1 timer("thrust", 1500) } if (clk("thrust")) { Thrusters=0 Balloon=1 }[/code] However, I am having trouble with stability. I have 4 thrusters in 4 corners of a phx plate (smartsnapped), but the seat always spins out of control after the thrusters trigger. Keep upright and gyro cant be used because this is going in a plane and will eventually be going upside down. Is there any way, wire or not, that this seat's 1.5 seconds of flight time can be stabilized?
  • Avatar of _ExileZ_
  • May I request a "Anti-Dupe" code for E2's? It would be very useful + I have seen it before
  • Avatar of Bellmanator
  • [QUOTE=_ExileZ_;24452149]May I request a "Anti-Dupe" code for E2's? It would be very useful + I have seen it before[/QUOTE] This is quite easy, or it is the way I do it. Just insert this into any E2 you don't want to be duped (works for contraptions too, just as long as the E2 is connected). [code] if((owner():steamID()!="STEAM_0:1:2345678") & (duped() | first())){ selfDestructAll() }[/code]
  • Avatar of jlj1
  • Anti Dupe code is somewhat useless If they really want the E2 they just ADV dupe it and edit the save
  • Avatar of ContiX
  • May I request a little help in the right direction? I'm trying to make a chip that interfaces with the SBEP team's MCP; basically, a platform that moves when you give it coordinates. What I want to do should be fairly simple, but I lack the brain at the moment to figure it out...I want to make a series of variables that are changable by numpads. Meaning, if I push 4, the variable set for 4 something increments, and when I push 6, the variable decrements. The problem lies with getting the increment/decrement commands to work; is there a particular syntax used for them when used with if/then statements that I'm not getting? Also, how do I keep the variable increasing/decreasing permanently? I can get a value to change just by pushing a button, but how do I make it store the new value? Also, just for convenience' sake, how does the E2 timer syntax work? The Wire wiki wasn't very helpful... I don't need a full E2 or anything, just a push. Thanks!
  • Avatar of snipeissilent
  • [QUOTE=ContiX;24463040]I want to make a series of variables that are changable by numpads. Meaning, if I push 4, the variable set for 4 something increments, and when I push 6, the variable decrements. Also, how do I keep the variable increasing/decreasing permanently? I can get a value to change just by pushing a button, but how do I make it store the new value?[/QUOTE] I believe the Advanced Input allows you to insert increment/decrement values. [QUOTE=ContiX;24463040]Also, just for convenience' sake, how does the E2 timer syntax work?[/QUOTE] The timer syntax I use is timer("name", time) and if(clk("name")) {action}. For example, say you want a timer to trigger after another event happens. My favorite example is a timed door that uses a timer to tell it when to close: [code]@name Door @inputs Spacebar @outputs Hydraulic @persist @trigger if (Spacebar) { Hydraulic=100 timer("door", 2000) #This is where the timer begins, as soon as the hydraulic triggers. } if(clk("door") { #This line is the same as saying "Once it has reached the set time..." Hydraulic=0 }[/code] Note that the time you put in (e.g. 2000) is seconds multiplied by 1000. A time of 2000 is 2 seconds, a time of 1000 is one second, a time of 500 is half a second, etc. ____________________________________________________________________________ As for my ejection seat, it appears that seat positioning and some rewiring are all I needed to fix. I have a working ejection seat now, only problem being that I need a plane to eject out of...
  • Avatar of whosdr
  • timer("unique_string_name",time_to_run_in_miliseconds) So timer("bob",2000) would run in 2 seconds (2000 miliseconds is 2 seconds), and can be accessed using clk("bob").
  • Avatar of ContiX
  • So it works completely differently than the original Chip timer? If I wanted to execute three different things, I'd need three different timers? (Thanks for the quick reply!)
  • Avatar of whosdr
  • Indeed. A timer runs once from x miliseconds it was created. It executes the Expression 2. clk(S) checks if if the execution was caused by the timer S.
  • Avatar of snipeissilent
  • [QUOTE=ContiX;24488015]So it works completely differently than the original Chip timer? If I wanted to execute three different things, I'd need three different timers? (Thanks for the quick reply!)[/QUOTE] No problem... You would need three different timers, but only if those three (or more) events were to be triggered at separate times. One timer may trigger as many events as you wish, but they will all happen at the instant that single timer expires. For example... [code]@name Door @inputs Spacebar @outputs Hydraulic Randomhydraulic @persist @trigger if (Spacebar) { Hydraulic=100 Randomhydraulic=3691 timer("door", 2000) timer("randomness", 3000) } if(clk("door")) { Hydraulic=0 } if(clk("randomness")) { Randomhydraulic=1780 }[/code]
  • Avatar of Bellmanator
  • I'm having a bit of trouble with a "door whitelist" E2 I'm making.. The thing works, but for some reason when I try to create a error for the adding function it bugs out and saves blank strings. Heres the adding function.. [code]if(LS:string(1)==">add" & CCheck){ if(LS:string(2)!=""){ S:writeString(">Searching for player..",1,X,999), X++ if(findPlayerByName(LS:string(2))){ Users:pushString(findPlayerByName(LS:string(2)):steamID()) S:writeString(">>Player '"+LS:string(2)+"' added!",1,X,999) X+=2 CCheck=0 UNum++ } else { S:writeString(">>Player '"+LS:string(2)+"' not found!",1,X,900) X+=2 CCheck=0 } } }[/code] As I stated it only stops working when I add in the error. So removing the if(findPlayerByName()){}else{} it works fine, but with it the pushString() doesn't run.
  • Avatar of whosdr
  • You can only run one find function per 100ms or so. You're running findPlayerByName twise. instead, put it in a variable. Check the variable, and if it contains an entity, push it into the array.
  • Avatar of Bellmanator
  • [QUOTE=whosdr;24619427]You can only run one find function per 100ms or so. You're running findPlayerByName twise. instead, put it in a variable. Check the variable, and if it contains an entity, push it into the array.[/QUOTE] Mkay, it works. Thanks for the help.
  • Avatar of FlameCow
  • Does anyone know how to make a WASD controlled holo? Preferrably explained in the code.
  • Avatar of Bellmanator
  • I'll give it a go.. [code]@name Holo @inputs Vehicle:wirelink #Wire this to the adv. pod controller your using. @persist Pos:vector Holo:entity interval(100) Holo=holoEntity(1) E=entity() Speed=100 #Sorta obvious if(first()){ Pos=E:pos() holoCreate(1) } holoPos(1,Pos) #Tells this thing where to be holoAng(1,O:aimPos()) #Follow the players aim #Forward if(Vehicle["W",number]){Pos=Pos + Holo:forward()*Speed} #Backward if(Vehicle["S",number]){Pos=Pos - Holo:forward()*Speed} #Left (If I'm mistaken and left() is suppose to be right(), please forgive me.) if(Vehicle["A",number]){Pos=Pos + Holo:left()*Speed} #Right if(Vehicle{"D",number]){Pos=Pos - Holo:left()*Speed} [/code] Untested, but as far as I can tell it should work.
  • Avatar of whosdr
  • Nick, you forgot to persist Speed. You can also use += and -=.. Pos += Holo:forward()*Speed. [code] @name Holo @inputs Vehicle:wirelink #Wire this to the adv. pod controller your using. @persist Pos:vector [Holo E]:entity if(first()){ E = entity() Pos = E:pos() Holo = holoCreate(1) Speed=10 #Sorta obvious runOnTick(1) } holoPos(1,Pos) #Tells this thing where to be holoAng(1,O:eyeAngles()) #Follow the players aim <- Not AimPos(), EyeAngles(). #Forward if(Vehicle["W",number]){Pos=Pos + Holo:forward()*Speed} #Backward if(Vehicle["S",number]){Pos=Pos - Holo:forward()*Speed} #Left (If I'm mistaken and left() is suppose to be right(), please forgive me.) if(Vehicle["A",number]){Pos=Pos + Holo:left()*Speed} #Right if(Vehicle{"D",number]){Pos=Pos - Holo:left()*Speed} [/code]