I think if you need to check the vehicle's driver, you should do:
Along these linesCode:@persist Vehicle:entity Driver:entity Driver=Vehicle:driver()
Okay so I wanted to make my e2 applyForce only when I am in a vehichle or whoever is in it and I'm lost. So far I only have this, but it only apply forces for me and doesn
Code:@name Holo Vector @persist Vector:vector runOnTick(1) Targetpos = owner():aimPos() Currentpos = entity():pos() Vector = Targetpos - Currentpos applyForce($Vector*10+Vector) interval(10) Me=owner() Chip=entity() if(first()) {holoCreate(1)} holoModel(1, "hqtorus") holoPos(1,Chip:pos()+vec(0,0,0)) holoAng(1,ang(0,0,0)) holoScale(1, vec(1.5,1.5,2)) holoCreate(2) holoModel(2, "sphere") holoPos(2,Chip:pos()+vec(0,0,0)) holoScale(2, vec(1.4,1.4,1.4))
Last edited by Masterlight; 3 Weeks Ago at 12:56 AM.
I think if you need to check the vehicle's driver, you should do:
Along these linesCode:@persist Vehicle:entity Driver:entity Driver=Vehicle:driver()
Ha-ha-ha!
- a villain.
Fixed up your E2 for you, optimization is very important in E2, especially when dealing with holograms.
PHP Code:@name Holo Vector
@persist Vector:vector [Chip Me]:entity
Targetpos = Me:aimPos()
Currentpos = Chip:pos()
Vector = Targetpos - Currentpos
applyForce($Vector*10+Vector)
holoPos(1,Currentpos+vec(0,0,0))
holoPos(2,Currentpos+vec(0,0,0))
if(first()) {
runOnTick(1)
Chip = entity()
Me = owner()
holoCreate(1)
holoModel(1, "hqtorus")
holoAng(1,ang(0,0,0))
holoScale(1, vec(1.5,1.5,2))
holoCreate(2)
holoModel(2, "sphere")
holoScale(2, vec(1.4,1.4,1.4))
}
A_Prop_That_Will_Be_Forced:applyForce($Vector*10+V ector) <--- I don't know why there is a space there...
If you put nothing there by default it is entity():applyForce(V)
If at first you don't succeed... Call it version 1.0
You only need to persist variables when they are within conditionals, because they are local. Persisting variables makes them global variables.
Why are you adding empty vectors? They are entirely unnecessary, as they will not change Currentpos at all. Simply use Currentpos. Also, like Xanaboy said, you need to applyForce to an entity. If you want to apply it to the chip, use entity():applyForce(). I believe you can applyForce to holos, although I haven't tried yet. Make sure you parent all of the to a single hologram and applyForce to that holo only, though. You can try holoEntity():applyForce(). Otherwise, use holoPos() and adjust position that way.PHP Code:holoPos(1,Currentpos+vec(0,0,0))
holoPos(2,Currentpos+vec(0,0,0))
Bookmarks