Blockland Forums > Modification Help

How to setup nodes on a vehicle and hide/unhide them via script?

Pages: (1/2) > >>

Nasoa:

I'd like some variations for a vehicle I'm making, and I've heard of people using the same model with different nodes showing to make a police car, different cargo, etc. How do I set up a node and hide/unhide it for each one on?

Slicksilver:

I believe what people actually do is animate the vehicle and play the correct animation to hide/show each thing. If you're only going to be having one 'node' visible at a time, you can use the following to play an animation:

%vehicle.playThread(0,"animationName");

I can't really help you with animating though, but I can tell you it needs a "root" animation for the default vehicle.

Racer:

%obj.hideNode(nodename);
%obj.unhideNode(nodename);

Barnabas:


--- Quote from: Slicksilver on February 24, 2012, 02:25:20 AM ---I believe what people actually do is animate the vehicle and play the correct animation to hide/show each thing. If you're only going to be having one 'node' visible at a time, you can use the following to play an animation:

%vehicle.playThread(0,"animationName");

I can't really help you with animating though, but I can tell you it needs a "root" animation for the default vehicle.

--- End quote ---

Don't listen to him.


--- Quote from: Racer on February 24, 2012, 05:18:50 PM ---%obj.hideNode(nodename);
%obj.unhideNode(nodename);

--- End quote ---

This man is right.

Also, for an example here's a part of the Blocko Sedan script:


--- Code: ---function BlockoSedanVehicle::onAdd(%db,%this)
{
%this.hideNode(taxiacc);
%this.hideNode(policeacc);

parent::onAdd(%db,%this);
}
--- End code ---

What this part does is the following: when the car is added it hides the taxi accessory node (taxiacc) and the police accessory node (policeacc). Had it not been for these scripts, the regular sedan would spawn with having both of those accessories visible.

For the taxi and the police version only one of the nodes are hidden, and the other one is unhidden.

Nasoa:

Thanks a bunch, this will be really helpful.

Pages: (1/2) > >>

Go to full version