[DooD]Heavyair Posted May 6, 2008 Share Posted May 6, 2008 (edited) i have looked at the MTA WIKI but cant find what im looking for i want to spawn an attached truck and trailer with the .MAP file i know how to set car spawn points but am unsure as to how to attach the trailer can it be done and if it can could someone tell me how or link me to the right part of the WIKI if i have just missed it any help appreciated thanx Edited May 13, 2008 by Guest Link to comment
Ace_Gambit Posted May 6, 2008 Share Posted May 6, 2008 I don't think you can spawn an attached trailer because both elements are seperate vehicles. You will have to script the attaching part using something like this: http://development.mtasa.com/index.php? ... rToVehicle. Link to comment
[DooD]Heavyair Posted May 6, 2008 Author Share Posted May 6, 2008 Thanx for the reply if i manage to figure something out i will try to post it here Thanx again u r a STAR ACE_GAMBIT EDIT : i am a bit confused by this if i try to spawn the trailer with the map file it never appears ( even when spawned with no truck cab ) i can spawn the cab ( linerunner , roadtrain ) fine but there doesnt seem to be a way of creating the trailer until your in the game i have tried writing a function to create cab and trailer then attach them like it says in the wiki but it just messes up the rest of my scripts and doesnt make a truck im pretty sure im doing something wrong but i just dont know what so here is what ive written and if anybody notices any obvious mistakes could u tell me THANX function filltruckstop () local cab1 = ( createVehicle, 514, -476, -489, 25 ) local trailer1 = ( createVehicle, 584, -480, -482, 25 ) attachTrailerToVehicle ( cab1, trailer1 ) end addEventHandler ( onResourceStart, root, filltruckstop ) i have also tried it as a console command but it doesnt do anything EDIT : i have tried to spawn a trailer on its own in the .MAP file but that doesnt seem to work either i thought if i could get the .MAP to spawn the cab and trailer i could then write a function to join them together but it seems the only way to create a trailer is within the game does anyone know if im just being dumb or is this possibly a bug i know im missing the rotation in the function above but i was trying to keep it short and easier to read Link to comment
Morelli Posted May 9, 2008 Share Posted May 9, 2008 local cab1 = ( createVehicle, 514, -476, -489, 25 ) local trailer1 = ( createVehicle, 584, -480, -482, 25 ) Replace the above with: local cab1 = createVehicle ( 514, -476, -489, 25 ) local trailer1 = createVehicle ( 584, -480, -482, 25 ) Link to comment
Morelli Posted May 9, 2008 Share Posted May 9, 2008 local cab1 = ( createVehicle, 514, -476, -489, 25 ) local trailer1 = ( createVehicle, 584, -480, -482, 25 ) Replace the above with: local cab1 = createVehicle ( 514, -476, -489, 25 ) local trailer1 = createVehicle ( 584, -480, -482, 25 ) Link to comment
[DooD]Heavyair Posted May 9, 2008 Author Share Posted May 9, 2008 thank u very much will try it now no errors but no truck either VERY CONFUSING Link to comment
[DooD]Heavyair Posted May 9, 2008 Author Share Posted May 9, 2008 thank u very much will try it now no errors but no truck either VERY CONFUSING Link to comment
50p Posted May 9, 2008 Share Posted May 9, 2008 onResourceStart should be a string, therefore: addEventHandler( "onResourceStart", root, filltruckstop) Remember that this will be executed when any resource start! If you don't want to do that use this instead: addEventHandler( "onResourceStart", getResourceRootElement( getThisResource() ), filltruckstop) Link to comment
50p Posted May 9, 2008 Share Posted May 9, 2008 onResourceStart should be a string, therefore: addEventHandler( "onResourceStart", root, filltruckstop) Remember that this will be executed when any resource start! If you don't want to do that use this instead: addEventHandler( "onResourceStart", getResourceRootElement( getThisResource() ), filltruckstop) Link to comment
[DooD]Heavyair Posted May 9, 2008 Author Share Posted May 9, 2008 have got it almost working its very difficult to get them to spawn attached but i think its doable if you mess with rotaionZ function truckstopload () local cab1 = createVehicle ( 514, -594, -1081, 24, 0, 0, 150 ) local trailer1 = createVehicle ( 584, -588, -1072, 24, 0, 0, 150 ) attachTrailerToVehicle ( trailer1, cab1 ) end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), truckstopload ) thanx for all the help ACE_GAMIT : 50p : morelli Link to comment
[DooD]Heavyair Posted May 9, 2008 Author Share Posted May 9, 2008 have got it almost working its very difficult to get them to spawn attached but i think its doable if you mess with rotaionZ function truckstopload () local cab1 = createVehicle ( 514, -594, -1081, 24, 0, 0, 150 ) local trailer1 = createVehicle ( 584, -588, -1072, 24, 0, 0, 150 ) attachTrailerToVehicle ( trailer1, cab1 )end addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), truckstopload ) thanx for all the help ACE_GAMIT : 50p : morelli Link to comment
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