Changeing a material useing a script.

I realize this can be done with a logic brick ( edit object, replace mesh) but this needs to be done with nearly every single object in my game. What i want to happen is for me to be able to change from a happy joy joy land, to a dark and mestireous land, and back, as you progress through the game. I could just add the logic bricks but i realy don’t want to keep every object doubled, on hand, also its a pain to do.

is there a way to change an objects material using a script?

could i chage the material useing a F-curve?

if nothing else works could i do the replace mesh useing a script i realy don’t want to type in all the names of the relpacement meshes.

You could key frame the colour or transparency, it’s not switching material but it will change the colour.

That wont quite work. Because say you have a castle with white walls and a tan morter and you want them to be purple with a black morter it just dosent work.

i know there is metirial setings in the f-curves can you chage materials?

You could use separate materials for the tan mortar and castle?

no that would be insane, that was just one example this needs to be done with every single object in the game all differently. I can easaly make two different materials for each object in fact that was my plan. I havent actualy started modeling, i want to make sure this works before i start. I could just do replace mesh. but this would requre making hundreds of replacement meshes which will greatly slow the game down.

It won’t slow the game down. It will slow the game development down!
I see where your coming from, and I’m afraid I can’t help.

Is there a way to do a replace mesh trhough the replace mesh logic brick via script.

Never Mind i Found it

Greaty, Huh, How??? I have this thing to do now… :slight_smile:

Check the BGE API