Driveable train

I am trying to make a func_physbox, basicly a train driveable.

This is what i’ve tried to do:

I made a prop_vehicle_prisoner_pod. This an output on it:

Output: PressedAttack
Target: math_counter
Input: Add
Parameter override: 50

I attempted to add a value of +50 to the math_counter every time i click on the left mouse button.

This is what the math_counter does:

Output: Outvalue
Target: phys_thruster
Input: Scale

It sets the scale value of the thrusters. In this case, it is suposed to increase by 50 every time i click.

I have tested the math_counter, it works. I did ent_fire math_counter add 50, and the thrusters did their job properly. Just the connection between the pod and the math_counter doesnt work. Could somebody help with this?

Thanks in advance!

Never mind, i figured out. I added a game_ui, forgot about that. x)

New issue,

i am trying to make the whole train spawnable. I am doing this via a point_template.
The whole things spawns ingame, but the prisoner pod is acting strange. It is suposed to be attached on the train with a phys_constraint. But instead, it is hanging unmoveable in the air, and doesnt funtion properly.It also collides with the train itself, altough i set the phys_constraint flag to nocollide untill break. What is goining on here?

Why don’t you just parent it to the train?

That doesnt work for some reason. In a tutorial i’ve read for clues, it clearly said you need to parent AND phys_constrain it. If you dont, it wont move properly along with the rest.

The constraint is nocollided, the pod isn’t.

Which means the pod is constrained AND no collided to the train.

The train works fine, untill i am spawning it with a point_template. Then it starts to mess up.

I have checked everything. All entities are in the templates.

[editline]12:09AM[/editline]

Terrenteller should know this :stuck_out_tongue:

Try unchecking the flag “Preserve entity names (Don’t do name fixup)”.

Already did, first thing i checked :frowning:

func_tanktrain with lots of buttons and tracks…

Only if you did it right, otherwise only the constraint is nocollided.

Also why the fuck are you spawning it, why not leave it as it is to start off?

I DID it right. It works when leave it as it starts off.

It is spawnable so players can create multiple trains.

Why not parent it?

There is your problem.

Spawning multiple copies will have the same name and fuck it up.

No, I’m pretty sure there was a way around that.

All names are made unique upon spawn. It also adjusts the parent names, and input/outputs.