VU Community Forums

ConsoleVehicles - Console commands to spawn vehicles

Description

Spawn vehicles and list all available vehicles through console commands. Any vehicles in singleplayer or coop bundles that are loaded will also be available.

Usage

This mod registers 2 console commands:

consolevehicles.spawn <vehicle> [distance] [height]

Spawn a vehicle (a certain distance and height) in the direction the player is looking.

consolevehicles.list

List all available vehicles.

Download

The latest version can be found here:

ConsoleVehicles.zip (2.9 KB)

You can also find it on Github:

8 Likes

I’ve tried to add a dirtbike to a B2K map but it wasn’t available.
Any ideia on how to fix that?

You would have to load a bundle of a map that contains that VehicleBlueprint.

And how do I do that?
I’m new in VU, sorry for so many questions

Theres tons of examples on github and discord, f.e:
https://github.com/J4nssent/VU-Mods/blob/master/Vespa/ext/Shared/init.lua
If you keep only the bundle mounting parts you get this (shared script):

Events:Subscribe('Level:LoadResources', function()
	ResourceManager:MountSuperBundle('xp5chunks')
	ResourceManager:MountSuperBundle('levels/xp5_002/xp5_002')
end)

Hooks:Install('ResourceManager:LoadBundles', 100, function(hook, bundles, compartment)
    if #bundles == 1 and bundles[1] == SharedUtils:GetLevelName() then
        print('Injecting bundles.')

        bundles = {
		'levels/xp5_002/xp5_002',
		'levels/xp5_002/cql',
		bundles[1],
        }

        hook:Pass(bundles, compartment)
    end
end)

Events:Subscribe('Level:RegisterEntityResources', function(levelData)
	local xp5_002Registry = RegistryContainer(ResourceManager:SearchForInstanceByGuid(Guid('421454A2-6F76-B4C6-7240-322C71D8DDAB')))
    ResourceManager:AddRegistry(xp5_002Registry, ResourceCompartment.ResourceCompartment_Game)
end)

Got it.
Thanks ppl!!!

I am unable to spawn certain vehicles (specifically a few of the dlc vehicles). The M1128-Stryker appears on the list of vehicles when I type in consolevehicles.list. However if I type in consolevehicles.spawn M1128-Stryker [distance] [height] it returns invalid vehicle specified.

This was done on a server with no other mods enabled. Map was Armored Shield, Conquest Large.

Hm in your case it will work with a partial name. I thought I fixed that bug :confused:

Hi, very limited programming knowledge. Is it possible to load vehicles to a map that they were not meant for? For instance, loading a Mi28 to Metro Rush or something similar?

Thanks in advance

I’m not a programmer either. I tried something just like that the other day. Specifically I spawned a helli to Seine Crossing. Apparently some maps have some kind of lower ceiling/sky because the helli couldnt go any higher :slight_smile: Would be nice if that could be tweaked though. Urban maps with transporte helis at least would be awesome

Ahh ok. Did the helo show up when you asked for the maps vehicles list? Or did you just try to spawn it based on its ingame name?

You gotta first “inyect” the vehicle assets from other maps that do have helis. I tested the sample that Janssent mentioned in the page above. That brings quite a few assets from one of the maps.
You could download the list of mods in zip from this github https://codeload.github.com/J4nssent/VU-Mods/zip/master. And then extract only the “vespa” folder to your server mods folder. Then make sure to load at least the vespa mod and consolevehicles.

Hey Janssent, I’m having trouble with one of the last lines of this code to inyect resources from a different map from the one in the example.
The first parts no problem I can find the internal map names and modes, etc.
But I don’t know where or how to get the correct GUID for RegistryContainer(ResourceManager:SearchForInstanceByGuid(Guid(‘421454A2-6F76-B4C6-7240-322C71D8DDAB’)))
I want to get resources from xp5_001 so I guess I should just replace xp5_002 with xp5_001 in the example. But no idea about the guid number.

Ok awesome, will try that. So I just place the “Vespa” folder in the Mods folder and add Vespa to the Modlist.txt. Then ingame I use the ConsoleVehicles commands to spawn f.ex. Mi-28 in what ever map, right?

Thx super much for helping me out with this :slight_smile:

Yeah, that mod and the example Janssent copied at the start of the topic will inyect the vehicles / resources from the map Nebandan Flats in the Conquest Large mode, including the mi28, etc: Nebandan Flats | Battlefield Wiki | Fandom
I’m still finding out how to take the resources from other maps myself. I’m no programmer at all, just testing stuff :stuck_out_tongue:

Sweet man, gonna try when I get home :slight_smile:

Hey guys, keep getting this error. Any idea what I’m doing wrong? It happens a few seconds after the last entry in the Server Console (“Update check complete. No new updates available.”) comes up. I’m able to load up Ziba Tower gun master but not any large Conquest maps such as Gulf of Oman.

This is the error that comes up:

VU-Vespa

This is the crash report:

Crash ID: e738f56e-bd2c-44bf-b234-3875b88f3877
Build Number: 17384
Release Branch: prod

Any ideas?

Hey Gevi, I found this under VU Documentation. No idea how this all works but perhaps you can figure something out. It seems to me you should be able to get the ResoureGUID through some commands there:

Thanks Ingis, I got the place to get the info I needed at the discord server using the ebx tool.

Ingis, I just reproduced that crash. Looks like the server crashes when injecting resources from other maps that already exist or conflict with the ones in the running map. This mod Im uploading here injects resources from Operation Riverside in Conquest LArge . From what I tried it doesnt crash with Gulf of Oman. Use it with consolevehicles mod as before.
Inyectar.zip (1.3 KB)