Blockland Forums > Modification Help

Getting the vehicle from it's spawn

Pages: (1/3) > >>

Snaily:

Everything's working now. Thanks peeps.




(Note: I am aware that there was a similar topic made back in 2009. However this is still a problem)


Title says it all. I can't find a way to get the vehicle that a vehicle spawn brick owns.

Now, before you say

--- Quote from: Space Guy ---%brick.vehicle
%brick.vehicleDatablock

--- End quote ---

Doing that returns an empty string, both in the console (%brick being replaced with the spawn bricks' id) and in code. Same with

--- Code: ---%brick.getDatablock().vehicle
%brick.getDatablock().vehicleDatablock

--- End code ---

Here's part of the script, where %brick = a fxDTSBrick.

--- Code: ---echo(%brick.getId()); //Returns the spawn bricks' id
echo(%brick.getClassName());   //Returns fxDTSBrick
echo(%brick.vehicle); //Returns an empty string
echo(%brick.vehicleDatablock);       //Returns an empty string

--- End code ---




If it helps, the code 'seemed' to work after about 20 minutes in single player, and '%brick.vehicle' accurately returned the vehicle's id. I would rather not wait 20 minutes and hope that this code works though...


Any ideas to what's going on?

MegaScientifical:

%brick.vehicle

Make sure the vehicle is spawned first.

%vehicle.spawnBrick

Snaily:


--- Quote from: MegaScientifical on August 02, 2010, 10:45:32 AM ---%brick.vehicle

--- End quote ---


Very funny.



--- Quote from: MegaScientifical on August 02, 2010, 10:45:32 AM ---Make sure the vehicle is spawned first.

%vehicle.spawnBrick

--- End quote ---

The vehicle is spawned. I don't need to get the spawn brick from the vehicle (although %vehicle.spawnBrick returns an empty string too).

MegaScientifical:

Ya, I barely ready your post, didn't notice you mentioned it already.

Space Guy:

Setting %brick in the console will most likely have its value erased if you try "%brick = 27801;" "echo(%brick.vehicle);".

Pages: (1/3) > >>

Go to full version