[Q/A] texture method
#1

Best method for texture scripting
Method 1 :
PHP Code:
SetObjectMeterial(CreateObject(),....);
SetObjectMeterial(CreateObject(),....); 
Method 2 :
PHP Code:
new Texture;
Texture =CreateObject();
SetObjectMeterial(Texture,...);
Texture =CreateObject();
SetObjectMeterial(Texture,...); 

Method 3 :
PHP Code:
new Texture[2];
Texture[0] =CreateObject();
SetObjectMeterial(Texture[0],...);
Texture[1] =CreateObject();
SetObjectMeterial(Texture[1],...); 

Please let me know, which one will be good and why?
Reply
#2

With first method you can change only one texture on a single object.
Second will create only one variable so it will be faster than third which is allocating more variables.

So at the end best method is second one, but it makes no difference as all three works and there is no performance impact (you create objects only at startup).
Reply
#3

The thing is, whatever memory it'd use it's still created locally, which means it's (usually) part of the OnGmInit and only done once and doesn't really matter, so I'd suggest you to use whatever generated code a map editor gives you.
Reply
#4

All the 3 methods have their own uses.

If you just want to set the texture once: Method 1
If you want to set the texture multiple times and while creating the object only: Method 2
If you want to change textures for specific objects later on: Method 3

You can use all the methods together according to your need.
Reply
#5

Well, I mostly use method 2. Just for making myself sure, I asked it here.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)