+ Reply to Thread
Results 1 to 6 of 6

Thread: applyForce in vehichle?

  1. #1
    Wire Noob Masterlight's Avatar
    Join Date
    Aug 2009
    Posts
    5

    Default applyForce in vehichle?

    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.

  2. #2
    Wire Noob rasso's Avatar
    Join Date
    Jul 2010
    Location
    Russia
    Posts
    28

    Default Re: applyForce in vehichle?

    I think if you need to check the vehicle's driver, you should do:

    Code:
    @persist Vehicle:entity Driver:entity
    
    Driver=Vehicle:driver()
    Along these lines
    Ha-ha-ha!
    - a villain.

  3. #3
    Wiremode Helper Techni's Avatar
    Join Date
    Jul 2008
    Posts
    791
    Blog Entries
    1

    Default Re: applyForce in vehichle?

    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(1vec(1.5,1.5,2))

        
    holoCreate(2)
        
    holoModel(2"sphere")
        
    holoScale(2vec(1.4,1.4,1.4))



  4. #4
    E2 Addict miojox's Avatar
    Join Date
    Dec 2011
    Location
    São Paulo - SP - Brazil
    Posts
    135

    Default Re: applyForce in vehichle?

    Quote Originally Posted by Masterlight View Post
    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)
    
    applyForce($Vector*10+Vector)
    This is to apply force to your E2 chip?
    Quote Originally Posted by God View Post
    That's my boy.

  5. #5
    Wirererer xanaboy's Avatar
    Join Date
    Dec 2010
    Location
    This forum page.
    Posts
    136

    Default Re: applyForce in vehichle?

    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

  6. #6
    Wirererer Snowden42's Avatar
    Join Date
    May 2009
    Posts
    248

    Default Re: applyForce in vehichle?

    Quote Originally Posted by rasso View Post
    I think if you need to check the vehicle's driver, you should do:

    Code:
    @persist Vehicle:entity Driver:entity
    Driver=Vehicle:driver()
    Along these lines
    You only need to persist variables when they are within conditionals, because they are local. Persisting variables makes them global variables.

    PHP Code:
    holoPos(1,Currentpos+vec(0,0,0))
    holoPos(2,Currentpos+vec(0,0,0)) 
    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.
    Quote Originally Posted by Echo51 View Post
    Told many people that myself, I feel nooblishious

+ Reply to 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