+ Reply to Thread
Results 1 to 5 of 5

Thread: Adv-Hologram Application

  1. #1
    Wire Amateur Zeroedge9's Avatar
    Join Date
    Jul 2009
    Location
    Florida
    Posts
    94

    Post Adv-Hologram Application

    This tutorial builds upon my previous tutorial on basic holograms, it's also oriented towards applying them to some common use and including some examples.


    Alright, Lets begin.
    Code:
    @name Zero's Holo Hud
    runOnTick(1)
    E=entity()
    O=owner()
    
    if(first())
    {
        Radius=300
        holoCreate(20)
        holoModel(20,"hqcylinder")
        holoScale(20,vec(0.25,0.25,1))
        holoCreate(21)
        holoModel(21,"hqcylinder")
        holoScale(21,vec(0.25,0.25,0.5))
        holoCreate(22)
        holoModel(22,"hqcylinder")
        holoScale(22,vec(0.25,0.25,0.5))
        holoCreate(23)
        holoModel(23,"hqcylinder")
        holoScale(23,vec(0.05,0.05,0.1))
        holoCreate(24)
        holoModel(24,"hqcylinder")
        holoScale(24,vec(0.05,0.05,0.1))
        holoCreate(25)
        holoModel(25,"hqtorus")
        holoScale(25,vec(0.1,0.1,0.1))
    }
    #Defines if Grav Gun can grab
    if(O:aimEntity()&O:aimEntity():mass()<250&!O:aimEntity():isFrozen())
    {
        C1=vec(155,0,0)
        if(O:aimEntity():isPlayer()|O:aimEntity():isNPC())
        {
            CX=vec(155,0,0)
            C1=vec(0,155,0)
        }        
    }
    else{C1=vec(0,155,0)}
    #Health meter logic
    T=O:shootPos()+O:eye()*8
    Hp=O:health()*2.55
    HpE=O:aimEntity():health()*2.55
    C2=vec(255-HpE,HpE,0)
    C3=vec(255-Hp,Hp,0)
    
    #Grav gun bar
    holoPos(20,T+O:up()*3)
    holoAng(20,angnorm(O:eye():toAngle())+ang(0,0,90))
    holoColor(20,C1,160)
    
    #Owner HP
    holoPos(21,T+O:right()*5)
    holoAng(21,angnorm(O:eye():toAngle()))
    holoColor(21,C3,240)
    
    #Enemy HP
    holoPos(22,T+O:right()*-5)
    holoAng(22,angnorm(O:eye():toAngle()))
    holoColor(22,C2,HpE)
    
    #Crosshair 1
    holoPos(23,T)
    holoAng(23,angnorm(O:eye():toAngle())+ang(0,0,90))
    holoColor(23,vec(0,0,255),200)
    
    #Crosshair 2
    holoPos(24,T)
    holoAng(24,angnorm(O:eye():toAngle()))
    holoColor(24,vec(0,0,255),200)
    
    #Locked on Ring
    holoPos(25,T)
    holoAng(25,angnorm(O:eye():toAngle())+ang(90,0,0))
    holoColor(25,CX,HpE)
    
    #Comment all this if in public server. The E2 will shutdown from ops overload otherwise
    #This section will place a holo around props within a certain radius of it.
    findByClass("prop_physics")
    findExcludeEntity(O)
    R=findToArray()
    for(I=1,R:count()) 
    {
        if(O:pos():distance(R[I,entity]:pos())<Radius)
        {
            holoCreate(I)
            holoParent(I,R[I,entity])
        }
        else{holoDelete(I)}
        holoPos(I,R[I,entity]:pos())
        holoScaleUnits(I,R[I,entity]:boxSize())
        holoAng(I,R[I,entity]:angles())
        holoColor(I,vec(0,0,155),190)
    }

    There's a reason my holos start off at 20+. The loops creates all the holos below 20.

    I'm going to go over all the technical parts of this holo and im going to assume my old tutorial was read.
    Code:
    #Defines if Grav Gun can grab
    if(O:aimEntity()&O:aimEntity():mass()<250&!O:aimEntity():isFrozen())
    {
        C1=vec(155,0,0)
        if(O:aimEntity():isPlayer()|O:aimEntity():isNPC())
        {
            CX=vec(155,0,0)
            C1=vec(0,155,0)
        }        
    }
    else{C1=vec(0,155,0)}
    This code basically says. If i look at a prop that the grav gun can grab(not 250g+ or frozen), turn the indicator holo red. If i look at a Person or an NPC make the target ring red and leave the indicator holo green.

    Code:
    #Health meter logic
    T=O:shootPos()+O:eye()*8
    Hp=O:health()*2.55
    HpE=O:aimEntity():health()*2.55
    C2=vec(255-HpE,HpE,0)
    C3=vec(255-Hp,Hp,0)
    This portion of the code will show the owner's Hp through a color coded bar as well as any players/npc's you look at.

    Code:
    holoAng(index,angnorm(O:eye():toAngle()))
    This line is very important. it is how the hologram keeps its angle oriented in the same direction when you look aroound.

    Code:
    #Comment all this if in public server. The E2 will shutdown from ops overload otherwise
    #This section will place a holo around props within a certain radius of it.
    findByClass("prop_physics")
    findExcludeEntity(O)
    R=findToArray()
    for(I=1,R:count()) 
    {
        I=clamp(I,0,19)
        if(O:pos():distance(R[I,entity]:pos())<Radius)
        {
            holoCreate(I)
            holoParent(I,R[I,entity])
        }
        else{holoDelete(I)}
        holoPos(I,R[I,entity]:pos())
        holoScaleUnits(I,R[I,entity]:boxSize())
        holoAng(I,R[I,entity]:angles())
        holoColor(I,vec(0,0,155),190)
    }
    This is an unoptimized for loop i made for the fun of it. The concept of this is to create holograms around the props nearby and just have some fun with it. Since i didnt have the time to fully optimize the code 100% the chip will shutdown if too many props are spawned. to solve the shutdown comment everything below the warning i gave.

    If anyone needs clarifications let me know and i will try and help. Also throw out some requests and i will try to see if i can help with it.

    if you liked it too =D

    Gimp > Photoshop

  2. #2
    Wire Sofaking Unsmart's Avatar
    Join Date
    Dec 2008
    Location
    Belgium OR BANland
    Posts
    1,965

    Default Re: Adv-Hologram Application

    Have you even checked if your code works? you dint persist radius, so I assume it will fail. I don't get what your trying to do/make/explain i this tut.
    New server IP: 89.238.160.17:27018
    Hologram contraptions 1 Holo contraptions 2 EGP stuff Holo minigun Holo javelin rocket launcher
    Unsmart: I doubt the intelligence of some people.
    Drunkie: Nobody could have said that any better than Unsmart.

    Unsmart: Solece, I totally did your mom yesterday
    Solece: Who hasnt

    Divran: there are more retarded people than there are clever people in this world

  3. #3
    Wire Amateur Zeroedge9's Avatar
    Join Date
    Jul 2009
    Location
    Florida
    Posts
    94

    Default Re: Adv-Hologram Application

    Yea it works. i test it by placing props in a line and standing at the end of that line. only the ones in range were selected (though it'd be nice if findInSphere() worked)
    Last edited by Zeroedge9; 12-13-2009 at 09:43 AM.

    Gimp > Photoshop

  4. #4
    Wire Sofaking smellslike's Avatar
    Join Date
    May 2009
    Location
    in a lonley world
    Posts
    412

    Default Re: Adv-Hologram Application

    pretty nice tutorial, really builds from your last one. Needed a few more explanations though, i wouldn't have understood if i didnt know this already.
    Working on military pack.
    Remember
    amateurs build the ark....
    Professionals build the titanic

  5. #5
    Wire Amateur Zeroedge9's Avatar
    Join Date
    Jul 2009
    Location
    Florida
    Posts
    94

    Default Re: Adv-Hologram Application

    Can you give me examples on what i should clarify?

    Gimp > Photoshop

+ Reply to Thread

Similar Threads

  1. Hologram Jet
    By abysal in forum Finished contraptions
    Replies: 23
    Last Post: 01-16-2010, 04:32 AM
  2. Hologram help
    By AutomatedOwner in forum Wiremod General Chat
    Replies: 4
    Last Post: 09-18-2009, 05:33 PM
  3. Replies: 0
    Last Post: 09-06-2009, 08:30 PM
  4. Target Finder Application or E2?
    By CrasySkillz in forum Installation and Malfunctions Support
    Replies: 3
    Last Post: 02-05-2009, 07:12 AM
  5. 3ds max texture application help
    By undead82004 in forum Off-Topic
    Replies: 2
    Last Post: 10-20-2007, 07:40 AM

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