# Expression 2: holo help!!

Hey! i’m a little experienced E2 holo coder,
I need some help with it though.
How do I make my holo aim at a entity like a laser, and the longer distance the longer scale.

Just that the laser the stickman shoots need to aim at a specific entity all the time, Thanks.

Scale is the distance in Z, and you place the hologram directly between the two. Finally, angle to (TarPos-CurPos):toAngle()

Like (holoEntity(1):pos()-holoEntity(2):pos):toAngle()

Indeed,except you forgot a (). Of course it is just a syntax error.

Ok thanks alot mate :))))) but one thing, when i do it i use a cylinder but its the wrong side thats facing to the other entity.
I need the top to aim, not the side :S

+ang(90,0,0)

Thanks alot mates
but the position of the laser?
i cant quite figure that out, little help

Ranger from the position in a direction.
rangerOffset(Position,Direction):position()

Dang, it isent working properly.
@persist Hpos:vector
Hpos=rangerOffset(HaN11:pos(),HaN2:pos()):position()
holoPos(11,Hpos)

HaN11 is holoEntity(11)
HaN2 is holoEntity(2)

Direction, not position. In this case, the (holoEntity(1):pos()-holoEntity(2):pos()) without the toAngle().

rangerOffset(***,holoEntity(1):pos()-holoEntity(2):pos()) no such function rangerOffset(normal,ranger)

[editline]11:47AM[/editline]

im completely lost :S, direction?

``````
R = rangerOffset(99999999, GunPos, owner():eye()) #Create a ranger starting at GunPos, going in the direction owner():eye() (where you are aiming) and make it 99999999 long
MidPos = (GunPos+R:position())/2 #Calculate the middle position
Distance = R:distance() #Get the distance
Angle = owner():eyeAngles() + ang(90,0,0) #Calculate the angle

#Move hologram:
holoPos(1,MidPos)
holoAng(1,Angle)
holoScale(1,vec(2,2,Distance))

``````

thanks alot mates
ok it looks good now its just that… the laser is too far down and haves a strange position sometimes
remember mate i dont use owner():eye or anything with owner i only use holos

this has become very annoying. it seems no matter what i do it just wont set the position, if i do as you told me divran

Ra = rangerOffset(9999999, holoEntity(0):pos(), holoEntity(11):eye())
MidPos = (holoEntity(0):pos()+Ra:position())

the position just gets a very strange position i cant change. :SS

(Pst. Devide it by 2)
MidPos = (holoEntity(0):pos()+Ra:position())/2

i also did it just forgot to write sorry.
its very annoying

its pretty long, not finished (PLEASE, dont steal this)

``````
removed.

``````

[noparse]

``````
Insert code here:

``````

[/noparse]

Your code is VERY messy. For example

``````
if (first()){
holoCreate(2)
holoCreate(3)
holoCreate(4)
holoCreate(5)
holoCreate(6)
holoCreate(7)
holoModel(2,"hqicosphere2")
holoModel(3,"hqicosphere2")
holoModel(4,"hqicosphere2")
holoModel(5,"hqicosphere2")
holoModel(6,"hqicosphere2")
holoModel(7,"hqicosphere2")
holoScale(2,vec(2,2.4,2.2))
holoScale(3,vec(2,2.4,2.2))
holoScale(4,vec(2,2.4,2.2))
holoScale(5,vec(2,2.4,2.2))
holoScale(6,vec(2,2.4,2.2))
holoScale(7,vec(2,2.4,2.2))
holoMaterial(2,"models/props_wasteland/dirtwall001a")
holoMaterial(3,"models/props_wasteland/dirtwall001a")
holoMaterial(4,"models/props_wasteland/dirtwall001a")
holoMaterial(5,"models/props_wasteland/dirtwall001a")
holoMaterial(6,"models/props_wasteland/dirtwall001a")
holoMaterial(7,"models/props_wasteland/dirtwall001a")
holoPos(2,entity():pos()+vec(random(-255,255),random(-255,255),random(50,255)))
holoPos(3,holoEntity(2):pos()+vec(random(-150,50),random(-150,50),(random(20,50))))
holoPos(4,holoEntity(2):pos()+vec(random(-150,50),random(-150,50),(random(20,50))))
holoPos(5,holoEntity(2):pos()+vec(random(-150,50),random(-150,50),(random(20,50))))
holoPos(6,holoEntity(2):pos()+vec(random(-150,50),random(-150,50),(random(20,50))))
holoPos(7,holoEntity(2):pos()+vec(random(-150,50),random(-150,50),(random(20,50))))}

``````

All of that can be replaced by

``````
if (first()) {
for(I=2,7) {
holoCreate(I)
holoModel(I,"hqicosphere2")
holoScale(I,vec(2,2.4,2.2))
holoMaterial(I,"models/props_wasteland/dirtwall001a")
holoPos(I,entity():pos()+randvec(-255,255))
}
}

``````

And that’s just 1 example.

Anyway, to fix your beam, try this:

``````
### Miner POS
MidPos = (holoEntity(0):pos()+holoEntity(2):pos())/2
DistM = holoEntity(2):pos():distance(holoEntity(0):pos())/18
Dist = holoEntity(2):pos():distance(holoEntity(0):pos())

``````