KITT1995 Posted September 6, 2011 Share Posted September 6, 2011 Why when i put a custom vehicle the collisions remain the same of the original vehicle and not of the custom one? This is the script: txd = engineLoadTXD("data/bullet.txd") engineImportTXD(txd,541) dff = engineLoadDFF("data/bullet.dff",541) engineReplaceModel(dff,541) txd = engineLoadTXD("data/faggio.txd") engineImportTXD(txd,462) dff = engineLoadDFF("data/faggio.dff",462) engineReplaceModel(dff,462) txd = engineLoadTXD("data/copcarsf.txd") engineImportTXD(txd,597) dff = engineLoadDFF("data/copcarsf.dff",597) engineReplaceModel(dff,597) txd = engineLoadTXD("data/androm.txd") engineImportTXD(txd,592) dff = engineLoadDFF("data/androm.dff",592) engineReplaceModel(dff,592) txd = engineLoadTXD("data/cargobob.txd") engineImportTXD(txd,548) dff = engineLoadDFF("data/cargobob.dff",548) engineReplaceModel(dff,548) Link to comment
megaman54 Posted September 6, 2011 Share Posted September 6, 2011 You need .col files to modify the collisions. Link to comment
NotAvailable Posted September 6, 2011 Share Posted September 6, 2011 The best way to get the .col file is to use Kam's GTA 3DS Max scripts. You can find e'm on GTAPlace and/or GTAinside Link to comment
KITT1995 Posted September 6, 2011 Author Share Posted September 6, 2011 You need .col files to modify the collisions. In the wiki it is said that for vehicles the collisions will be taken directly from the .dff. Then i need to put .col to vehicle too? Link to comment
dragonofdark Posted September 7, 2011 Share Posted September 7, 2011 No, you just need to make a function wich load and replace the model a second time : function replaceVeh() txd = engineLoadTXD("data/bullet.txd") engineImportTXD(txd,541) dff = engineLoadDFF("data/bullet.dff",541) engineReplaceModel(dff,541) txd = engineLoadTXD("data/:O.txd") engineImportTXD(txd,462) dff = engineLoadDFF("data/:O.dff",462) engineReplaceModel(dff,462) txd = engineLoadTXD("data/copcarsf.txd") engineImportTXD(txd,597) dff = engineLoadDFF("data/copcarsf.dff",597) engineReplaceModel(dff,597) txd = engineLoadTXD("data/androm.txd") engineImportTXD(txd,592) dff = engineLoadDFF("data/androm.dff",592) engineReplaceModel(dff,592) txd = engineLoadTXD("data/cargobob.txd") engineImportTXD(txd,548) dff = engineLoadDFF("data/cargobob.dff",548) engineReplaceModel(dff,548) end addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), replaceVeh) function reload () setTimer(replaceVeh, 1000, 1) -- make the modding function to load a second time after 1 second end addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), reload But there is just a little problem, the modded vehicles must be already created as the collision will not load. I.E.: If you start the resource which change the vehicles models, and then you create a vehicle with the admin panel, the collision will not load. Link to comment
KITT1995 Posted September 7, 2011 Author Share Posted September 7, 2011 No, you just need to make a function wich load and replace the model a second time : function replaceVeh() txd = engineLoadTXD("data/bullet.txd") engineImportTXD(txd,541) dff = engineLoadDFF("data/bullet.dff",541) engineReplaceModel(dff,541) txd = engineLoadTXD("data/:O.txd") engineImportTXD(txd,462) dff = engineLoadDFF("data/:O.dff",462) engineReplaceModel(dff,462) txd = engineLoadTXD("data/copcarsf.txd") engineImportTXD(txd,597) dff = engineLoadDFF("data/copcarsf.dff",597) engineReplaceModel(dff,597) txd = engineLoadTXD("data/androm.txd") engineImportTXD(txd,592) dff = engineLoadDFF("data/androm.dff",592) engineReplaceModel(dff,592) txd = engineLoadTXD("data/cargobob.txd") engineImportTXD(txd,548) dff = engineLoadDFF("data/cargobob.dff",548) engineReplaceModel(dff,548) end addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), replaceVeh) function reload () setTimer(replaceVeh, 1000, 1) -- make the modding function to load a second time after 1 second end addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), reload But there is just a little problem, the modded vehicles must be already created as the collision will not load. I.E.: If you start the resource which change the vehicles models, and then you create a vehicle with the admin panel, the collision will not load. There isn't a way to do it when creating vehicle? With the event "onVehicleSpawn"? Link to comment
dragonofdark Posted September 7, 2011 Share Posted September 7, 2011 You can, but if someone is driving a modded vehicle while you create a new one, this person will be jacked from his car. Link to comment
KITT1995 Posted September 8, 2011 Author Share Posted September 8, 2011 You can, but if someone is driving a modded vehicle while you create a new one, this person will be jacked from his car. Which clientside function can i use to do this? "onvehiclespawn" doesn't exist Link to comment
KITT1995 Posted September 26, 2011 Author Share Posted September 26, 2011 Nobody can help me? Link to comment
Remi-X Posted September 26, 2011 Share Posted September 26, 2011 Use the script of dragofdark, that's the way to replace vehicle collisions. Those collisions are just very poorly implemented in MTA, so there's not much you can do about it too at the moment. If it doesnt work, use onClientElementStreamIn as the event. I've been told that replacing collisions only works when the vehicle you want to replace is streamed in, but I haven't tried this myself. megaman54 and Jesseunit, please know what you're posting before you actually post. Vehicles do not have a .col file! Link to comment
KITT1995 Posted September 26, 2011 Author Share Posted September 26, 2011 Use the script of dragofdark, that's the way to replace vehicle collisions. Those collisions are just very poorly implemented in MTA, so there's not much you can do about it too at the moment.If it doesnt work, use onClientElementStreamIn as the event. I've been told that replacing collisions only works when the vehicle you want to replace is streamed in, but I haven't tried this myself. megaman54 and Jesseunit, please know what you're posting before you actually post. Vehicles do not have a .col file! It doesn't work with onClientElementStreamIn, everytime the original collision function replaceVeh() txd = engineLoadTXD("data/bullet.txd") engineImportTXD(txd,541) dff = engineLoadDFF("data/bullet.dff",541) engineReplaceModel(dff,541) txd = engineLoadTXD("data/faggio.txd") engineImportTXD(txd,462) dff = engineLoadDFF("data/faggio.dff",462) engineReplaceModel(dff,462) txd = engineLoadTXD("data/copcarsf.txd") engineImportTXD(txd,597) dff = engineLoadDFF("data/copcarsf.dff",597) engineReplaceModel(dff,597) txd = engineLoadTXD("data/androm.txd") engineImportTXD(txd,592) dff = engineLoadDFF("data/androm.dff",592) engineReplaceModel(dff,592) txd = engineLoadTXD("data/cargobob.txd") engineImportTXD(txd,548) dff = engineLoadDFF("data/cargobob.dff",548) engineReplaceModel(dff,548) end addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), replaceVeh) function reload () setTimer(replaceVeh, 1000, 1) -- make the modding function to load a second time after 1 second end addEventHandler ( "onClientElementStreamIn", getResourceRootElement(getThisResource()), reload ) Link to comment
Discord Moderators Zango Posted September 27, 2011 Discord Moderators Share Posted September 27, 2011 If it doesnt work, use onClientElementStreamIn as the event. I've been told that replacing collisions only works when the vehicle you want to replace is streamed in, but I haven't tried this myself. I told you that there was a high chance of success if a vehicle of the replacing model was streamed in, not that it's the only way at all. The problem is really that MTA is unable to load embedded collisions via engineReplaceModel the first time it is called. The only way is to load the dff several times. Now the trick is to find a way to determine if the vehicle collision failed, and then keep replacing until the opposite of course. I almost found a failproof way to do this, and I just need to make it more efficient. I'm planning a vehicle replacement resource at some point, at which it'll be included and ya'll can grab the code if you want 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