Notifications
Clear all

[Closed] How can I refer object itself in Maxscript?

Hi

I want to use script controller to control a vaule of an objecy with another value of same object.

For example, I want to use script controller for diffuse color of a material.

When I assign the material to 10 objects, I want to the script controller take the handle value of the object and use it as a seed number for randome function.

So every object has a different color within a range that I set.

Thanks.

1 Reply

maybe useful :

  1. save the material value into a variable ,eg: theSaveMat=$box01.material
  2. write a function to get random material from thesaveMat ,and then give back the value to theSaveMat.

if ur function like this ,for eg:


fn randomMatCreator  theMat = 
(
seed i
theMat.<something> =random <somting>
......
return theMat
) 

then u can loop it and get random material from previous variable :

 for i=1 to 100 do 
(
theSaveMat=randomMatCreator  theSaveMat
current_object.material=theSaveMat
..............
)