Object material - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Object material (
/showthread.php?tid=472484)
Object material -
Wizzy951 - 28.10.2013
Hi guys, I'm working on a project and I wonder is there way to set the
Object material for 100 and more objects to the same one using only one variable ?
Thanks in advance.
Re: Object material -
Pottus - 28.10.2013
The next version of Texture Studio will have text, copy/paste object material properties and the ability to texture multiple like objects at the same time to a material and/or color.
Re: Object material -
Mauzen - 28.10.2013
Not a safe way. You can just store the first object id, and then change the material for the following 100+ ids. But this will just work safely if you create the objects at gamemode start, never remove them during runtime, and always completely shut down the server for restarting it, instead of using gmx or stuff. Else ids might get mixed up, and some of the ids after the stored one might be invalid or belong to other objects, eventually turning your map into a psychedelic wonderland of strange textures.
Alternatively, you can change the material directly on creation for every single object, but that extremely messy.
SetObjectMaterial(CreateObject(habbbadffd), adjkasdjkasjkfj)
Re: Object material -
Wizzy951 - 28.10.2013
Quote:
Originally Posted by [uL]Pottus
The next version of Texture Studio will have text, copy/paste object material properties and the ability to texture multiple like objects at the same time to a material and/or color.
|
That's nice, but I can't wait its release now.
Quote:
Originally Posted by Mauzen
Not a safe way. You can just store the first object id, and then change the material for the following 100+ ids. But this will just work safely if you create the objects at gamemode start, never remove them during runtime, and always completely shut down the server for restarting it, instead of using gmx or stuff. Else ids might get mixed up, and some of the ids after the stored one might be invalid or belong to other objects, eventually turning your map into a psychedelic wonderland of strange textures.
Alternatively, you can change the material directly on creation for every single object, but that extremely messy.
SetObjectMaterial(CreateObject(habbbadffd), adjkasdjkasjkfj)
|
I thought to release that project, so what do you suggest me to set the material for each object or not ?
Re: Object material -
Mauzen - 28.10.2013
Quote:
Originally Posted by Wizzy951
I thought to release that project, so what do you suggest me to set the material for each object or not ?
|
Neither of them. If you want to release it, just create an array to store the ids in. That wont even be a kilobyte of ram and people will have to live with that. Releasing unstable or ugly code is more of a bad scripting manner than wasting some bytes of ram

If you really dont want that go with the second one. Bad code, but at least people wont complain about bugs.
Re: Object material -
Pottus - 28.10.2013
Quote:
Originally Posted by Mauzen
Alternatively, you can change the material directly on creation for every single object, but that extremely messy.
SetObjectMaterial(CreateObject(habbbadffd), adjkasdjkasjkfj)
|
That isn't a good way to do it what if you have several material indexes on a object to set ?

Yes it will work for one index fine of course but I think it makes it less extensible for future updates.