Team Spartan Cookies & Milk Forums
vehicle's driver - Printable Version

+- Team Spartan Cookies & Milk Forums (https://teamscm.co.uk)
+-- Forum: Garry's Mod (https://teamscm.co.uk/forum-4.html)
+--- Forum: Expression 2 (https://teamscm.co.uk/forum-6.html)
+--- Thread: vehicle's driver (/thread-2443.html)



vehicle's driver - CogHead - 01-09-2017

Ok, so couldn't find anything with a quick search, so I have a question.

I'm trying to take the vehicle's driver, and use it for my chip. (taking it's screen parameters, checking for keypresses for controlling a menu)
My problem is, I can't seem to find a way to actually link the chip to the vehicle. (I don't want to weld it, becouse i want to keep every prop off the ship, that's not necessary for it being there)

I tried creating an entity link directly with the vehicle, or wiring it to the pod controller.
Right now, I just want to get the hud working for any driver. it works fine if I just use owner().
Code:
if(first() | changed(EGP)) {
    Driver=Chair:driver()
        
    W = egpScrW(Driver)
    H = egpScrH(Driver)
    .
    . (bla-bla-bla)
    .
    EGP:egpPos(99,vec2(W/100*50,H/100*80))
}



RE: vehicle's driver - Knight - 01-09-2017

Curious if linking a pod controller to the vehicle seat and then linking the chip to that pod controller to output the driver could be a solution? This is just speculation, you can try it in game and see if that solves the problem.


RE: vehicle's driver - CogHead - 02-09-2017

After quite a bit of struggle, I believe I managed to solve my issue.
It seems the promblem lay in in the fact, that I took said vehecle's driver before anyone was sitting in it, and never updated that part. Since I couldn't quickly think of a way to update just that part of the code, I believe I managed to update it whenever the Pod changes state.
Code:
if(changed(Pod["Active",normal])) {reset()}
Although this seems obvious now, I'll leave this post here in case someone else is as shortsighted as I am.
I'm not sure I implemented the changed() function correctly, or that it does what I think it should, but the chip seems to work right now.