open.mp forum
[Pawn] SetObjectMaterial() weird - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
--- Thread: [Pawn] SetObjectMaterial() weird (/showthread.php?tid=1744)



SetObjectMaterial() weird - gokuta - 2021-03-09

okay, I use this:?



Code:
new objectid = CreateObject(3174, 1345.0, -1400.0, 14.0, 0.0, 0.0, 0.0, 150.0);

SetObjectMaterial(objectid, 0, -1, "none", "none", 0xFFFFFFFF);



This line does almost nothing, it only removes vertex lightning. That's all. The problem is... draw distance suffers!!! I mean my object disappears quickly and abruptly at distance 150.0. First of all... no nice transitions, it disappears fast?and looks horrible.?Second of all... my personal draw distance settings are disregarded now.



Is it some undocumented?SetObjectMaterial flaw that cannot be fixed? How do I use?SetObjectMaterial without fucking up draw distance of my objects?


RE: SetObjectMaterial() weird - Virsenas - 2021-03-09

Load up an empty gamemode with just this one object and check how the draw distance works. If it is the same situation then maybe that object has a premade draw distance and you can't change it.



Do you create objects with CreateObject only? Or do you use a streamer?


RE: SetObjectMaterial() weird - gokuta - 2021-03-09

(2021-03-09, 11:13 AM)Virsenas Wrote: Load up an empty gamemode with just this one object and check how the draw distance works. If it is the same situation then maybe that object has a premade draw distance and you can't change it.



Do you create objects with CreateObject only? Or do you use a streamer?



In this specific case I used plain CreateObject and no streamer. I believe?SetObjectMaterial works in such a way that it fucks up draw distance. And it remains fucked up even after I reset object using this line.



Code:
SetObjectMaterial(objectid, 0, -1, "none", "none", 0);



The real question is do we have a work around for this major draw-distance fuck-up :D I guess we do not...

Excuse me for profanities, but I am seriously disappointed at how flawed samp is


RE: SetObjectMaterial() weird - Virsenas - 2021-03-09

(2021-03-09, 11:36 AM)gokuta Wrote:
(2021-03-09, 11:13 AM)Virsenas Wrote: Load up an empty gamemode with just this one object and check how the draw distance works. If it is the same situation then maybe that object has a premade draw distance and you can't change it.







Do you create objects with CreateObject only? Or do you use a streamer?







In this specific case I used plain CreateObject and no streamer. I believe?SetObjectMaterial works in such a way that it fucks up draw distance. And it remains fucked up even after I reset object using this line.







Code:
SetObjectMaterial(objectid, 0, -1, "none", "none", 0);







The real question is do we have a work around for this major draw-distance fuck-up :D I guess we do not...



Excuse me for profanities, but I am seriously disappointed at how flawed samp is



https://open.mp/docs/scripting/functions/CreateObject



Check your CreateObject last parameter.


RE: SetObjectMaterial() weird - gokuta - 2021-03-09

I set the last parameter to?150.0 and live happily with that. I can adjust draw distance through game settings as well. Unless I change object material, then I can adjust it no longer and also object does not fade away anymore, it simply disappears in a very ugly manner. You try to help, but no real solutions so far...


RE: SetObjectMaterial() weird - Y_Less - 2021-03-10

You set the drawdistance to 150, so yes, it vanishes at 150. That's not a bug, that's what you explicitly requested If you want it higher set it higher. If you want LOD, create a LOD object.



Also, did you know that you can edit posts? You don't need to apologise for your language, you can just remove it.


RE: SetObjectMaterial() weird - Virsenas - 2021-03-10

(2021-03-10, 02:05 AM)Y_Less Wrote: You set the drawdistance to 150, so yes, it vanishes at 150.? That's not a bug, that's what you explicitly requested? If you want it higher set it higher.? If you want LOD, create a LOD object.







Also, did you know that you can edit posts?? You don't need to apologise for your language, you can just remove it.





Actually I did test this. Even if you don't set the draw distance to 150 for the object and leave it to default, when you apply the material change the objects draw distance somehow shortens.



https://www.youtube.com/watch?v=Iz2EqlXGx7k



https://www.youtube.com/watch?v=8GK6tcce6a8


RE: SetObjectMaterial() weird - gokuta - 2021-03-10

Y_Less, I would expect you to be familiar with the problem :D weirdly enough you are not. When color is not set, draw distance can be changed with personal settings (graphics ->advanced)?and not only that, the object also fades in/out nicely (unless draw distance is more than 299.0, in which case expect no nice fading). After color is set, draw distance CANNOT be changed with personal settings and more importantly, object DOES NOT fade in/out anymore, it simply disappears/reappears abruptly. I taught you something new, congrats

I would also like someone to find a work-around on how to fix the fading...?



Virsenas, actually after color is set, draw distance is exactly to what it has been set. And without color change draw distance is personal settings dependent. It can be extended with personal settings.


RE: SetObjectMaterial() weird - Y_Less - 2021-03-11

Yes, but it still sounds like now with the colour the code is doing what you wanted, but without the colour the code isn't. So the after code is more correct - it is using the distance you specified, while before it was incorrectly ignoring it. If you want a higher draw distance, specify a higher draw distance.