avatar0068 Posted March 19, 2013 Share Posted March 19, 2013 how do i spawn vehicles at specific locations using a script made with visual basic. say i wanted to spawn a bus at the co-ordinates below how would i write the command. X= 1002.408569, Y= 270.020752, Z= 31.459654 any help would be appreciated. Link to comment Share on other sites More sharing options...
NomeSkavinski Posted March 19, 2013 Share Posted March 19, 2013 If your using a script hook: Vehicle v = World.CreateVehicle("NAME_OF_VEHICLE", new GTA.Vector3(1002.408569F, 270.020752F, 31.459654F)); then you could do: Player.Character.WarpIntoVehicle(v, VehicleSeat.Driver); if your not have a look through that: http://www.gtamodding.com/index.php?title=...ative_functions But i'd seriously recommend using a script hook. Why not use a simple trainer to spawn the car for you? Hope it helped. Link to comment Share on other sites More sharing options...
avatar0068 Posted March 19, 2013 Author Share Posted March 19, 2013 thanks for the reply, yes i am using scripthook for this and the reason i dont use native trainer is that its for a script i am working on as a progect, all the missionscripts i use call there own spawns and id like to do it as well thanks for the help, ill try that line you posted^^ Link to comment Share on other sites More sharing options...
NomeSkavinski Posted March 19, 2013 Share Posted March 19, 2013 Ok, i see thats fair enough. One thing i should mention is when you spawn the car you should use: v.NoLongerNeeded(); That way when your travelling around the level you wont find the car again, it just keeps things cleaner. But it entirely depends on how you wish to manage your objects or your intentions of the script. Are you using an IDE (Intergrated Development Environment), if not that will be so much helpful to you for finding what you can use or need for making vehicles or pedestrains etc. http://www.microsoft.com/visualstudio/eng/...#d-2012-express Make sure you get the express edition, thats the free one. There are others, feel free to use another. Link to comment Share on other sites More sharing options...
avatar0068 Posted March 19, 2013 Author Share Posted March 19, 2013 thanks again, i can spawn the vehicle i want and where i want it to be, but it spawns about 4 feet in the air and are facing the wrong way...haha i guess i need an orientation command in there as well Link to comment Share on other sites More sharing options...
NomeSkavinski Posted March 19, 2013 Share Posted March 19, 2013 Change: Vehicle v = World.CreateVehicle("NAME_OF_VEHICLE", new GTA.Vector3(1002.408569F, 270.020752F, 31.459654F)); To: Vehicle v = World.CreateVehicle("NAME_OF_VEHICLE", new GTA.Vector3(1002.408569F, 270.020752F, 0).ToGround());v.PlaceOnGroundProperly();v.PlaceOnNextStreetProperly(); Hope this sends you in the right direction Link to comment Share on other sites More sharing options...
avatar0068 Posted March 19, 2013 Author Share Posted March 19, 2013 the vehicle is sitting on the ground nice now, but still faces the wrong direction, i did try the vehicle.heading command but every time i add this no spawn! ill keep trying, Link to comment Share on other sites More sharing options...
NomeSkavinski Posted March 19, 2013 Share Posted March 19, 2013 I solved a similar problem in my RampSpawner script, put this after you have spawned the car: v.Rotation = new GTA.Vector3(0, 0, (Game.CurrentCamera.Heading - 180) This should face the car at the camera. So you could change Game.CurrentCamera.Heading with Player.Character.Heading if you always wanted it to face the player when spawning regardless of where the camera is facing. the 180 at the end rotates it 180 degrees, so if its still wrong either remove it or try different values. Link to comment Share on other sites More sharing options...
avatar0068 Posted March 26, 2013 Author Share Posted March 26, 2013 i figured it out, declerations Dim pos As New Vector3 Dim vehicle As vehicle pos = New Vector3(1002.49F, 269.95F, 31.46F) this is where your vehicle will be placed vehicle = World.CreateVehicle("your vehicle", pos) your selected vehicle vehicle.Heading = 144.9825F the rotation of your selected vehicle in vb just change the numbers to get the desired rotation of the vehicle, hope this helps someone. 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