Author Topic: Spawn vehicle without using a spawner  (Read 1454 times)

Instead of spawning a vehicle with its specialized brick, is there a way to use events to make any brick capable of spawning a vehicle
(and also have it not tied to the brick, so if your vehicle is destroyed, it doesn't respawn?)

Or, of course, could someone make an addon that lets you do that?

I remember there was an addon that added a command to summon a personal vehicle
can't find it in my addons though

I think it either took the player's paint can color, or was recolorable by painting it
and it didn't block the trans part of paints, so you could use it to see through bricks

(it may help to look at that addon's code, if anybody has it)

I remember there was an addon that added a command to summon a personal vehicle
can't find it in my addons though
do you mean the vehicle air drop? where it was an item you used and it would drop one in from a jet?
from what I can tell it plants a vehicle spawn brick which spawns the vehicle you ask it to

edit: you probably meant this one
https://forum.blockland.us/index.php?topic=94090.0
« Last Edit: January 03, 2018, 09:44:55 PM by Sideswipe »

edit: you probably meant this one
https://forum.blockland.us/index.php?topic=94090.0
yep
non-dead link

relevant code
Code: [Select]
      %pos = %client.player.getPosition();
     
      %client.AdminVehicle = new WheeledVehicle() {
                                 datablock = %DataBlock;
                                 isAdminVehicle = true;
                                 creationTime = getSimTime();
                             };
     %client.AdminVehicle.setTransform(%pos);
     %client.AdminVehicle.mountObject(%client.player, 0);
     %client.AdminVehicle.setNodeColor("ALL", $AdminMods::DefaultVehicleColor);

so, what exactly do you want it to do
it sounds like you want an event to spawn a vehicle
just in the middle of the brick?  orientation north?  orientation determined by item/emitter/event specified/other direction?

yep
non-dead link
so, what exactly do you want it to do
it sounds like you want an event to spawn a vehicle
just in the middle of the brick?  orientation north?  orientation determined by item/emitter/event specified/other direction?
event specified
for example, the event would be like this

onActivate > Self > forceSpawnVehicle [Jeep] | North ☐ South ☑ West ☐ East ☐ Emitter ☐ |


So, when this brick is activated, it will spawn a vehicle inside itself facing south with no offsets or velocity. (the first three numbers are x, y, z offset respectively and the other three are x, y, z velocities.)

I only need the direction part, not the position offset or velocity, but they'd be nice inclusions and wouldn't be too hard to include if you (not saying phflack specifically but whoever could make this) used the spawnExplosion/spawnItem code as a base.

relevant code
Code: [Select]
      %pos = %client.player.getPosition();
     
      %client.AdminVehicle = new WheeledVehicle() {
                                 datablock = %DataBlock;
                                 isAdminVehicle = true;
                                 creationTime = getSimTime();
                             };
     %client.AdminVehicle.setTransform(%pos);
     %client.AdminVehicle.mountObject(%client.player, 0);
     %client.AdminVehicle.setNodeColor("ALL", $AdminMods::DefaultVehicleColor);
I actually need this for a mod I'm working on. I was planning on just spawning in vehicle bricks far away for each player. But this is much cleaner.


onActivate > Self > forceSpawnVehicle [Jeep] | North ☐ South ☑ West ☐ East ☐ Emitter ☐ | [0] [0] [0] [0]
probably don't need the emitter option if using north/south/east/west, but could be an interesting way to rotate it (using the setEmitterDirection event)

will look into this when I have time to test and things