• Divran's E2 Thread
    971 replies, posted
  • Avatar of xThaWolfx
  • [QUOTE=RamenDefender;17849730]now if only i knew what an E2 was...[/QUOTE] well..E2 is expression2, this comes with the WireSVN version of wire. it uses codes like gates do, but all in 1 expression2 gate
  • Avatar of Ratzz
  • Can I have an e2 that makes electrons float around me like I am some kind of atom? :D [editline]09:55AM[/editline] Is it possible to make it so when I crouch it puts a box around me?
  • Avatar of Divran
  • Here's an E2 stalker I made for a guy in a [url=http://www.facepunch.com/showthread.php?p=17974833]different thread.[/url] [code]@name Stalker @persist E:entity Target:entity runOnTick(1) if (findCanQuery()) { findByClass("player") Target = findClosest(E:massCenter()) } if (!E) {E = entity():isWeldedTo()} elseif (E & Target) { E:applyForce(((Target:pos()+vec(0,0,45)-E:massCenter())*10-E:vel())*E:mass()) }[/code] [highlight]UNTESTED[/highlight]
  • Avatar of Ratzz
  • [QUOTE=Divran;17974905]Here's an E2 stalker I made for a guy in a [url=http://www.facepunch.com/showthread.php?p=17974833]different thread.[/url] [code]@name Stalker @persist E:entity Target:entity runOnTick(1) if (findCanQuery()) { findByClass("player") Target = findClosest(E:massCenter()) } if (!E) {E = entity():isWeldedTo()} elseif (E & Target) { E:applyForce(((Target:pos()+vec(0,0,45)-E:massCenter())*10-E:vel())*E:mass()) }[/code] [highlight]UNTESTED[/highlight][/QUOTE] Divran, when do you expect my codes to be done?
  • [QUOTE=Ratzz;17975101]Divran, when do you expect my codes to be done?[/QUOTE] Ratzz, if you don't want to wait, go look at the wiki and make it yourself. [editline]03:03PM[/editline] Also, I have two from the old thread: Attracts props of a certain type. I never used this one actually. Dunno if it works:[code]@name Prop Attractor @inputs On Force Model:string @persist Mdl:string Props:array Count @trigger all if (Model == "") {Mdl = ""} else {Mdl = Model} #If you leave "Model" unwired, you can put any model where it says "put model here" to use that instead of the input. if (first()|duped()) { runOnTick(1) #Update the entity findClipToModel(Mdl) #Find props of this model Props = findToArray() #Save them to an array } if (On) { #If On... EM = entity():massCenter() #Destination variable. Force = clamp(Force,1,50000) #Clamp the force (This makes you able to leave Force unwired. If you do, Force will be 1) for(I=1,min(15,Props:count())) { #A loop (The thing I have here with Count makes the E2 able to handle an infinite amount of props without hitting tick quota. If it STILL hits tick quota, lower the number. min(->15<-,Props:count()) <- this number. Count++ #Add count to itself if (Count>Props:count()) {Count=1} #If count is higher than the amount of props, reset count E = Props[Count,entity] #Set E if (!E|E==noentity()) {Props:remove(Count),continue} else { #If E doesn't exist, remove E and start restart the loop Dir = EM-E:massCenter() #Direction E:applyForce((Dir-E:vel())*Force*E:mass()) #Apply the force } } }[/code] When attached to a prop, the prop will attack a player when you say ".attack <playername>". To stop it, you must say ".off":[code]@name Thing @persist [E Target]:entity @trigger if (first()) { #Starting stuff E = entity():isWeldedTo() #isWeldedTo will make the e2 apply the force to the prop it is welded to instead of the e2 itself. runOnTick(1) runOnChat(1) } #If you said something.. if (chatClk(owner())) { #Explode for easier use M = lastSaid():explode(" ") #Attack: if (M:string(1) == ".attack") { hideChat(1) #Hide chat message Target = findPlayerByName(M:string(2)) #Attempt to find the player if (Target) { #If found.. print("Attacking " + Target:name()) } else { #If not found.. print("No player named '" + M:string(2) + "' found.") } #Stop attacking: } elseif (M:string(1) == ".off") { hideChat(1) #Hide chat message print("Stopped attacking " + Target:name()) #Notify Target = noentity() #Set Target to nil } } elseif (tickClk() & Target) { #If current execution was caused by runOnTick() and if Target is a valid entity, apply force. E:applyForce(((Target:pos()+vec(0,0,45)-E:massCenter())*10-E:vel())*E:mass()) }[/code]
  • Avatar of cruiser97
  • Hey Divran, awesome thread, I've been working on an applyForce elevator for some time, and it seems to work but it's kind of eh. The speed is what is difficult too control for me. I've tried adjusting the mass, but it has to be different for different heights. And going up at a decent speed might be fine, but then going back down injures me from the elevator falling to fast. I will post what I have so far if you want, but I'm curious to see if you can create one. I'm looking for an applyForce Elevator with an unlimited amount of floors that can be added. Being able to call the elevator to a floor and then of course going to a floor from inside the elevator would be nice. Any help is appreciated. :D
  • Avatar of RagaMuffin
  • I remember this idea from the other thread, and it sounds pretty cool. Heres the idea: It would be attached to a PHX plate, and the attached object would always be under you. When you jumped, it moved up with you but you didn't fall back down. When you crouched it goes down, if you move it stays under you. Also it's X rotation or whatever would be wherever you aim, so it turns with you. Almost like a version of noclip that you can attach some 'toys' to. (By toys i mean guns if you didn't get that.)
  • Avatar of Divran
  • [QUOTE=cruiser97;17978065]Hey Divran, awesome thread, I've been working on an applyForce elevator for some time, and it seems to work but it's kind of eh. The speed is what is difficult too control for me. I've tried adjusting the mass, but it has to be different for different heights. And going up at a decent speed might be fine, but then going back down injures me from the elevator falling to fast. I will post what I have so far if you want, but I'm curious to see if you can create one. I'm looking for an applyForce Elevator with an unlimited amount of floors that can be added. Being able to call the elevator to a floor and then of course going to a floor from inside the elevator would be nice. Any help is appreciated. :D[/QUOTE] Already made one like this a while ago :P To use it, put a prop directly below the elevator prop, then spawn the e2 on the elevator prop.. The ranger in the if first case needs to find a prop below the elevator prop for it to work correctly. [code]@name Elevator @persist Pos:vector Ang:angle X Y Z Diff Prop:entity Ent:entity Ply:entity @trigger all if (first()) { runOnTick(1) runOnChat(1) Prop = entity():isWeldedTo() rangerFilter(Prop) Ent = rangerOffset(Prop:massCenter(), Prop:massCenter() - vec(0,0,200)):entity() X = Y = 0 } if (chatClk()) { if (lastSpoke():pos():distance(Prop:massCenter()) < 50) { Msg = lastSaid():lower():explode(" ") if (Msg:string(1) == ".floor") { X = Msg:string(2):toNumber() } } } Y = X * 105 if (Z != Y) { Diff = sign(round(Y-Z)) Z+=Diff*1.5 } if (tickClk()) { Pos = (Ent:massCenter():setZ(Z+10) - Prop:massCenter()) * 2000 Ang = Prop:angles() * -10000 Prop:applyForce(Pos+$Pos*10) Prop:applyAngForce(Ang*3+$Ang*30) }[/code]
  • Avatar of Ratzz
  • @name Halo @inputs I @outputs CircleRadius Time @persist @trigger interval(10) if(first()) { holoCreate(9) holoModel(9,"hqtorus2") #Halo :D holoScale(9,vec(1,1,1)) holoMaterial(9,"models/props_wasteland/rockcliff02c") } holoPos(9,owner():shootPos()+vec(X5,Y5,10)) if(I < 180) {I++} if(I == 180) {I = -180} holoAng(9,ang(0,Time*2.5,180)) Time=Time+1 That look okay?
  • Avatar of Infinity1995
  • No, I is never used. Why is there a million spaces? Use runOnTick(1) The code dosent look right, put it in code tags
  • Avatar of Balto-the-Wolf-
  • Dirivan, I have one persistant problem with the applyforce hover. It breaks when duped, which is excessivly annoying. It also is prone to spazzing. I have seen hover expressions survive dupe. Onemanclan says he uses and expresssion that uses entity markers instead of welds. His hover survives dupe and doesnt spazz
  • Avatar of Ratzz
  • [QUOTE=Infinity1995;17985340]No, I is never used. Why is there a million spaces? Use runOnTick(1) The code dosent look right, put it in code tags[/QUOTE] Well, I edited another e2 code. So remove I, Also I was told I don't need the holoscale line..
  • Avatar of Divran
  • [QUOTE=Balto-the-Wolf-Dog;17986257]Dirivan, I have one persistant problem with the applyforce hover. It breaks when duped, which is excessivly annoying. It also is prone to spazzing. I have seen hover expressions survive dupe. Onemanclan says he uses and expresssion that uses entity markers instead of welds. His hover survives dupe and doesnt spazz[/QUOTE] Learn to spell my name correctly >.> Yes I know about that bug. Just remove the line that says "E = entity():isWeldedTo()" and put "E:entity" in the @inputs line then use an entity marker. It will only spaz if your multipliers are incorrect. Try changing them.
  • Avatar of Balto-the-Wolf-
  • The spazz seems to start when if the e2 is attatched to something with moving parts or many props. Thanks divran. The entity marker method survives dupe!
  • Avatar of Ratzz
  • Got the code working. Works nicely too. I also made a little gem that floats above you and rotates [editline]06:11PM[/editline] @name Halo @inputs I @outputs CircleRadius Time @persist X5 Y5 @trigger interval(10) if(first()) { holoCreate(9) holoModel(9,"hqtorus2") #Halo :D holoScale(9,vec(1,1,1)) holoMaterial(9,"models/debug/debugwhite") } holoPos(9,owner():shootPos()+vec(X5,Y5,10)) if(I < 180) {I++} if(I == 180) {I = -180} holoAng(9,ang(0,Time*2.5,180)) Time=Time+1 There yaoh go!
  • Avatar of Divran
  • [QUOTE=Infinity1995;18003801]Off topic: divran: Do you play infinity ward serious rp?[/QUOTE] I don't play any RP.
  • Avatar of Ratzz
  • [QUOTE=RagaMuffin;18006770]Off topic / blatant advertising.[/QUOTE] Am I not getting the e2?
  • Avatar of Infinity1995
  • [QUOTE=RagaMuffin;18006770]Off topic / blatant advertising.[/QUOTE] not really, its just a guy called divran plays on infinity wards server
  • Avatar of cruiser97
  • [QUOTE=Divran;17978649]Already made one like this a while ago :P To use it, put a prop directly below the elevator prop, then spawn the e2 on the elevator prop.. The ranger in the if first case needs to find a prop below the elevator prop for it to work correctly. [/QUOTE] Awesome, thanks. I'll check it out.
  • Avatar of Divran
  • [QUOTE=cruiser97;18009917]Awesome, thanks. I'll check it out.[/QUOTE] It was designed to be a spawn and go sort of thing. If you want it to be dupeable I suggest you remove the ranger code and make an input and use an entity marker to get the prop below the elevator. [editline]09:02PM[/editline] [QUOTE=Ratzz;18008052]Am I not getting the e2?[/QUOTE] [code]@name Atom @persist Electrons:array X @trigger if (first()|clk("Find")) { runOnTick(1) findIncludePlayerProps(owner()) #Limit the search to find only your entities findExcludeEntities(Electrons) #Exclude the props already found findByClass("prop_physics") #Limit the search to find only props findSortByDistance(owner():pos()) #Sort by distance Temp = findToArray() #Find them to a temporary array for(I=1,Temp:count()) { #Loop through the temporary array if (I>6) {Temp:remove(7), continue} #Remove if more than 6 E = Temp[I,entity] #Get the current entity #Color/Material/etc E:setTrails(10,5,2,"trails/laser",vec(50,50,255),255) E:setMaterial("models/alyx/emptool_glow") E:setAlpha(200) E:setColor(0,0,255) Electrons:pushEntity(E) #Move the entity to the main array } } X = (X + 1) % 360 #Add X. If X is greater than 360, make X = 0 again for(I=1,Electrons:count()) { #Loop through all electrons E = Electrons[I,entity] #Get the current entity if (!E) {Electrons:remove(I), continue} #If the current entity doesn't exist, remove it from the array Circle = vec(100,0,0):rotate(ang(X*6+I*(360/6),I*(360/3),0)) #Calculate the entity's position E:applyForce(((owner():shootPos()+Circle-E:massCenter())*10-E:vel())*E:mass()) #Move the entity to the target position } if (Electrons:count() < 6) {timer("Find",250)} #If there are less than 6 entities, search for more.[/code]
  • Avatar of Balto-the-Wolf-
  • Hey. I have been having the hardest time with helicopters. Both making them fly stabily and controlling them. Can you make me an E2 that will do that or can be wired to make collective and hover work properly
  • Avatar of Divran
  • [QUOTE=Balto-the-Wolf-Dog;18016245]Hey. I have been having the hardest time with helicopters. Both making them fly stabily and controlling them. Can you make me an E2 that will do that or can be wired to make collective and hover work properly[/QUOTE] I have only made 1 single helicopter, ever. And it sucked. So no, at least not now.