Post: [HELP] Zombies - Player command controlled vehicle?
07-21-2016, 02:30 PM #1
(adsbygoogle = window.adsbygoogle || []).push({}); Hello, I've been struggling for very long with this and I'd thought it's time to get some help! Smile

So Im trying to make "The Bus" from Tranzit driveable via the player.

I started off with a custom vector scale.

    vector_scal(vec, scale)
{
vec = (vec[0] * scale, vec[1] * scale, vec[2] * scale);
return vec;
}


I also made a BulletTrace for this and a custom AnglesToForward for the player.

    playerAnglesToForward(player, distance)
{
return player.origin + VectorScale(AnglesToForward(player getPlayerAngles(), distance));
}


    forward = self getTagOrigin("tag_eye");
end = self thread vector_scal(anglestoforward(self getPlayerAngles()),1000000);
location = BulletTrace( forward, end, 0, 0)[ "position" ];

I did use SetVehGoalPos which did move the bus accordingly to my aim so it did feel like I was controlling it. The problem is that it didn't move very realistic like the bus should move and more importantly, it didnt follow roads or anything I went in a straightline going through everything that was in a different level than the bus.

My theory is that since the bus moves around the map by using "nodes" or script_noteworthy as they are called in Radiant. So to move it I must make it move accordingly to nodes, but the player must be able to controll the bus freely and for that my test would be this.

create a custom spawned script_noteworthy

    buscnode = spawn( "script_noteworthy", self.origin );


Tell the node to teleport to the BulletTrace location everytime I press attack button while driving.

    if(self attackButtonPressed())
{
forward = self getTagOrigin("tag_eye");
end = self thread vector_scal(anglestoforward(self getPlayerAngles()),1000000);
location = BulletTrace( forward, end, 0, 0)[ "position" ];

buscnode.origin = self.origin;

}


And now call the bus and connect and attach the path to your node.

    pathstart = self.attachedpath;
self.currentnode = self.attachedpath;
self attachpath( pathstart );
self startpath();


My test didn't turn up successful unfortunately :/

Questions are now from me:

1. Would my theroy have worked, but I did something wrong in the process?
2. If not or if theres and easier way, what would that be?

Thanx! Happy <3

EDIT: Basically I need a way to move a ground vehicle normally without using nodes if possible. :P
(adsbygoogle = window.adsbygoogle || []).push({});

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo