ddraigcymraeg Posted October 20, 2018 Share Posted October 20, 2018 (edited) Hi, Im trying to spawn vehicles in lua, preferably at a set x,y,z. AddVehicle() or AddVehicle("Base.PickUpVan") This method looks to be available to lua, but whenever I call it, I get "Object tried to call nil" I noticed with: addAllVehicles() that I seemed to have more luck in testing, I got the messages: "....not spawned, position invalid.." which meant the function actually got called... but my location was in a building which is probably why nothing spawned. from this thread, I see that you should be able to do in MP: /addvehicle "Base.VanSpiffo" "x,y,z" So calling this code as well does not work: SendCommandToServer("/addvehicle \"" .. "Base.VanSpiffo" .. "\" \"" .. square:getX()..","..square:getY()..","..square:getZ() .. "\"") Not sure what is going on.... I got the same error with SendCommandToServer("/invisible"); Caused by: java.lang.NullPointerException at zombie.network.GameClient.SendCommandToServer(GameClient.java:1802) at zombie.Lua.LuaManager$GlobalObject.SendCommandToServer(LuaManager.java:4344) So maybe this only works in an MP game... Any ideas how to spawn a car in an SP (and MP) game at a specific x,y,z? also tried: square:AddWorldInventoryItem("Base.VanSpiffo", 0.0, 0.0, 0.0); to be sure, but of course that did not work either. Thank you in advance. Edited October 20, 2018 by ddraigcymraeg Link to comment Share on other sites More sharing options...
ddraigcymraeg Posted October 21, 2018 Author Share Posted October 21, 2018 Checked out Necroforge's code, and it does not use addvehicle. It will only replace the vehicle you currently have, so it does no proper spawning. It would be great if the devs added a working addvehicle feature at x,y,z. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now