Oz. Posted November 23, 2011 Share Posted November 23, 2011 Bear in mind that custom object support in MTA is still pretty buggy, so you may experience intermittent texture failure or the col reverting to original when streamed out and in again (I think there is a scripting fix for that one though). Welcome to the aforementioned col problems, caused by your object replacement reverting to original col. CapY's comments are unrelated to the difficulties you're facing. What you are experiencing is caused by the bounding box of your new col differing from the bounding box of the original (in this case, unavoidable). In this situation, when the pivot (usually a point at the 'centre', in most cases, which takes your X/Y/Z coords) of the object is no longer on-screen, the entire object will disappear. So that is why from some angles the correct object is visible, while from other angles (where pivot is off-screen) it disappears, even though parts should still be visible to you. Unfortunately this problem is quite common in object replacement. Often it will work fine when the object is streamed in the first time, but fails if it is streamed out (player travels away) and back in again (player returns). Here's hoping custom object functionality gets a bit more attention in the near future As quoted above, there is a way of 'fixing' it through scripting, but that is outside my field of expertise. Link to comment
CapY Posted November 23, 2011 Share Posted November 23, 2011 Bear in mind that custom object support in MTA is still pretty buggy, so you may experience intermittent texture failure or the col reverting to original when streamed out and in again (I think there is a scripting fix for that one though). Welcome to the aforementioned col problems, caused by your object replacement reverting to original col. CapY's comments are unrelated to the difficulties you're facing. @Oz Then, that's modeling problem. @Baingo function ReplaceObject ( ) txd = engineLoadTXD( "world/a52_ext.txd" ) col = engineLoadCOL( "world/remover.col" ) dff = engineLoadDFF( "world/des_a51infenc.dff", 0 ) --modelid is everytime 0, when you replace no vehicle engineImportTXD( txd, 16094 ) engineReplaceCOL( col, 16094 ) engineReplaceModel( dff, 16094 )-- replace the model at least end addCommandHandler( "replace", ReplaceObject ) I'm not sure if this gonna work, i just did the script simplier, the rest of the things is your problem(discuss about that with Oz) Link to comment
Baingo Posted November 23, 2011 Author Share Posted November 23, 2011 Damn alright I might just have to live with it. Thanks for the time and effort you guys have put into helping me with this. I've seen this on another server, might try asking the host see if he can help me. I'll just work on other stuff in the meantime. Link to comment
Slayer Posted November 24, 2011 Share Posted November 24, 2011 As quoted above, there is a way of 'fixing' it through scripting, but that is outside my field of expertise. I may be able to help This may or may not work as I'm not able to test it (and I don't remember exactly how I did it before). You'll need to get the exact coordinates and rotation of the fence object with a map editor (not the MTA editor) like MEd. Then fill in the coordinates and rotation in line 1 in the script below. --clientside local fencing = createObject(16094, xCoordinate, yCoordinate, zCoordinate, xRotation, yRotation, zRotation) -- create a fence in the same position as the old fence to use for a stream element for the model replacement -- you can get the object's exact coordinates and rotation by using a GTA map editor called MeD setElementAlpha(fencing, 0) -- make the fence you created invisible so you won't see it twice once the new objects are streamed in function replaceTheFence() -- create our function to replace the model, textures and col fenceTXD = engineLoadTXD("world/a52_ext.txd") --load your TXD fenceCOL = engineLoadCOL("world/remover.col") --load your COL fenceDFF = engineLoadDFF("world/des_a51infenc.dff", 0) --load your DFF engineImportTXD(fenceTXD, 16094) -- import and replace the TXD textures engineReplaceCOL(fenceCOL, 16094) -- replace the COL engineReplaceModel(fenceDFF, 16094) -- replace the DFF engineSetModelLODDistance(16094, 1000) -- set the LOD distance so the object won't disappear once you move slightly away end addEventHandler("onClientElementStreamIn", fencing, replaceTheFence) -- create an event handler to replace the models when the fence object you created is streamed in 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