+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: [E2]FlashBang,Smoke Grenade and Hide Box

  1. #1
    Wirererer failcake's Avatar
    Join Date
    Jul 2009
    Location
    In Aperture Science Laboratories
    Posts
    298

    Smile [E2]FlashBang,Smoke Grenade and Hide Box

    Hai, its been a while i posted somehting. Heres something ive been working on

    Hide Box v1

    Code:
    @name FailCake Hide Box V1
    @persist Timer Alert
    @trigger all
    
    
    
    runOnTick(1)
    O = owner()
    Ow = owner()
    
    if(first()){
    hint("MADE BY [CG]FailCake",100)   
    }
    
    if(Ow:keyUse()){
    Alert+= 0.1
    
    
    holoCreate(3)
    holoModel(3,"cube")
    holoPos(3,O:pos()+vec(0,0,100))  
    holoScaleUnits(3,vec(3,3,13))
    holoAlpha(3,200)
    holoColor(3,vec(255,0,0))
    holoMaterial(3,"")
    
    holoCreate(4)
    holoModel(4,"cube")
    holoPos(4,O:pos()+vec(0,0,87))  
    holoScaleUnits(4,vec(3,3,3))
    holoAlpha(4,200)
    holoColor(4,vec(255,0,0))
    holoMaterial(4,"")
    
    if(Alert == 1){
    holoEntity(3):soundPlay(100,100,"ambient/alarms/klaxon1.wav")  
    }
    
    }else{
    Alert = 0
    soundStop(100)
    holoDelete(3)
    holoDelete(4)
    }
    
    if(Ow:isCrouch()){
    Timer+=0.1
    owner():weapon():setAlpha(0)
    owner():weapon():setColor(255,255,255,0)
    
    holoCreate(1)
    holoModel(1,"cube")
    holoPos(1,O:pos()+vec(0,0,23.5))  
    holoScale(1,vec(-4,-4,-4))
    holoColor(1,vec(255,255,255))
    holoAlpha(1,240)
    holoMaterial(1,"models/props_wasteland/wood_fence01a")
    holoParent(1,2)
    
    holoCreate(2)
    holoModel(2,"cube")
    holoPos(2,O:pos()+vec(0,0,23.5))  
    holoScale(2,vec(4,4,4))
    holoColor(2,vec(255,255,255))
    holoMaterial(2,"models/props_wasteland/wood_fence01a")
    holoParent(2,1)
    holoAlpha(2,255)
    
    if(Timer == 1){
    holoEntity(1):soundPlay(1000,1000,"weapons/c4/c4_disarm.wav")    
    holoEntity(2):soundPlay(2000,2000,"weapons/c4/c4_disarm.wav")    
    }
    
    if(Timer == 5){
    #owner():soundPlay(3000,3000,"music/vlvx_song28.mp3")    
    #owner():soundPlay(4000,4000,"music/vlvx_song28.mp3")   
    }
    
    owner():setColor(255,255,255,0)
    
    }else{
    soundStop(1000)
    soundStop(2000)
    soundStop(3000)
    soundStop(4000)
    holoDelete(1)
    owner():setColor(255,255,255,255)
    Timer = 0
    holoDelete(2)
    }
    
    
    if(duped()){selfDestructAll()}
    if(duped()){selfDestructAll()}
    
    ## Based on Solid Snake <3 ##
    FlashBang (Glichy)

    Code:
    @name FailCake FlashBang
    @outputs A:array Once Flash B:array Start
    @persist Player:entity Timer Click Pla Alpha Start
    @trigger all
    @model models/weapons/w_eq_flashbang.mdl
    
    interval(100)
    E = entity()
    E:setMass(5)
    E:setColor(255,255,255)
    if(first()){
    
    hint("MADE BY [CG]FailCake",100)   
    
        Alpha = 255
        E:removeTrails()
        findByClass("player")
        A=findToArray()
    }
    
    for(I=1,A:count()){
        Player = A[I,entity]
        if(Player:keyUse() & Player:aimEntity()==entity() & Once==0){
    hint("Acti",100)
    Once = 1
    }
    }
    
    if(Once){
    Timer += 0.5
    Click += 0.5
    if(Timer == 1){
    E:soundPlay(4000,4000,"weapons/pinpull.wav")
    E:setTrails(10,10,5,"trails/laser",vec(255,0,0),200)
    }
    if(Click == 3){
    E:soundPlay(1000,1000,"weapons/grenade/tick1.wav")
    }
    
    if(Click >= 4){
    soundStop(1000)
    Click = 0
    }
    if(Timer == 10){
    E:soundPlay(2000,2000,"weapons/flashbang/flashbang_explode1.wav")   
    E:soundPlay(3000,3000,"weapons/flashbang/flashbang_explode2.wav")   
    }
    if(Timer >= 10){
    soundStop(1000)
    Flash = 1
    }
    }
    
    
    if(Flash){
    E:setAlpha(0)
    holoCreate(1)
    holoModel(1,"icosphere3")
    holoAlpha(1,0)
    holoPos(1,E:pos()+vec(0,0,0))
    holoScale(1,vec(-50,-50,-50))
    holoParent(1,E)
    EE=holoEntity(1)
    
    for(I=0,A:count()){
        Player = A[I,entity]
        
        if(
            (Player:pos():distance(EE:pos())<400)
        ){
    
    Start = 1
    }
    }
    }
    
    
    if(Start){
        
    
    for(I=1,A:count()){
        Player = A[I,entity]
    
        
        if(Player:pos():distance(EE:pos())<400)
        {
        if(Alpha > 0) {Alpha-=1}
        if(Alpha <= 0){selfDestructAll()}
        holoCreate(I+1)
        holoParentAttachment(I+1,Player,"anim_attachment_head")
        holoModel(I+1,"hqicosphere")
        holoPos(I+1,Player:pos()+vec(0,0,50))
        holoScale(I+1,vec(-5,-5,-5))
        holoColor(I+1,vec(255,255,255))
        holoAlpha(I+1,Alpha)
        
        }
                       Start = 0 }
    }
    
    if(duped()){selfDestructAll()}
    if(duped()){selfDestructAll()}
    
    ## Press e in it and RUN ##

    Smoke Grenade


    Code:
    @name Failcake Smoke Granade
    @inputs Insta
    @outputs A:array Once StartSmoke
    @persist Player:entity Click Timer SmokeTime SmokeTimer2
    @trigger all
    @model models/weapons/w_eq_smokegrenade.mdl
    
    interval(100)
    E = entity()
    E:setMass(5)
    E:setColor(255,255,255)
    if(first()){
    hint("MADE BY [CG]FailCake",100)
        E:removeTrails()
        findByClass("player")
        A=findToArray()
    }
    
    for(I=0,A:count()){
        Player = findResult(I)
        if(Player:keyUse() & Player:aimEntity()==entity() & Once==0){
    hint("Acti",100)
    Once = 1
    }
    }
    if(Once | Insta == 1){
    Timer += 0.1
    Click += 0.5
    if(Timer == 1){
    E:setTrails(10,10,5,"trails/laser",vec(255,0,0),200)
    }
    if(Click == 2){
    E:soundPlay(1000,1000,"weapons/grenade/tick1.wav")
    }
    
    if(Click >= 4){
    soundStop(1000)
    Click = 0
    }
    
    if(Timer >= 10){
    Smoke = 1
    }
    }
    
    if(Smoke | Insta == 1){
    SmokeTime+= 0.1
    
    R = randint(0,200)
    R2 = randint(0,200)
    R3 = randint(0,200)
    R4 = randint(0,200)
    R5 = randint(0,200)
    R6 = randint(0,200)
    R7 = randint(0,200)
    R8 = randint(0,200)
    R9 = randint(0,200)
    
    if(SmokeTime == 1){
    hint("smoke",100)
    E:soundPlay(2000,2000,"")
    E:applyForce(vec(R,R2,R3))
    StartSmoke = 1
    }else{
    E:applyForce(vec(0,0,0))
    }
    }
    
    if(StartSmoke | Insta == 1){
    SmokeTimer2+=0.1
    holoCreate(1)
    holoModel(1,"cube")
    holoScaleUnits(1,vec(1,1,1))
    holoAlpha(1,0)
    
    holoCreate(2)
    holoModel(2,"cube")
    holoScaleUnits(2,vec(1,1,1))
    holoAlpha(2,0)
    
    holoCreate(3)
    holoModel(3,"cube")
    holoScaleUnits(3,vec(1,1,1))
    holoAlpha(3,0)
    
    if(SmokeTimer2 <= 10 | Insta == 1){
    holoPos(1,E:pos()+vec(R,R2,R3))
    holoPos(2,E:pos()+vec(R4,R5,R6))
    holoPos(3,E:pos()+vec(R7,R8,R9))
    }else{
    E:setMass(100000)
    E:setColor(0,0,0,0)
    soundStop(2000)
    }
    
    Click+=0
    Click = 0
    if(SmokeTimer2 == 1){
    E:soundPlay(2000,2000,"weapons/smokegrenade/sg_explode.wav")
    holoEntity(1):setTrails(699,1,100,"trails/smoke",vec(90,90,90),255)
    holoEntity(2):setTrails(699,1,100,"trails/smoke",vec(50,50,50),255)
    holoEntity(3):setTrails(699,1,100,"trails/smoke",vec(90,90,90),255)
    }
    if(SmokeTimer2 >= 90){
    E:removeTrails()
    soundStop(1000)
    selfDestructAll()
    }
    }
    
    if(duped()){selfDestructAll()}
    if(duped()){selfDestructAll()}
    if(duped()){selfDestructAll()}
    Weapon Scanner

    Code:
    @name FailCake Weapon Scanner
    @inputs Active 
    @outputs Up Stop Active Go Test:string
    @persist Scaner Scan Delete 
    @trigger all 
    
    if(first()){
    Active = 0
    Go = 0
    hint("MADE BY [CG]FailCake",100)
    }
    runOnTick(1)
    E = entity()
    if(Active){
    Delete = 0
    }
    if(Active | Go){
    Go = 1 
    Scaner += 0.1
        
    holoCreate(1)
    holoModel(1,"cube")
    holoPos(1,E:pos()+vec(0,0,0))  
    holoScaleUnits(1,vec(80,80,1))
    holoColor(1,vec(255,1,1))
    holoAlpha(1,50)
    holoParent(1,E)
    
    holoCreate(2)
    holoModel(2,"cube")
    holoPos(2,E:pos()+vec(0,38,0))  
    holoScaleUnits(2,vec(80,1,1))
    holoColor(2,vec(255,1,1))
    holoAlpha(2,150)
    holoParent(2,E)
     
    holoCreate(3)
    holoModel(3,"cube")
    holoPos(3,E:pos()+vec(0,-38,0))  
    holoScaleUnits(3,vec(80,1,1))
    holoColor(3,vec(255,1,1))
    holoAlpha(3,150)
    holoParent(3,E)
    
    holoCreate(4)
    holoModel(4,"cube")
    holoPos(4,E:pos()+vec(38,0,0))  
    holoScaleUnits(4,vec(1,80,1))
    holoColor(4,vec(255,1,1))
    holoAlpha(4,150)
    holoParent(4,E)
    
    holoCreate(5)
    holoModel(5,"cube")
    holoPos(5,E:pos()+vec(-38,0,0))  
    holoScaleUnits(5,vec(1,80,1))
    holoColor(5,vec(255,1,1))
    holoAlpha(5,150)
    holoParent(5,E)
    
    if(Scaner == 1){
    Test = "Scanning! Dont Move!"
    holoEntity(1):soundPlay(100,100,"weapons/physcannon/superphys_chargeup.wav")   
    }
    
    if(Scaner == 10){
    holoEntity(1):soundPlay(100,100,"weapons/physcannon/superphys_hold_loop.wav")    
    }
    
    if(Scaner >= 10){
        
    if(Scan <= 0 & !Stop) {Up = 1 Stop = 1} elseif (Scan <= 0 & Stop) {Scan = Scan}
    if(Scan >= 80) {Up = 0}    
    if(Up) {Scan+=0.5} else {Scan-=0.5}
    
    holoPos(1,E:pos()+vec(0,0,Scan))  
    holoPos(2,E:pos()+vec(0,38,Scan))  
    holoPos(3,E:pos()+vec(0,-38,Scan))  
    holoPos(4,E:pos()+vec(38,0,Scan))  
    holoPos(5,E:pos()+vec(-38,0,Scan))   
    
    findIncludeClass("player")
    #findExcludePlayer(owner())
    
    Fsphere = findInSphere(entity():pos(), 60)
    Player = findClosest(entity():pos())
    
    
    if(Fsphere >= 2){
    soundStop(100)
    soundStop(200)
    soundStop(230)
    soundStop(250)
    Test = "ERROR! 1 Player at Time"
    hint("ERROR! 1 Player at Time",100)
    Active = 0
    Go = 0   
    }
    
    
    if(Scan <= 0){
    soundStop(100) 
    
    if(Player:weapon():type()=="weapon_physgun"|Player:weapon():type()=="weapon_physcannon"|Player:weapon():type()=="gmod_camera"|Player:weapon():type()=="gmod_tool"){
    
    holoEntity(1):soundPlay(200,200,"buttons/bell1.wav")   
    hint("Aproved",100)
    Test = "Aproved"
    holoColor(1,vec(1,255,1))
    holoColor(2,vec(1,255,1))
    holoColor(3,vec(1,255,1))
    holoColor(4,vec(1,255,1))
    holoColor(5,vec(1,255,1))
    hint("Weapon = "+Player:weapon():type(),100)
    Active = 0
    Go = 0
    }else{
    
    
    if(Player:weapon():type()==""){
    holoEntity(1):soundPlay(250,250,"buttons/combine_button7.wav")
    hint("NO PLAYER",100)  
    Test = "NO PLAYER IN SCANNER"
    holoColor(1,vec(1,1,1))
    holoColor(2,vec(1,1,1))
    holoColor(3,vec(1,1,1))
    holoColor(4,vec(1,1,1))
    holoColor(5,vec(1,1,1))
    Active = 0
    Go = 0 
    }else{
    
    holoEntity(1):soundPlay(230,230,"buttons/button8.wav")
    hint("Denied",100)
    Test = "Denied"
    holoColor(1,vec(150,1,1))
    holoColor(2,vec(150,1,1))
    holoColor(3,vec(150,1,1))
    holoColor(4,vec(150,1,1))
    holoColor(5,vec(150,1,1))
    hint("Weapon = "+Player:weapon():type(),100)
    Active = 0
    Go = 0
    }
    }
    } 
    
    }
    
    }else{
    Delete += 0.1
    if(Delete >= 7){
    Scan = 0
    Stop = 0
    Scaner = 0
    Go = 0
    Test = " "
    soundStop(100)
    soundStop(200)
    soundStop(230)
    soundStop(250)
    holoDelete(1)
    holoDelete(2)
    holoDelete(3)
    holoDelete(4)
    holoDelete(5)
    holoDelete(6)
    }
    }
    if(duped()){selfDestructAll()}
    if(duped()){selfDestructAll()}

    Last edited by failcake; 07-03-2010 at 10:26 AM.

  2. #2
    billywitchdoctor.com Whosdr's Avatar
    Join Date
    Dec 2008
    Posts
    2,300

    Default Re: [E2]FlashBang,Smoke Grenade and Hide Box

    I've not tried them out, but they do need a bit of work.
    Persist O and E as entities, and define them under a first() statement. Put runOnTick(1) under there too.
    Holograms only need to be created once. Any changing values should stay outside, static inside the first().
    .siht daer ot gniyrt emit detsaw ev'uoY

  3. #3
    Wirererer failcake's Avatar
    Join Date
    Jul 2009
    Location
    In Aperture Science Laboratories
    Posts
    298

    Default Re: [E2]FlashBang,Smoke Grenade and Hide Box

    Quote Originally Posted by Whosdr View Post
    I've not tried them out, but they do need a bit of work.
    Persist O and E as entities, and define them under a first() statement. Put runOnTick(1) under there too.
    Holograms only need to be created once. Any changing values should stay outside, static inside the first().
    K , im also uploading video now

  4. #4
    Wirererer failcake's Avatar
    Join Date
    Jul 2009
    Location
    In Aperture Science Laboratories
    Posts
    298

    Default Re: [E2]FlashBang,Smoke Grenade and Hide Box

    Added Video

  5. #5
    Wire Sofaking nescalona's Avatar
    Join Date
    Apr 2007
    Location
    Shoreline, Washington
    Posts
    1,299

    Default Re: [E2]FlashBang,Smoke Grenade and Hide Box

    Don't use a variable for owner(), just use "owner()" everywhere. It's cheaper ops-wise to do that for entity() and owner() (but not other entities in general.)

  6. #6
    Wiremod Helper Donkie's Avatar
    Join Date
    May 2008
    Location
    Sweden
    Posts
    1,661

    Default Re: [E2]FlashBang,Smoke Grenade and Hide Box

    I have always wondered if positions and stuff will update if you only define the entity at first(), or is the variable just a point-er?
    Get out. Seriously, do it.

  7. #7
    Wirererer Evac's Avatar
    Join Date
    Apr 2010
    Posts
    147

    Default Re: [E2]FlashBang,Smoke Grenade and Hide Box

    Quote Originally Posted by Donkie View Post
    I have always wondered if positions and stuff will update if you only define the entity at first(), or is the variable just a point-er?
    An entity doesn't change when defined in the first cycle, when you call
    Code:
    E:pos()
    E:angles()
    etc... the engine looks for E and takes the data from that entity.
    AKA, yes it will update.

  8. #8
    Wirererer TGifallen's Avatar
    Join Date
    Feb 2010
    Posts
    141

    Default Re: [E2]FlashBang,Smoke Grenade and Hide Box

    Quote Originally Posted by nescalona View Post
    Don't use a variable for owner(), just use "owner()" everywhere. It's cheaper ops-wise to do that for entity() and owner() (but not other entities in general.)
    what are you talking about kid? put it in an if (first())

  9. #9
    aka Colonel Never Online Colonel Thirty Two's Avatar
    Join Date
    Oct 2009
    Posts
    2,683
    Blog Entries
    5

    Default Re: [E2]FlashBang,Smoke Grenade and Hide Box

    Quote Originally Posted by nescalona View Post
    Don't use a variable for owner(), just use "owner()" everywhere. It's cheaper ops-wise to do that for entity() and owner() (but not other entities in general.)
    Umm, how? Referencing a variable is only 1 op I believe; heck could even be 0. Plus it looks uglier.

  10. #10
    Wire Sofaking nescalona's Avatar
    Join Date
    Apr 2007
    Location
    Shoreline, Washington
    Posts
    1,299

    Default Re: [E2]FlashBang,Smoke Grenade and Hide Box

    Quote Originally Posted by initrd.gz View Post
    Umm, how? Referencing a variable is only 1 op I believe; heck could even be 0. Plus it looks uglier.
    Uhh, I'm pretty sure Syranide said that at some point. Last year. Maybe it wasn't ops, but actual lag time in the Lua.

    If I'm wrong then yeah, you'd want to declare the variable in if (first()) {} and persist it.

+ Reply to Thread
Page 1 of 2 12 LastLast

Tags for this Thread

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