+ Reply to Thread
Page 1 of 5 1 2 3 ... LastLast
Results 1 to 10 of 47

Thread: Divran's E2/Contraptions Thread

  1. #1
    No u

    Divran is a jewel in the rough Divran is a jewel in the rough Divran is a jewel in the rough Divran is a jewel in the rough Divran's Avatar
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    2,456

    Cool Divran's E2/Contraptions Thread

    Divran's E2/Contraptions Thread
    In this thread, I will post any E2s and contraptions I dare release.

    I have placed this thread in the Custom Gates forum because it will most likely have more E2s than contraptions.


    Table of Contents
    • E2 Only Stuff
      • Hologram Artillery
    • Weapons
      • Missile Launcher
    • Useful & Useless
      • Useful
        • LS Information Screen
      • Useless
        • Afro
        • Crowbar Hax
        • Automatic Rater
    • Epic Things
      • Hangman
      • Color CD Player
      • Toaster
      • Lollercoaster

    I will use this for each E2:
    Name:
    Description:
    Chat Commands <- I will only have this here if there are any chat commands.
    Video/Pictures:
    Additional Credits To:
    Code:

    I will add more and more E2s to this thread as I make them and determine them to be release worthy.
    Please excuse my crappy videos. I don't have a program to edit them, and I generally suck at recording and that stuff.
    The Videos use tinyURL to break the automatic video thing on this forum on purpose. The XFire videos playing automatically got annoying for myself and many people.
    Last edited by Divran; 03-14-2010 at 05:14 AM.
    PewPew (New GCombat) | SVN Tutorial | EGP v3
    MY SVN LINK:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    


    Thanks for clicking, everyone!
    http://www.minerwars.com/?aid=927
    But if I get even more clicks, I get the full game, so keep at it!

  2. #2
    No u

    Divran is a jewel in the rough Divran is a jewel in the rough Divran is a jewel in the rough Divran is a jewel in the rough Divran's Avatar
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    2,456

    Default Re: Divran's E2/Contraptions Thread

    E2 ONLY stuff
    Stuff that only need one single E2 to function, and nothing else (excluding single-E2 weapons)



    Name: Hologram Artillery
    Description: Bombard people with hologram bullets! If you're an admin you can slay people (The slay code was made for Evolve. If it doesn't work for your admin mod, ask me and I'll make it work)
    Spawn the E2, and click Use to fire. Once it is "locked on", hold Use to move it. It moves slowly at first, then picks up speed.
    Chat Commands:
    ".force 1/0" - Makes the explosion push props aside as if it was real. (Not shown in the video)
    ".kill 1/0" - Enable/disable slaying
    ".give name" - Give control of the hologram artillery to target player.
    Video/Pictures: Use fullscreen mode!
    Hologram Artillery - Xfire Video
    Additional Credits To: T955i for giving me the idea.
    Code:
    Code:
    @name Holo Artillery
    @persist [Owner Bullet]:entity [StartPos CurPos Norm]:vector Size Ang Move Mode Sound Kill Speed Force Kills:array
    @trigger 
    if (first()) {
        ####
        # Hologram Artillery
        # Made by Divran
        # http://www.wiremod.com/forum/custom-gates/16081-divrans-e2-contraptions-thread.html
        ####
    
        concmd("say Hologram Artillery - Made by Divran")
    
        Kill = 0
        Force = 0
        Owner = owner()
        #Bullet
        holoCreate(1)
        Bullet = holoEntity(1)
        holoModel(1,"hqicosphere2")
        holoColor(1,vec(0,0,0))
        holoAlpha(1,0)
        #Explosion
        holoCreate(2)
        holoModel(2,"hqicosphere")
        holoColor(2,vec(255,255,0))
        holoAlpha(2,0)
        #Shockwave
        holoCreate(3)
        holoModel(3,"hqtorus2")
        holoScaleUnits(3,vec(10,10,10))
        holoColor(3,vec(50,40,40))
        holoAlpha(3,0)
        #Crosshair
        holoCreate(4)
        holoModel(4,"hqtorus2")
        holoScaleUnits(4,vec(40,40,4))
        holoColor(4,vec(35,35,35))
        holoCreate(5)
        holoModel(5,"hqcylinder2")
        holoScaleUnits(5,vec(2,4,35))
        holoColor(5,vec(35,35,35))
        holoCreate(6)
        holoModel(6,"hqcylinder2")
        holoScaleUnits(6,vec(2,4,35))
        holoColor(6,vec(35,35,35))
        holoAng(5,ang(90,90,0))
        holoAng(6,ang(90,0,0))
        holoPos(4,entity():pos()+vec(0,0,0.5))
        holoParent(6,4)
        holoParent(5,4)
        #Inside of explosion
        holoCreate(7)
        holoModel(7,"hqicosphere")
        holoColor(7,vec(255,255,0))
        holoAlpha(7,0)
        holoParent(7,2)
        
        runOnTick(1)
        runOnChat(1)
        
        Kills = array()
        Kills[1,string] = ""
        Kills[2,string] = "Double kill!"
        Kills[3,string] = "Triple kill!"
        Kills[4,string] = "Multi kill!"
        Kills[5,string] = "M-M-M-MONSTER KILL!"
        Kills[6,string] = "Ludicrous kill!!"
    }
    if (chatClk(owner())) {
        M = lastSaid():explode(" ")
        if (M:string(1) == ".give") {
            T = findPlayerByName(M:string(2))
            if (T) {
                print("Gave the artillery to: " + T:name())
                Owner = T
            } else {
                print("No player named " + M:string(2) + " found.")
            }
        } elseif (M:string(1) == ".kill") {
            Kill = clamp(sign(M:string(2):toNumber()),0,1)
            print("Kill set to " + Kill)
        } elseif (M:string(1) == ".force") {
            Force = clamp(sign(M:string(2):toNumber()),0,1)
            print("Force set to " + Force)
        }
    } elseif (tickClk()) {
        E = Owner:keyUse()
        #Start
        if (changed(E) & E & Mode == 0 & Owner:isAlive()) {
            #Bullet
            holoAlpha(1,255)
            Bullet:removeTrails()
            Bullet:setTrails(10,0,5,"trails/smoke",vec(60,60,60),255)
            #Effect
            StartPos = Owner:aimPos()
            CurPos = StartPos + vec(0,0,5000)
            Mode = 1
            holoPos(2,StartPos)
            Norm = Owner:aimNormal()*5
            holoPos(3,StartPos + Norm)
            holoScaleUnits(2,vec(1,1,1))
            holoScaleUnits(3,vec(1,1,1))
            holoScaleUnits(7,vec(1,1,1))
            #Crosshair Scale
            holoScaleUnits(4,vec(60,60,4))
            holoScaleUnits(5,vec(2.5,4.5,50))
            holoScaleUnits(6,vec(2.5,4.5,50))
            #Variables
            Speed = Move = Sound = Size = 0
            holoEntity(3):soundPlay(5,1,"buttons/button5.wav")
            timer("CrosshairScale",800)
        }
        if (Mode == 1) {
            #Moving crosshair
            if (E) {
                P = Owner:aimPos()-CurPos
                if(P:setZ(0):length()>5 | Speed){Speed+=0.3}
                CurPos+=( P:length()>(P:normalized()*Speed):length() ? P:normalized():setZ(0)*Speed : P:normalized() )
                Move = 1
            }
            #Falling
            CurPos -= vec(0,0,25)
            holoPos(1,CurPos)
            holoPos(4,CurPos:setZ(StartPos:z())+Norm/3)
            #Bombardment sound
            if (!Sound & (CurPos:z() - StartPos:z()) < 2100) {Sound = 1, Bullet:soundPlay(1,0,"weapons/mortar/mortar_shell_incomming1.wav")}
            #Hit
            if (CurPos:z() <= StartPos:z() - 10) {
                holoAlpha(1,0)
                holoAlpha(2,255)
                holoAlpha(3,255)
                holoAlpha(7,255)
                Mode = 2
                if (Move) {holoPos(2,CurPos+vec(0,0,35)), holoPos(3,CurPos+vec(0,0,35)+Norm)}
                soundStop(1)
                N = randint(3)
                holoEntity(1):soundPlay(2,0,"weapons/mortar/mortar_explode"+N+".wav")
                holoEntity(2):soundPlay(3,0,"weapons/mortar/mortar_explode"+N+".wav")
                holoEntity(3):soundPlay(4,0,"weapons/mortar/mortar_explode"+N+".wav")
                
                #Kill & Force
                if (Kill|Force) {
                    NrOfKills = 0
                    findInSphere(CurPos,510)
                    Targets = findToArray()
                        Name = ""
                        for(I=1,Targets:count()) {
                            En = Targets:entity(I)
                            if (Kill & En:isPlayer() & En:isAlive()) {
                                NrOfKills++
                                Name+= "\"" + En:name() + "\""
                            }
                            if (Force & !En:isPlayer() & En:owner() == owner()) {
                                Dist = CurPos:distance(En:pos())
                                if (Dist>510) {continue}
                                Dir = (En:pos()-CurPos) + vec(0,0,En:massCenter():z()-CurPos:z())
                                En:applyForce(Dir*250*((510-Dist)/4))
                            }
                                
                        }        
                        if (Name:trim() != "" & Kill) {concmd("ev slay " + Name:trim())}
                        if (Kill & Kills[NrOfKills,string] != "") {concmd("say " + Kills[NrOfKills,string])}
                }
            }
        } elseif (Mode == 2) {
            #Explosion Effect
            Size+=4
            holoScaleUnits(2,vec(Size,Size,Size))
            holoScaleUnits(7,vec(-Size,Size,Size)*0.99)
            holoScaleUnits(3,vec(Size*2,Size*2,Size/4))
            holoColor(2,vec(255,Size/2,0))
            holoColor(3,vec(50+Size/8,40+Size/8,40+Size/8))
            holoColor(7,vec(255,Size/2,0))
            holoAlpha(2,(Size>255 ? 255 - (Size-255) : 255))
            holoAlpha(3,(Size>255 ? 255 - (Size-255) : 255))
            holoAlpha(7,(Size>255 ? 255 - (Size-255) : 255))
            if (Size >= 510) {
                holoAlpha(2,0)
                holoAlpha(3,0)
                holoAlpha(7,0)
                Mode = 0
                soundPurge()
                holoScaleUnits(4,vec(40,40,4))
                holoScaleUnits(5,vec(2,4,35))
                holoScaleUnits(6,vec(2,4,35))
            }
        } elseif (Mode == 0) {
            #Move the crosshair
            Ang++
            if (Ang>360) {Ang = 0}
            holoAng(4,ang(0,Ang,0))
            holoPos(4,Owner:aimPos()+Owner:aimNormal()*2)
        }
    } elseif (clk("CrosshairScale")) {
        holoScaleUnits(4,vec(20,20,2))
        holoScaleUnits(5,vec(1,2,17.5))
        holoScaleUnits(6,vec(1,2,17.5))
    }
    
    Last edited by Divran; 01-16-2010 at 07:28 AM.
    PewPew (New GCombat) | SVN Tutorial | EGP v3
    MY SVN LINK:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    


    Thanks for clicking, everyone!
    http://www.minerwars.com/?aid=927
    But if I get even more clicks, I get the full game, so keep at it!

  3. #3
    No u

    Divran is a jewel in the rough Divran is a jewel in the rough Divran is a jewel in the rough Divran is a jewel in the rough Divran's Avatar
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    2,456

    Default Re: Divran's E2/Contraptions Thread

    Weapons
    E2s that can kill other players and/or contraptions


    Name: Missile Launcher
    Description: Send explosive props at someone.
    Chat Commands:
    ".target name" - Target that player.
    ".fire nr" - Fire missiles. Enter a number to fire that many missiles.
    ".clear" - Remove all missiles instantly and stop firing.
    Video/Pictures: Use fullscreen mode!
    Missle Launcher - Xfire Video
    Additional Credits To: I saw a missle launcher similar to this a while ago on this forum. Sorry - can't remember the name of the person who made it. Credits to him for giving me the idea. I did not, however, copy or look at any of his code.
    Code:
    -This E2 has been deemed too mingeable-
    Last edited by Divran; 12-02-2009 at 04:29 AM.
    PewPew (New GCombat) | SVN Tutorial | EGP v3
    MY SVN LINK:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    


    Thanks for clicking, everyone!
    http://www.minerwars.com/?aid=927
    But if I get even more clicks, I get the full game, so keep at it!

  4. #4
    No u

    Divran is a jewel in the rough Divran is a jewel in the rough Divran is a jewel in the rough Divran is a jewel in the rough Divran's Avatar
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    2,456

    Default Re: Divran's E2/Contraptions Thread

    Useful & Useless
    E2s that are either useful in some way or completely useless.

    Name: LS Information Screen
    Description: A dynamic screen that changes to match the storage you connect it to.
    Video/Pictures:
    http://tinyurl.com/y9oh6yp
    Additional Credits To: -
    Code:
    Code:
    @name LS Info
    @inputs [EGP Storage]:wirelink Active Gradient
    @persist [Nrs Amount Z ResNames]:array Clr:table
    @trigger 
    if (first()|~Storage) {
        EGP:egpClear()
        Nrs = array()
        Amount = array()
        Z = array()
        ResNames = array()
        
        #Background
        Nr=1
        EGP:egpBox(Nr,vec2(0,0),vec2(512,512),vec4(255,255,255,255))
        EGP:egpMaterial(1,"gui/center_gradient")
        Nr++
        EGP:egpBox(Nr,vec2(512/2-200,25),vec2(400,20),vec4(vec(),255))
        Nr++
        EGP:egpText(Nr," Life Support Information Screen             By Divran",vec2(512/2-200,25),vec4(0,100,0,255))
        EGP:egpSetFont(Nr,"Arial",20)
        Nr++
        EGP:egpBoxoutline(Nr,vec2(512/2-200,50),vec2(512-112,512-100),vec4(vec(),255))
        
        #Colors
        Clr["Energy",vector] =          vec(255,0,0)
        Clr["Oxygen",vector] =          vec(0,255,0)
        Clr["Water",vector] =           vec(0,0,255)
        Clr["Co2",vector] =             vec(255,165,0)
        Clr["Hydrogen",vector] =        vec(255,255,0)
        Clr["Nitrogen",vector] =        vec(255,0,255)
        Clr["Liquid Nit",vector] =      vec(100,0,100)
        Clr["Liquid Nitrogen",vector] = vec(100,0,100)
        Clr["Hvy Water",vector] =       vec(0,0,100)
        Clr["Heavy Water",vector] =     vec(0,0,100)
        Clr["Steam",vector] =           vec(0,255,255)
        Clr["Storage",vector] =         vec(0,0,0)
        
        #Set up
        Temp = array("Energy","Oxygen","Co2","Hydrogen","Nitrogen","Liquid Nit","Liquid Nitrogen","Water","Hvy Water", "Heavy Water","Steam","Storage")
        ResNames = array()
        N=0
        for(I=1,Temp:count()) {
            Nm = Temp[I,string]
            Val = Storage["Max " + Nm,number]
            if (Val != 0) {
                ResNames:pushString(Nm)
                Z:pushNumber(60 + N * 49)
                Amount:pushNumber(-1)
                N++
            }
        }
        
        #Draw
        Nrs[0,number] = Nr
        for(I=1,ResNames:count()) {
            Nm = ResNames[I,string]
            CurZ = Z[I,number]
            CurClr = Clr[Nm,vector]
                Nr++
                Nrs:pushNumber(Nr)
                EnergyNr = Nr
                EGP:egpText(Nr,Nm + " - 0/0 - 0%",vec2(512/2-190,CurZ),vec4(vec(),255))
                EGP:egpSetFont(Nr,"Arial",17)
                Nr++
                EGP:egpBoxoutline(Nr,vec2(512/2-190,CurZ+20),vec2(370,25),vec4(vec(),255))
                Nr++
                EGP:egpBox(Nr,vec2(512/2-5,CurZ+33),vec2(23,368),vec4(CurClr,255))
                if (Gradient) {EGP:egpMaterial(Nr,"gui/gradient_up")}
                EGP:egpAngle(Nr,90)
        }
        
        EGP:egpDraw()
    }
    
    #Active?
    if (Active) {interval(500)}
    
    #Gradient toggling
    if (~Gradient) {
        if (Gradient) {
            for(I=1,Nrs:count()) {
                Nr = Nrs[I,number]
                EGP:egpMaterial(Nr+2,"gui/gradient_up")
            }
        } else {
            for(I=1,Nrs:count()) {
                Nr = Nrs[I,number]
                EGP:egpMaterial(Nr+2,"")
            }
        }
    }
    
    #Calculate
    Draw = 0
    Nr = Nrs[0,number]
    for(I=1,ResNames:count()) {
        Nm = ResNames[I,string]
        CurZ = Z[I,number]
        Nr = Nrs[I,number]
        Val = Storage[Nm,number]
        if (Amount[I,number] != Val) {
            ValM = Storage["Max " + Nm,number]
            Percent = round(Val/ValM*100) + "%"
            Part = round(Val) + "/" + round(ValM)
            EGP:egpSetText(Nr,Nm + " - " + Part + " - " + Percent)
            Pos = 512/2-190+370*(Val/ValM)/2
            EGP:egpPos(Nr+2,vec2(Pos,CurZ+33))
            Size = 368*(Val/ValM)
            EGP:egpSize(Nr+2,vec2(23,Size))
            
            Amount[I,number] = Val
            
            Draw = 1
        }
    }
    
    #Draw?
    if (Draw & EGP:egpCanDraw()) {
        EGP:egpDraw()
    }
    
    Name: Afro
    Description: A very simple, useless E2. The only thing it does is give you a giant afro. Have fun!
    Video/Pictures:

    Additional Credits To: -
    Code:
    Code:
    @name Afro
    
        ####
        # Afro
        # Made by Divran
        # http://www.wiremod.com/forum/custom-gates/16081-divrans-e2-contraptions-thread.html
        ####
    
        concmd("say Afro - Made by Divran")
        
    Radius = 100
    holoCreate(1)
    O = owner()
    Atc = O:lookupAttachment("eyes")
    holoPos(1,O:attachmentPos(Atc)+(O:attachmentPos(Atc)-O:pos()):normalized() * (Radius/2+2) - O:forward() * 5)
    holoAng(1,O:attachmentAng(Atc))
    holoModel(1,"hqicosphere2")
    holoColor(1,vec(0,0,0))
    holoMaterial(1,"models/debug/debugwhite")
    holoScaleUnits(1,vec(Radius,Radius,Radius)*1.04)
    holoParentAttachment(1,O,"eyes")
    
    Name: Crowbar Hax
    Description: Whenever anyone on the server uses their crowbar, they scream HAX at the top of their lungs! Useless but extremely fun when used in groups.
    Video/Pictures: None. Can't take a picture of a sound.
    Additional Credits To: -
    Code:
    Code:
    @name Crowbar Hax for Everone
    @persist Ply:array PlyUse:array
    if (first()) {
    
        ####
        # Crowbar Hax
        # Made by Divran
        # http://www.wiremod.com/forum/custom-gates/16081-divrans-e2-contraptions-thread.html
        ####
    
        concmd("say Crowbar Hax - Made by Divran")
    
        findByClass("player")
        Ply = findToArray()
        for(I=1,Ply:count()) {PlyUse[Ply:entity(I):id(),number] = 45, holoCreate(I),holoPos(I,Ply:entity(I):shootPos()),holoParent(I,Ply:entity(I)),holoAlpha(I,0)}
    }
    interval(10)
    for(I=1,Ply:count()) {
        En = Ply:entity(I)
        Atk = En:keyAttack1()
        Wpn = En:weapon():type()
        if (Atk & Wpn == "weapon_crowbar") {
            Nr = PlyUse[En:id(),number]
            PlyUse[En:id(),number] = Nr + 1
            if (Nr>50) {
                PlyUse[En:id(),number] = 0
                holoEntity(I):soundPlay(I,0.7,"vo/npc/male01/hacks0"+randint(1,2)+".wav")
                soundPitch(I,165)
            }
        } else {soundStop(I), PlyUse[En:id(),number] = 45}
    }
    
    Name: Automatic Rater
    Description: This E2 will automatically rate everyone on the server a random rating every 60 seconds (Will not rate "bad").
    Video/Pictures: None.
    Additional Credits To: -
    Code:
    Code:
    @name Ratings :V
    @persist Rnd:array Ply:array
    interval(61000)
    timer("Rescan",300000)
    
    if (first()|duped()) {
        ####
        # Automatic Rater
        # Made by Divran
        # http://www.wiremod.com/forum/custom-gates/16081-divrans-e2-contraptions-thread.html
        ####
    
        concmd("say Automatic Rater - Made by Divran")
        
        findByClass("player")
        Ply = findToArray()
        Rnd:pushString("builder")
        Rnd:pushString("star")
        Rnd:pushString("like")
        Rnd:pushString("love")
        Rnd:pushString("artistic")
    }
    if (clk("Rescan")) {
        findByClass("player")
        Ply = findToArray()
    } else {
        for(I=1,Ply:count()) {
            if (Ply:entity(I) != owner()) {
                Rate = Rnd[randint(Rnd:count()),string]
                concmd("rateuser "+Ply:entity(I):id() + " " + Rate)
                #print("Rated " + Ply:entity(I):name() + " \"" + Rate + "\"!")
            }
        }
    }
    
    Name: Snowflakes
    Description: Christmas Rules! 'Nuff said.
    Video/Pictures:

    Additional Credits To: Techni, for the idea.
    Code:
    Code:
    @name Snowflakes
    @inputs On Wind:vector
    @persist [Pos Dir DirTime]:array Ready Nr Wind:vector Time
    @trigger 
    if (first()|duped()) {
        ####
        # Snowflakes
        # Made by Divran
        # http://www.wiremod.com/forum/custom-gates/16081-divrans-e2-contraptions-thread.html
        ####
    
        concmd("say Snowflakes - Made by Divran")
        Ready = Nr = 0
        if (!Wind) {Wind = vec(0.2,0,0)}
    }
    if (On & Ready) {
        if (~On) {
            runOnTick(1)
            Dir = array()
            Pos = array()
            DirTime = array()
            Nr = Time = 0
            holoAlpha(0,255)
            for(I=1,50) {
                holoAlpha(I,255)
                DirTime[I,number] = randint(100,500)
            }
        }
        interval(500)
        if (clk()) {
            Nr++
            if (Nr>50) {Nr=1}
            Rnd = randvec(vec(-300,-300,300),vec(300,300,500))
            Pos[Nr,vector] = entity():pos() + Rnd - Wind * Rnd:z()*3
            Time=clamp(Time+0.05,1,2000)
            holoScale(0,vec(4000,4000,Time)/12)
        } elseif (tickClk()) {
            for(I=1,50) {
                if (Pos[I,vector]) {
                    CurDir = Dir[I,vector]
                    Pos[I,vector] = Pos[I,vector] + CurDir
                    holoPos(I,Pos[I,vector])
                }
                DirTime[I,number] = DirTime[I,number] - 1
                if (DirTime[I,number] <= 0) {
                    DirTime[I,number] = randint(100,500)
                    Dir[I,vector] = Wind + vec(random(-0.1,0.1),random(-0.1,0.1),random(-0.4,-0.1))
                }
            }
        }
                
    } elseif (!On & Ready) {
        for(I=0,50) {holoAlpha(I,0)}
        runOnTick(0)
    } elseif (!Ready) {
        interval(150)
        if (holoCanCreate()) {
            Nr++
            if (Nr==50) {
                holoCreate(0)
                holoMaterial(0,"models/debug/debugwhite")
                Ready = 1
                print("Ready!")
            } else {
                holoCreate(Nr)
                holoScale(Nr,vec(4,4,4)/12)
                holoModel(Nr,"hqicosphere2")
                holoMaterial(Nr,"models/debug/debugwhite")
            }
        }
    }
    
    Attached Images
    Last edited by Divran; 03-14-2010 at 05:13 AM.
    PewPew (New GCombat) | SVN Tutorial | EGP v3
    MY SVN LINK:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    


    Thanks for clicking, everyone!
    http://www.minerwars.com/?aid=927
    But if I get even more clicks, I get the full game, so keep at it!

  5. #5
    No u

    Divran is a jewel in the rough Divran is a jewel in the rough Divran is a jewel in the rough Divran is a jewel in the rough Divran's Avatar
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    2,456

    Default Re: Divran's E2/Contraptions Thread

    Epic things
    My most epic creations will go here.


    Name: Hangman
    Description: Hangman! It's too epic for words.
    Note! After dupe, you need to update the expressions to get it to work.
    Chat Commands
    ".add name" - Add a player to the player list (Any player in the player list can play hangman. Those who are not in the player will not be allowed to play.). (Owner only)
    TIP: ".add *" will add EVERYONE to the list.
    ".remove name" - Remove a player from the player list. (Owner only)
    ".list" - Print the names of all players who are in the player list to chat. (Owner only)
    ".start word" - Start a new game with that word. (Owner only)
    ".stop" - Stop the current game (Owner only)
    ".g" / ".guess" + letter/1 word/whole thing - Type ".g" followed by a letter, 1 word, or the whole thing to guess.
    ".score name" - Make the score screen display the scores of target player.
    Video/Pictures: Use fullscreen mode!
    Hangman - Xfire Video
    Additional Credits To: - Filipe for giving me the idea.
    Dupe File: Wiremod.com Forums
    Code:
    Main E2
    Code:
    @name Hangman
    @inputs [Sc Fls HSc]:wirelink RecieveWord InputWord:string Driver:entity
    @persist On Fails MaxFails ScorePly StartPly:entity [FailGuess Ply STotal SWin SFail]:array Lookup:table [GuessWord Word Msg]:string
    @trigger 
    
    if (first()|duped()) {
        ####
        # Hangman
        # Made by Divran
        # http://www.wiremod.com/forum/custom-gates/16081-divrans-e2-contraptions-thread.html
        ####
        
        concmd("say Hangman - Made by Divran")
        
            #Starting Stuff
        #Variables
        On = Fails = 0
        runOnChat(1)
        E = entity()
        Ply[1,entity] = owner()
        #Console Screen
        Sc:writeCell(2041,1)
        W = "Made by "
        Sc:writeString(W,0,0)
        W1 = "Divran"
        Sc:writeString(W1,W:length(),0,611)
        W = "- Hangman -"
        Sc:writeString(W,15-round(W:length()/2),1,262)
        W = "Type \".g\" or \".guess\" followedby a letter or a word to guess"
        Sc:writeString(W,0,16)
        Sc:writeCell(2042,333)
        
        #Other console screen
        Fls:writeCell(2041,1)
        W = "Failed Guesses:"
        Fls:writeString(W,15-round(W:length()/2),0)
        W = "- None -"
        Fls:writeString(W,15-round(W:length()/2),1)
        Fls:writeCell(2042,333)
        
        #High Score Console Screen
        HSc:writeCell(2041,1)
        HSc:writeCell(2042,333)
        W = "Scoreboard"
        HSc:writeString(W,15-round(W:length()/2),0,60)
        ScorePly = owner():id()
        timer("UpdateScore",0)
        
            #Holograms
        #Positions
        Pos = array()
        Pos[1,vector] = vec(100,0,0) #Base
        Pos:pushVector(vec(100,45,100)) #Pole
        Pos:pushVector(vec(100,20,201.5)) #Top pole
        Pos:pushVector(vec(100,23,180)) #Diagonal pole
        Pos:pushVector(vec(100,-5,160)) #Rope
        Pos:pushVector(vec(100,-5,115)) #Head
        Pos:pushVector(vec(100,-5,82)) #Stomach
        Pos:pushVector(vec(100,6.5,80)) #Arm 1
        Pos:pushVector(vec(100,-16.5,80)) #Arm 2
        Pos:pushVector(vec(100,6.5,45)) #Leg 1
        Pos:pushVector(vec(100,-16.5,45)) #Leg 2
        MaxFails = Pos:count()
        
        #Scales
        Scale = array()
        Scale[1,vector] = vec(100,100,25)
        Scale:pushVector(vec(5,5,200))
        Scale:pushVector(vec(5,5,50))
        Scale:pushVector(vec(5,5,60))
        Scale:pushVector(vec(2,2,75))
        Scale:pushVector(vec(20,20,20))
        for(I=1,5) {Scale:pushVector(vec(5,5,45))}
        
        #Angles
        Ang = array()
        Ang[1,angle] = ang(0,0,0)
        Ang:pushAngle(ang(0,0,0))
        Ang:pushAngle(ang(90,90,0))
        Ang:pushAngle(ang(-45,90,0))
        for(I=1,3) {Ang:pushAngle(ang(0,0,0))}
        Ang:pushAngle(ang(-30,90,0))
        Ang:pushAngle(ang(30,90,0))
        Ang:pushAngle(ang(-30,90,0))
        Ang:pushAngle(ang(30,90,0))
        
        #Materials
        Mat = array()
        for(I=1,5) {Mat[I,string] = "phoenix_storms/wood"}
        for(I=6,Pos:count()) {Mat[I,string] = "models/debug/debugwhite"}
        
        #Color
        Col = array()
        for(I=1,4) {Col[I,vector] = vec(180,180,180)}
        Col[5,vector] = vec(255,255,255)
        for(I=6,Pos:count()) {Col[I,vector] = vec(0,0,0)}
        
        #Models
        Model = array()
        for(I=1,4) {Model[I,string] = "cube"}
        Model:pushString("hqcylinder2")
        Model:pushString("hqicosphere2")
        for(I=7,Pos:count()) {Model[I,string] = "hqcylinder2"}
        
        #Create Holograms
        for(I=1,Pos:count()) {
            holoCreate(I)
            holoPos(I,E:toWorld(Pos[I,vector]:rotate(ang(90,90,-90))))
            holoScale(I,(Scale[I,vector]/12)*1.04)
            holoAng(I,E:angles()+ang(90,0,0)+Ang[I,angle])
            holoMaterial(I,Mat[I,string])
            holoModel(I,Model[I,string])
            holoColor(I,Col[I,vector])
            holoAlpha(I,0)
            holoParent(I,E)
        }
    }
    
    #Chat commands
    if (chatClk()) {
        M = lastSaid():upper():explode(" ")
        M1 = M[1,string]
        #Owner only commands
        if (lastSpoke() == owner()) {
            if (M1 == ".ADD") {                             #ADD
                if (M[2,string]) {
                    if (M[2,string] == "AIM") {
                        Ent = owner():aimEntity()
                    } elseif (M[2,string] == "SELF") {
                        Ent = owner()
                    } elseif (M[2,string] == "*") {
                        findByClass("player")
                        Ply = findToArray()
                        print("Added everyone.")
                        exit()
                    } else {
                        Ent = findPlayerByName(M[2,string])
                    }
                    if (Ent & Ent:isPlayer()) {
                        print("Added " + Ent:name())
                        Ply:pushEntity(Ent)
                    } else {
                        print("[ERROR] Player not found.")
                    }
                } else {
                    print("[ERROR] Second parameter must be either 'aim', 'self', or a player's name.")
                }
            } elseif (M1 == ".REMOVE") {                    #REMOVE
                CurN = M[2,string]
                if (CurN) {
                    CurFind = findPlayerByName(CurN)
                    if (CurFind) {
                        Lookup = invert(Ply)
                        CurNr = Lookup[toString(CurFind),number]
                        if (CurNr) {
                            print("Player removed.")
                            Ply:remove(CurNr)
                        } else {
                            print("[ERROR] Player not in player list.")
                        }
                    } else {
                        print("[ERROR] Player not found.")
                    }
                } else {
                    print("[ERROR] Second parameter must be a string.")
                }
            } elseif (M1 == ".STOP") {                      #STOP
                On = 0                    
                Sc:writeCell(2039,8)
                Sc:writeCell(2039,9)
                print("Game stopped.")
            } elseif (M1 == ".NEW" | M1 == ".START") {      #START
                M:remove(1)
                CurWord = M:concat(" ")
                if (CurWord) {
                    hideChat(1)
                    if (CurWord:length() <= 30) {
                        Word = CurWord
                        
                        #Main Console Screen
                        CurWordR = Word:explode("")
                        GuessWordR = array()
                        for(I=1,CurWordR:count()) {
                            if (CurWordR[I,string] == " ") {
                                GuessWordR[I,string] = " "
                            } else {
                                GuessWordR[I,string] = "_"
                            }
                        }
                        GuessWord = GuessWordR:concat()
                        for(I=2,15) {Sc:writeCell(2039,I)}
                        Sc:writeString(GuessWord,15-round(GuessWord:length()/2),8)
                        
                        #Stuff
                        On = 1, Fails = 0
                        for(I=1,MaxFails) {holoAlpha(I,0)}
                        
                        #Failed Guesses Console Screen
                        FailGuess = array()
                        for(I=1,17) {Fls:writeCell(2039,I)}
                        W = "- None -"
                        Fls:writeString(W,15-round(W:length()/2),1)
                        W = "("+Fails+"/"+MaxFails+")"
                        Fls:writeString(W,30-W:length(),0)
                        
                        StartPly = owner()
                        W = "This round was started by:"
                        Sc:writeString(W,15-round(W:length()/2),13,777)
                        W = StartPly:name()
                        Sc:writeString(W,15-round(W:length()/2),14,777)
                            
                        #Message
                        print("Started a new game with the word: \""+Word+"\".")
                    } else {
                        print("[ERROR] The word is too long.")
                    }
                } else {
                    print("[ERROR] Second parameter must be a string.")
                }
            } elseif (M1 == ".LIST") {
                for(I=1,Ply:count()) {
                    print(I+": "+Ply[I,entity]:name())
                }
            }
        }
        #Guessing
        if (On) {
            if (M1 == ".GUESS" | M1 == ".G") {
                CurPly = lastSpoke()
                Allowed = 0
                for(I=1,Ply:count()) {if (Ply[I,entity] == CurPly) {Allowed = 1, break}}
                if (!Allowed) {exit()}
                M:remove(1)
                if (M[1,string]:length() == 0) {exit()}
                if (M:count() == 1 & M[1,string]:length() == 1) { #ONE LETTER
                    CurLetter = M[1,string]:left(1)
                    WordR = Word:explode("")
                    GuessWordR = GuessWord:explode("")
                    #Check for success
                    Correct = 0
                    for(I=1,WordR:count()) {
                        if (CurLetter == WordR[I,string]) {
                            GuessWordR[I,string] = CurLetter
                            Correct = 1
                        }
                    }
                    if (Correct) {
                        #Scores
                        if (StartPly != CurPly) {
                            SWin[CurPly:id(),number] = SWin[CurPly:id(),number] + 1
                            STotal[CurPly:id(),number] = SWin[CurPly:id(),number] - SFail[CurPly:id(),number]
                            if (entity(ScorePly) == CurPly) {timer("UpdateScore",0)}
                        }
                        
                        GuessWord = GuessWordR:concat()
                        Sc:writeCell(2039,8)
                        Sc:writeString(GuessWord,15-round(Word:length()/2),8,999)
                        #Check for win
                        if (GuessWord == Word) {timer("Win",0)}
                    } else {
                        FailGuess[FailGuess:count()+1,string] = CurLetter
                        timer("Fail",0)
                    }
                } elseif (M:count() == 1 & Word:explode(" "):count() != 1) { #ONE WORD
                        GuessWordB = GuessWord
                        WordR = Word:explode(" ")
                        Correct = 0
                        for(I=1,WordR:count()) {
                            if (M[1,string] == WordR[I,string]) {
                                GuessWordR = GuessWord:explode(" ")
                                GuessWordR[I,string] = WordR[I,string]
                                GuessWord = GuessWordR:concat(" ")
                                Correct = 1
                            }
                        }
                    if (Correct) {
                        if (StartPly != CurPly) {
                            Scr = 0
                            for(I=1,GuessWordB:length()) {
                                if (GuessWordB:index(I) == "_") {Scr+=1}
                            }
                            #Scores
                            SWin[CurPly:id(),number] = SWin[CurPly:id(),number] + Scr + 1
                            STotal[CurPly:id(),number] = SWin[CurPly:id(),number] - SFail[CurPly:id(),number]
                            if (entity(ScorePly) == CurPly) {timer("UpdateScore",0)}
                        }
                        
                        Sc:writeCell(2039,8)
                        Sc:writeString(GuessWord,15-round(Word:length()/2),8,999)
                        #Check for win
                        if (GuessWord == Word) {timer("Win",0)}
                    } else {                
                        FailGuess[FailGuess:count()+1,string] = "\""+M[1,string]+"\""
                        timer("Fail",0)
                    }
                } elseif (M:count() > 0) { #WHOLE WORD
                    GuessWordB = GuessWord
                    CurPly = lastSpoke()
                    CurWord = M:concat(" ")
                    if (CurWord == Word) { #SUCCESFUL GUESS
                        if (StartPly != CurPly) {
                            #Scores
                            Scr = 0
                            for(I=1,GuessWordB:length()) {
                                if (GuessWordB:index(I) == "_") {Scr+=1}
                            }
                            SWin[CurPly:id(),number] = SWin[CurPly:id(),number] + Scr + 3
                            STotal[CurPly:id(),number] = SWin[CurPly:id(),number] - SFail[CurPly:id(),number]
                            if (entity(ScorePly) == CurPly) {timer("UpdateScore",0)}
                        }
                        
                        
                        soundPlay(1,5,"vo/coast/odessa/male01/nlo_cheer0"+randint(4)+".wav")
                        Sc:writeCell(2039,8)
                        Sc:writeString(Word,15-round(Word:length()/2),8,999)
                        On = Fails = 0
                        Msg = "[Hangman] You escaped the gallows! The winner is: " + lastSpoke():name()
                        timer("Msg",(CurPly == owner() ? 1000 : 0))
                    } else { #FAILED GUESS
                        FailGuess[FailGuess:count()+1,string] = "\""+CurWord+"\""
                        timer("Fail",0)
                    }
                }
            }
        }
        if (M1 == ".SCORE") {
            M2 = M[2,string]
            if (M2) {
                CurPly = findPlayerByName(M2)
                if (CurPly) {
                    ScorePly = CurPly:id()
                    timer("UpdateScore",0)
                } else {
                    HSc:writeCell(2041,1)
                    HSc:writeCell(2042,333)
                    HSc:writeString("No player named '" + M2 + "' found.",0,5)
                }
            } else {
                HSc:writeCell(2041,1)
                HSc:writeCell(2042,333)
                HSc:writeString("You must enter a name.",0,5)
                
            }
        }
    } elseif (~RecieveWord & RecieveWord & !On) {
        CurWord = InputWord:upper()
        if (CurWord) {
            hideChat(1)
            if (CurWord:length() <= 30) {
                Word = CurWord
                
                #Main Console Screen
                CurWordR = Word:explode("")
                GuessWordR = array()
                for(I=1,CurWordR:count()) {
                    if (CurWordR[I,string] == " ") {
                        GuessWordR[I,string] = " "
                    } else {
                        GuessWordR[I,string] = "_"
                    }
                }
                GuessWord = GuessWordR:concat()
                for(I=2,15) {Sc:writeCell(2039,I)}
                Sc:writeString(GuessWord,15-round(Word:length()/2),8)
                
                #Stuff
                On = 1, Fails = 0
                for(I=1,MaxFails) {holoAlpha(I,0)}
                
                #Failed Guesses Console Screen
                FailGuess = array()
                for(I=1,17) {Fls:writeCell(2039,I)}
                W = "- None -"
                Fls:writeString(W,15-round(W:length()/2),1)
                W = " ("+Fails+"/"+MaxFails+")"
                Fls:writeString(W,30-W:length(),0)
                
                StartPly = Driver
                W = "This round was started by:"
                Sc:writeString(W,15-round(W:length()/2),13,777)
                W = StartPly:name()
                Sc:writeString(W,15-round(W:length()/2),14,777)
                
                #Message
                #print("Started a new game with the word: \""+Word+"\".")
                Msg = "[Hangman] " + StartPly:name() + " started a new game!"
                timer("Msg",0)
            } else {
                print("[ERROR] The word is too long.")
            }
        } else {
            print("[ERROR] Second parameter must be a string.")
        }
    } elseif (clk("Msg")) {concmd("say " + Msg)}
    
    #--------- FAIL AND WIN CODE
    if (clk("Fail")) {
        #Scores
        if (StartPly != lastSpoke()) {
            SFail[lastSpoke():id(),number] = SFail[lastSpoke():id(),number] + 1
            STotal[lastSpoke():id(),number] = SWin[lastSpoke():id(),number] - SFail[lastSpoke():id(),number]
            if (entity(ScorePly) == lastSpoke()) {timer("UpdateScore",0)}
        }
        
        soundPlay(1,2,"vo/npc/male01/pain0"+randint(9)+".wav")
        Fails++
        for(I=1,17) {Fls:writeCell(2039,I)}
        Fls:writeString(FailGuess:concat(" "),0,1)
        W = " ("+Fails+"/"+MaxFails+")"
        Fls:writeString(W,30-W:length(),0)
        for(I=1,MaxFails) {
            if (I<=Fails) {holoAlpha(I,255)} else {holoAlpha(I,0)}
        }
        if (Fails>=MaxFails) {
            #Scores
            if (StartPly != lastSpoke()) {
                Scr = 0
                for(I=1,GuessWord:length()) {
                    if (GuessWord:index(I) == "_") {Scr+=0.5}
                }
                SWin[StartPly:id(),number] = SWin[StartPly:id(),number] + round(Scr) + 5
                STotal[StartPly:id(),number] = SWin[StartPly:id(),number] - SFail[StartPly:id(),number]
                if (entity(ScorePly) == StartPly) {timer("UpdateScore",0)}
            }
            soundPlay(1,5,"vo/npc/male01/goodgod.wav")
            On = Fails = 0
            Msg = "[Hangman] Game over. You were hanged!"
            timer("Msg",(lastSpoke() == owner() ? 1000 : 0))
            W = "The word was: " + Word
            Sc:writeString(W,15-round(W:length()/2),9)
        }
    } elseif (clk("Win")) {
        #Scores
        if (StartPly != lastSpoke()) {
            SWin[lastSpoke():id(),number] = SWin[lastSpoke():id(),number] + 3
            STotal[lastSpoke():id(),number] = SWin[lastSpoke():id(),number] - SFail[lastSpoke():id(),number]
            if (entity(ScorePly) == lastSpoke()) {timer("UpdateScore",0)}
        }
        soundPlay(1,5,"vo/coast/odessa/male01/nlo_cheer0"+randint(4)+".wav")
        On = Fails = 0
        Msg = "[Hangman] You escaped the gallows! The winner is: " + lastSpoke():name()
        timer("Msg",(CurPly == owner() ? 1000 : 0))
    } elseif (clk("UpdateScore")) {
        HSc:writeCell(2041,1)
        HSc:writeCell(2042,333)
        CurPly = entity(ScorePly)
        W = "Scoreboard"
        HSc:writeString(W,15-round(W:length()/2),0,60)
        W = "Name: "
        W2 = CurPly:name()
        if ((W+W2):length()>30) {W2 = W2:left(30-W:length()-2) + ".."}
        HSc:writeString(W,0,1,60)
        HSc:writeString(W2,W:length(),1)
        W = "Correct Guesses:   "
        W2 = SWin[CurPly:id(),number]:toString()
        if ((W+W2):length()>30) {W2 = W2:left(30-W:length()-2) + ".."}
        HSc:writeString(W,0,2,60)
        HSc:writeString(W2,W:length(),2)
        W = "Failed Guesses:    "
        W2 = SFail[CurPly:id(),number]:toString()
        if ((W+W2):length()>30) {W2 = W2:left(30-W:length()-2) + ".."}
        HSc:writeString(W,0,3,60)
        HSc:writeString(W2,W:length(),3)
        W = "Total Score:       "
        W2 = STotal[CurPly:id(),number]:toString()
        if ((W+W2):length()>30) {W2 = W2:left(30-W:length()-2) + ".."}
        HSc:writeString(W,0,4,60)
        HSc:writeString(W2,W:length(),4)
        
        Leader = noentity()
        LeaderPoints = 0
        findByClass("player")
        Temp = findToArray()
        for(I=1,Temp:count()) {
            CurNumber = STotal[Temp[I,entity]:id(),number]
            if (CurNumber > LeaderPoints) {
                Leader = Temp[I,entity]
                LeaderPoints = CurNumber
            }
        }
        if (Leader) {
            W = "Leader - (" + LeaderPoints + ")"
            HSc:writeString(W,0,16,60)
            W2 = Leader:name()
            if (W2:length()>30) {W2 = W2:left(28) + ".."}
            HSc:writeString(W2,0,17)
        }
    }
    
    Derma Text Box E2
    Code:
    @name E2 Derma Text Box
    @inputs Chair:entity Active 
    @outputs SendWord Word:string Eject Driver:entity
    @persist Get
    @trigger 
    if (Chair & !Get) {
        ####
        # E2 Derma Text Box
        # Made by Divran
        # http://www.wiremod.com/forum/custom-gates/16081-divrans-e2-contraptions-thread.html
        ####
        
        Get = 1
        dPod(Chair)
        dPanel("Base",vec2(scrW()/2-100,scrH()/2-50),vec2(200,100))
        dLabel("Title","Base",vec2(5,4))
        dText("Title","Enter Word:")
        dColor("Title",0,0,0,255)
        dColor("Base",255,255,255,100)
        dShow("Base",0)
        dTextBox("Text","Base",vec2(10,30),180)
        dButton("Ok","Base",vec2(10,60),vec2(30,25))
        dButton("Exit Pod","Base",vec2(140,60),vec2(50,25))
    }
    
    if (~Active & Active) {
        dShow("Base",1)
        enableMouse(1)
    } elseif (~Active & !Active) {
        dShow("Base",0)
        enableMouse(0)
    }
    
    CurB = dClk()
    if (CurB) {
        if (CurB == "Ok") {
            CurWord = dSval("Text")
            if (CurWord) {
                if (CurWord:length() <= 30) {
                    Word = CurWord
                    Driver = Chair:driver()
                    SendWord = 1
                } else {
                    Chair:printDriver("[ERROR] The word is too long.")
                }
            } else {
                Chair:printDriver("[ERROR] You must enter a word.")
            }
        } elseif (CurB == "Exit Pod") {
            dShow("Base",0)
            dSetSval("Text","")
            enableMouse(0)
            Eject = 1
        }
    } else {SendWord = Eject = 0}
    
    Name: Color CD Player
    Description: I know this has been made loads of times before. But this one has some extra features. It automatically picks up the CD and puts it in the player and plays the song. Louder volume. And it looks awesome.
    Update! I have added speakers, and they actually MOVE when you play music! (Not shown in the video, as that was filmed before I made the speakers)
    Remember! After dupe, you need to push the Reset button to make it work.
    Video/Pictures: Use fullscreen mode!
    Color CD Player - Xfire Video

    Additional Credits To: -
    Dupe File: Wiremod.com Forums
    Code:
    Code:
    @name Color CD Player
    @inputs E:entity Eject Reset ResetClk On
    @inputs [Skr1 Skr2 Skr3 Skr4 Skr5 Skr6]:entity
    @outputs Txt:string TxtColor:vector
    @persist [Pos1 Pos2]:vector Mode CD:entity Color:vector Sound:table Dist Next Fade SpeakerAnim
    @trigger 
    if (first()|duped()) {
        ####
        # Color CD Player
        # Made by Divran
        # http://www.wiremod.com/forum/custom-gates/16081-divrans-e2-contraptions-thread.html
        ####
    
        concmd("say Color CD Player - Made by Divran")
        
        Pos1 = E:toWorld(vec(75,0,5):rotate(ang(0,-135,0)))
        Pos2 = E:toWorld(vec(25,0,5):rotate(ang(0,-135,0)))
        findIncludePlayerProps(owner())
        holoCreate(10)
        holoMaterial(10,"models/debug/debugwhite")
        holoColor(10,vec(75,75,75))
        holoScaleUnits(10,vec(35,-35,2))
        holoCreate(11)
        holoMaterial(11,"models/debug/debugwhite")
        holoColor(11,vec())
        holoModel(11,"dome")
        holoScaleUnits(11,vec(30,30,8))
        holoPos(11,E:toWorld(vec(25,0,11):rotate(ang(0,-135,0))))
        holoAng(11,ang())
        holoParent(11,E)
        
        Temp = array( Skr1, Skr2, Skr3, Skr4, Skr5, Skr6 )
        for(I=1,6) {
            CurE = Temp[I,entity]
            if (!CurE) {continue}
            holoCreate(I)
            holoPos(I,CurE:toWorld(CurE:boxCenter())-CurE:up()*6.5)
            holoParent(I,CurE)
            holoAng(I,CurE:angles())#+ang(90,0,0))
            holoModel(I,"dome2")
            holoScaleUnits(I,vec(47,47,3.5)*1.04+vec(0,0,4))
            holoColor(I,vec(75,75,75))
        }
        
        for(I=21,26) {
            holoCreate(I)
            if (!holoEntity(I-20)) {continue}
            holoPos(I,holoEntity(I-20):pos()+holoEntity(I-20):up()*3.5)
            holoAng(I,holoEntity(I-20):angles()+ang(180,0,0))
            holoModel(I,"dome")
            holoScaleUnits(I,vec(20,20,10))
            holoMaterial(I,"models/debug/debugwhite")
            holoColor(I,vec())
            holoParent(I,I-20)
        }
            
        
        #SOUND LIST
        Sound[vec(255,0,0):toString(),string]       = "ravebreak.mp3"                           #RED
        Sound[vec(0,255,0):toString(),string]       = "music/HL2_song12_long.mp3"               #GREEN
        Sound[vec(0,0,255):toString(),string]       = "music/HL1_song25_remix3.mp3"             #BLUE
        Sound[vec():toString(),string]              = "music/HL2_song20_submix0.mp3"            #BLACK
        Sound[vec(255,255,0):toString(),string]     = "music/HL2_song3.mp3"                     #YELLOW
        Sound[vec(255,0,255):toString(),string]     = "music/HL2_song16.mp3"                    #PINK
        Sound[vec(0,255,255):toString(),string]     = "music/HL2_song31.mp3"                    #TEAL
        Sound[vec(255,255,255):toString(),string]   = "music/HL2_song4.mp3"                     #WHITE
        Sound[vec(150,75,0):toString(),string]      = "music/HL2_song23_SuitSong3.mp3"          #BROWN
        #You can add more sounds simply by coping the above, changing the color and file path.
    }
    
        # ON/OFF  
    if (~On | (first() & On)) {                          
        if (On) {
            Mode = 0
            Txt = "-[ On ]-"
            Fade = 255
            runOnTick(1)
        } elseif (!On) {
            Txt = "-[ Off ]-"
            Fade = 255
            soundPurge()
            SpeakerAnim = 0
            Mode = 5
            if (!CD) {runOnTick(0)}
        }
    }
    
        # EJECT
    if (Eject & ~Eject & Mode == 4) {
        Txt = "-[ Ejecting.. ]-"
        Fade = 255
        soundPurge()
        SpeakerAnim = 0
        Mode = 5
    }
    
        # RESET
    if (Reset & ResetClk) {
        if (entity(ResetClk) == owner()) {
            soundPurge()
            reset()
        } else {
            Txt = "-[ Only the owner can reset ]-"
            Fade = 255
        }
    }
    
        # TEXT SCREEN FADING
    if (Fade>1) {
        if (!On) {interval(10)}
        Fade-=1
        TxtColor = vec(Fade,0,0)
    }
    
        # SPEAKER ANIMATION
    if (SpeakerAnim) {
        timer("Scale",250)
        if (clk("Scale")) {
            RandZ = randint(-4,4)
            for(I=1,6) {
                holoScaleUnits(I,vec(47,47,3.5+RandZ)*1.04)
                holoScaleUnits(I+20,vec(20,20,10-RandZ)*1.04)
            }
        }
    }
    
        # SCAN
    if (Mode == 0) {
        holoAlpha(10,0)
        interval(250*On)
        if (clk() & On & findCanQuery()) {
            findInSphere(Pos1,50)
            findClipToModel("models/props_junk/sawblade001a.mdl")
            findSortByDistance(Pos1)
            CurEnt = find()
            if (CurEnt & !CurEnt:isPlayerHolding()) {
                Txt = "-[ CD Found ]-"
                Fade = 255
                E:soundPlay(1,1,"buttons/button14.wav")
                CD = CurEnt
                Mode = 1
            }
        }
        # MOVE STEP 1
    } elseif (Mode == 1) {
        holoAlpha(10,255)
        Cnt = CD:toWorld(CD:boxCenter())
        CD:applyForce(((Pos1-Cnt)*10-CD:vel()*1.2)*CD:mass())
        Torque = CD:toLocal(rotationVector(quat(-CD:angles():setYaw(0))/quat(CD))+CD:pos())
        CD:applyTorque((Torque*75-CD:angVelVector()*10)*CD:inertia())
        if (Pos1:distance(Cnt) < 4 & inrange(Torque,vec(-0.1,-0.1,-0.1),vec(0.1,0.1,0.1))) {
            Mode = 2
        }
        holoPos(10,E:toWorld(vec(1*Pos2:distance(Cnt)+12.5,0,5):rotate(ang(0,-135,0))))
        holoScaleUnits(10,vec(Pos2:distance(Cnt)+12.5,-35,2))
        holoAng(10,(E:pos()-Cnt):toAngle():setPitch(0))
        # MOVE STEP 2
    } elseif (Mode == 2) {
        Cnt = CD:toWorld(CD:boxCenter())
        CD:applyForce(((Pos2-Cnt)*10-CD:vel()*1.2)*CD:mass())
        Torque = CD:toLocal(rotationVector(quat(-CD:angles():setYaw(0))/quat(CD))+CD:pos())
        CD:applyTorque((Torque*75-CD:angVelVector()*5)*CD:inertia())
        if (Pos2:distance(Cnt) < 4 & inrange(Torque,vec(-0.1,-0.1,-0.1),vec(0.1,0.1,0.1))) {
            Mode = 3
        }
        holoPos(10,E:toWorld(vec(1*Pos2:distance(Cnt)+12.5,0,5):rotate(ang(0,-135,0))))
        holoScaleUnits(10,vec(Pos2:distance(Cnt)+12.5,-35,2))
        holoAng(10,(E:pos()-Cnt):toAngle():setPitch(0))
        # GET COLOR AND START SOUND
    } elseif (Mode == 3) {
        holoAlpha(10,0)
        Cnt = CD:toWorld(CD:boxCenter())
        CD:applyForce(((Pos2-Cnt)*10-CD:vel()*1.2)*CD:mass())
        Color = CD:getColor()
        holoColor(11,Color)
        String = Sound[Color:toString(),string]
        if (!String) {
            soundPurge()
            SpeakerAnim = 0
            Mode = 5
            E:soundPlay(1,0,"buttons/button10.wav")
            Txt = "-[ Invalid Color ]-"
            Fade = 255
        } else {
            Mode = 4
            for(I=1,6) {holoEntity(I):soundPlay(I,0,String)}
            SpeakerAnim = 1
            Txt = "-[ Now Playing ]-\n \""+String+"\""
            Fade = 255
        }
        # IDLE - PLAYING
    } elseif (Mode == 4) {
        Cnt = CD:toWorld(CD:boxCenter())
        CD:applyForce(((Pos2-Cnt)*10-CD:vel()*1.2)*CD:mass())
        CD:applyAngForce(ang(0,45,0)*100)
        Col2 = Color * (0.7+cos(curtime()*100)*0.3)
        holoColor(11,Col2)
        # EJECTING
    } elseif (Mode == 5) {
        holoAlpha(10,255)
        Cnt = CD:toWorld(CD:boxCenter())
        CD:applyForce(((Pos1-Cnt)*10-CD:vel()*1.2)*CD:mass())
        Torque = CD:toLocal(rotationVector(quat(-CD:angles():setYaw(0))/quat(CD))+CD:pos())
        CD:applyTorque((Torque*50-CD:angVelVector()*10)*CD:inertia())
        if (Pos1:distance(Cnt) < 4 & inrange(Torque,vec(-0.1,-0.1,-0.1),vec(0.1,0.1,0.1))) {
            Mode = 6
            Dist = Pos2:distance(Cnt)
            Next = 0
        }
        holoPos(10,E:toWorld(vec(1*Pos2:distance(Cnt)+12.5,0,5):rotate(ang(0,-135,0))))
        holoScaleUnits(10,vec(Pos2:distance(Cnt)+12.5,-35,2))
        holoAng(10,(E:pos()-Cnt):toAngle():setPitch(0))
        if (CD:isPlayerHolding()) {Mode = 0}
        # EJECTING STEP 2
    } elseif (Mode == 6) {
        timer("Mode",2500)
        if (clk("Mode")) {Next = 1}
        Dist-=Dist*0.1
        holoPos(10,E:toWorld(vec(1*Dist+12.5,0,5):rotate(ang(0,-135,0))))
        holoScaleUnits(10,vec(Dist+12.5,-35,2))
        if (!On) {runOnTick(0)}
        if (round(Dist)<=0 & Next) {Mode = 0, CD = noentity()}
        if (CD:isPlayerHolding()) {Mode = 0, CD = noentity()}
    }
    
    Name: Toaster
    Description: This is for you Schilcote.
    Video/Pictures: Use fullscreen mode!
    TOASTERS!!! - XFire Video
    Additional Credits To: -
    Dupe File: Wiremod.com Forums
    Code:
    Code:
    @name TOASTERS!!!!
    @inputs Base:entity Btn
    @persist [Slots Toasts Stage]:array Toasting Toast
    @trigger 
    
    if (first()|duped()) {    
        ####
        # Toaster
        # Made by Divran
        # http://www.wiremod.com/forum/custom-gates/16081-divrans-e2-contraptions-thread.html
        ####
    
        if (duped()) { #Only makes you say it when duped.. because of the "reset()" command in this code.
            concmd("say Toaster - Made by Divran")
        }
        
        Slots[1,vector] = vec(-3,-15,19.5)
        Slots[2,vector] = vec(-3,0,19.5)
        Slots[3,vector] = vec(-3,15,19.5)
        Slots[4,vector] = vec(3,-15,19.5)
        Slots[5,vector] = vec(3,0,19.5)
        Slots[6,vector] = vec(3,15,19.5)
        runOnTick(1)
        findIncludePlayerProps(owner())
    }
    
    if (Toasting == 0) {
        Cnt = Base:toWorld(Base:boxCenter())
        timer("Find",250)
        if (clk("Find") & findCanQuery()) {
            findExcludeEntities(Toasts)
            findInSphere(Cnt+vec(0,0,30),50)
            findClipToClass("prop_physics")
            findClipToModel("models/squad/sf_plates/sf_plate1x1")
            findSortByDistance(Cnt+vec(0,0,30))
            Temp = findToArray()
            for(I=1,Temp:count()) {
                if (Toasts:count()<6 & !Temp[I,entity]:isPlayerHolding()) {
                    Temp[I,entity]:setMass(50)
                    Temp[I,entity]:setMaterial("models/debug/debugwhite")
                    Temp[I,entity]:setColor(250,200,0)
                    Toasts:pushEntity(Temp[I,entity])
                    Stage:pushNumber(0)
                } else {
                    break
                }
            }
        }
        if (Toasts:count()>0) {
            for(I=1,Toasts:count()) {
                E = Toasts[I,entity]
                if (!E) {Toasts:remove(I), Stage:remove(I), continue}
                #applyForce
                Cnt = E:toWorld(E:boxCenter())
                TargetPos = Base:toWorld(Slots[I,vector] + vec(0,0,20 * !Stage[I,number]))
                E:applyForce(((TargetPos-Cnt)*10-E:vel())*E:mass())
                #applyTorque
                Torque = E:toLocal(rotationVector(quat(Base:angles():setPitch(90))/quat(E))+E:pos())
                E:applyTorque((Torque*100-E:angVelVector()*5)*E:inertia())
                #Stage
                if (TargetPos:distance(Cnt) < 2 & positive(Torque):length() < 1) {Stage[I,number] = 1}
            }
            
            if (~Btn & Btn & Stage:min() != 0) {Toasting = 1, Toast = 250}
        }
        
    } elseif (Toasting == 1) {
        timer("Toast",500)
        if (clk("Toast")) {Toast-=10}
        for(I=1,Toasts:count()) {
            E = Toasts[I,entity]
            if (!E) {Toasts:remove(I), Stage:remove(I), continue}
            #applyForce
            Cnt = E:toWorld(E:boxCenter())
            TargetPos = Base:toWorld(Slots[I,vector])
            E:applyForce(((TargetPos-Cnt)*10-E:vel())*E:mass())
            E:setColor(Toast,Toast-100,0)
        }
        if (Toast<=100 | (~Btn & Btn)) {
            for(I=1,Toasts:count()) {
                E = Toasts[I,entity]
                if (!E) {Toasts:remove(I), Stage:remove(I), continue}
                E:applyForce(vec(random(-5000,5000),random(-5000,5000),random(16000,19000)))
            }
            Toasting = 2
            timer("Reset",5000)
        }
    }
    if (clk("Reset")) {reset()} #I tried Toasts = array(), but it didn't want to find the toasts again. So I used reset()
    
    Name: Lollercoaster
    Description: A dynamic rollercoaster. Create the track as you ride on it!
    Controls are:
    W: Down
    S: Up
    A & D: Left & Right
    Mouse1 & Mouse2: Roll left & Right
    R: Reset angles
    Shift: Speed boost
    The coaster automatically ejects the driver if crashed into a wall.
    How to spawn:
    1: Spawn the coaster car prop.
    2: Spawn a chair.
    3: Nocollide the chair to the prop, position it, and weld it.
    4: Dupe this with the normal duplicator tool.
    5: Spawn as many other cars as you want using duplicator.
    6: Spawn an adv pod controller, and link it to the chair. (On the main car. The first one.)
    7: Use the Wirelink tool on the Adv pod controller
    8: Spawn the E2 (On the main car. The first one.)
    9: Wire "Pod [Wirelink]" to the Adv pod controller's new Wirelink output, and Active to Active.
    10 Get in and drive!
    NOTE: If you spawn new cars, you need to update the E2 so that it finds them.
    Video/Pictures: Use fullscreen mode!
    Lollercoaster - Xfire Video

    Additional Credits To: - FlieBoy101 for giving me the idea (He has also made one just like this)
    Code:
    Code:
    @name Lollercoaster
    @inputs Pod:wirelink Active
    @persist [Pos Ang Cars]:array CurPos:vector Quat:quaternion N N2 Count
    @trigger
    if (first()|duped()) {
        ####
        # Lollercoaster
        # Made by Divran
        # http://www.wiremod.com/forum/custom-gates/16081-divrans-e2-contraptions-thread.html
        ####
    
        concmd("say Lollercoaster - Made by Divran")
        
        for(I=1,2) {
            holoCreate(I)
            holoModel(I,"hqicosphere2")
            holoMaterial(I,"models/debug/debugwhite")
            holoColor(I,vec(75,75,75))
            holoScale(I,vec(5,5,5)/12)
            holoEntity(I):removeTrails()
            holoEntity(I):setTrails(4,2,6,"cable/cable2",vec(),255)
            holoAlpha(I,0)
        }
        for(I=3,30) {
            holoCreate(I)
            holoMaterial(I,"models/debug/debugwhite")
            holoColor(I,vec(100,30,0))
            holoScale(I,vec(5,45,2)/12)
            holoAlpha(I,0)
        }
        
        findIncludePlayerProps(owner())
        findByModel("models/XQM/coastertrain2seat.mdl")
        findSortByDistance(entity():pos())
        Cars = findToArray()
        for(I=1,Cars:count()) {
            if (Cars[I,entity]:mass() != 50000) {Cars[I,entity]:setMass(50000)}
        }
    } 
    runOnTick(Active)
    if (~Active) {
        if (Active) {
            Quat = quat(Cars[1,entity])
            Pos[1,vector] = Cars[1,entity]:pos() + vec(0,0,20)
            for(I=1,30) {holoAlpha(I,255), holoPos(I,vec())}
            for(I=1,Cars:count()) {
                Cars[I,entity]:soundPlay(I,0,"vehicles/fast_windloop1.wav")
            }
        } else {
            Pos = array()
            Ang = array()
            soundPurge()
            for(I=1,Cars:count()) {
                Cars[I,entity]:applyForce(-Cars[I,entity]:vel()*Cars[I,entity]:mass())
            }
            Pod["Eject",number] = 0
            for(I=1,30) {holoAlpha(I,0)}
        }
    }
    if (Active) {
        #Get controls
        W = Pod["W",number]
        A = Pod["A",number]
        S = Pod["S",number]
        D = Pod["D",number]
        M1 = Pod["Mouse1",number]
        M2 = Pod["Mouse2",number]
        Shift = Pod["Shift",number]
        R = Pod["R",number]
        
        #WASD Controls
        P2 = qRotation(Quat:right(),(S-W)*(1+Shift))
        Y2 = qRotation(Quat:up(),(A-D)*(1+Shift))
        R2 = qRotation(Quat:forward(),(M2-M1)*(2+Shift*2))
        Quat = (Y2*P2*R2) * Quat
        
        #Arrays
        Pos:unshiftVector(Pos[1,vector]+Quat:forward()*(8+Shift*20))
        Ang:unshiftAngle(Quat:toAngle())
        
        #Holograms
        holoPos(1,Pos[1,vector]+Quat:right()*25)
        holoPos(2,Pos[1,vector]-Quat:right()*25)
        Dist = CurPos:distance(Pos[1,vector])
        if (Dist > 50) {
            CurPos = Pos[1,vector]
            N++
            if (N > 30) {N = 3}
            holoPos(N,Pos[1,vector])
            holoAng(N,Ang[1,angle])
        }
        
        
        #Align to ang(0,X,0)
        if (R) {Quat = slerp(Quat,quat(ang(0,Quat:toAngle():yaw(),0)),0.06)}
        
        if (Pos:count()>=50) {
            #Ranger Check   
            rangerFilter(array(Cars[1,entity], Pod["Entity",entity]))
            Rng = rangerOffset(100,Pos[50,vector],quat(Ang[50,angle]):forward())
            if (Rng:hit()) {Pod["Eject",number] = 1}
        }
        
        for(I=1,min(5,Cars:count())) {
            #Count
            Count++
            if (Count>Cars:count()) {Count = 1}
            #Get E
            E = Cars[Count,entity]
            if (!E) {continue, Cars:remove(I)}
            #Array Num
            Num = 50+(Count-1)*30
            if (Pos:count()<Num) {continue}
            
            #Apply Torque
            V = E:toLocal(rotationVector(quat(Ang[Num,angle])/quat(E))+E:pos())
            E:applyTorque((V*800-E:angVelVector()*15)*E:inertia())
            
            #Apply Force
            E:applyForce(((Pos[Num,vector]-E:toWorld(E:boxCenter()-vec(0,0,20)))*10-E:vel())*E:mass())
            
            #Clear Array
            if (Count == Cars:count()) {Pos:remove(Num), Ang:remove(Num)}
            soundPitch(Count,clamp(E:vel():length()/20,50,300))        
        }
    }
    
    Attached Images
    Attached Files
    Last edited by Divran; 01-16-2010 at 03:30 PM.
    PewPew (New GCombat) | SVN Tutorial | EGP v3
    MY SVN LINK:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    


    Thanks for clicking, everyone!
    http://www.minerwars.com/?aid=927
    But if I get even more clicks, I get the full game, so keep at it!

  6. #6
    No u

    Divran is a jewel in the rough Divran is a jewel in the rough Divran is a jewel in the rough Divran is a jewel in the rough Divran's Avatar
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    2,456

    Default Re: Divran's E2/Contraptions Thread

    Bumping ... because there are not even any comments >.>

    Oh and if anyone knows how to make XFire videos not play automatically as soon as you open the page, please let me know.
    PewPew (New GCombat) | SVN Tutorial | EGP v3
    MY SVN LINK:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    


    Thanks for clicking, everyone!
    http://www.minerwars.com/?aid=927
    But if I get even more clicks, I get the full game, so keep at it!

  7. #7
    Wirererer Thgin is on a distinguished road Thgin's Avatar
    Join Date
    Mar 2008
    Posts
    130

    Default Re: Divran's E2/Contraptions Thread

    Quote Originally Posted by Divran View Post
    Oh and if anyone knows how to make XFire videos not play automatically as soon as you open the page, please let me know.
    They don't?

  8. #8
    No u

    Divran is a jewel in the rough Divran is a jewel in the rough Divran is a jewel in the rough Divran is a jewel in the rough Divran's Avatar
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    2,456

    Default Re: Divran's E2/Contraptions Thread

    Quote Originally Posted by Thgin View Post
    They don't?
    For me they do...

    Hm well they don't play as soon as I open the page, but as soon as I scroll over them.
    PewPew (New GCombat) | SVN Tutorial | EGP v3
    MY SVN LINK:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    


    Thanks for clicking, everyone!
    http://www.minerwars.com/?aid=927
    But if I get even more clicks, I get the full game, so keep at it!

  9. #9
    Wire Sofaking Solece has a little shameless behaviour in the past Solece's Avatar
    Join Date
    Jul 2008
    Location
    Pittsburgh, PA
    Posts
    660

    Default Re: Divran's E2/Contraptions Thread

    Some very nice contraptions, but next time please don't sextuple post
    Quote Originally Posted by Ehmmett
    Ehmmett <3: Too much effort to play a game to fap.

  10. #10
    No u

    Divran is a jewel in the rough Divran is a jewel in the rough Divran is a jewel in the rough Divran is a jewel in the rough Divran's Avatar
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    2,456

    Default Re: Divran's E2/Contraptions Thread

    Quote Originally Posted by haloguy922 View Post
    Some very nice contraptions, but next time please don't sextuple post
    I wanted several posts to better sort them. I will be adding more to it later. Probably on the weekends more than weekdays, though.
    PewPew (New GCombat) | SVN Tutorial | EGP v3
    MY SVN LINK:
    Code:
    http://divranspack.googlecode.com/svn/trunk/%20divranspack/
    


    Thanks for clicking, everyone!
    http://www.minerwars.com/?aid=927
    But if I get even more clicks, I get the full game, so keep at it!

+ Reply to Thread
Page 1 of 5 1 2 3 ... LastLast

LinkBacks (?)


Similar Threads

  1. Longest Thread Ever!!1one (junk thread)
    By Jat Goodwin in forum Off-Topic
    Replies: 5285
    Last Post: 16 Minutes Ago, 02:10 PM
  2. A few Contraptions
    By Gobo in forum Finished contraptions
    Replies: 13
    Last Post: 08-04-2009, 11:20 AM
  3. The Contraptions Suggestion Thread
    By Eirath245 in forum Ideas & Suggestions
    Replies: 22
    Last Post: 04-18-2009, 03:01 AM
  4. Sax's Contraptions.
    By Sax in forum Finished contraptions
    Replies: 16
    Last Post: 08-23-2008, 12:08 PM
  5. All my contraptions
    By Teaqu in forum Finished contraptions
    Replies: 3
    Last Post: 04-28-2008, 06:08 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
proceed-collector
proceed-collector
proceed-collector
proceed-collector
linguistic-parrots
linguistic-parrots
linguistic-parrots
linguistic-parrots