Page 1 of 1

Change the color of a button by activating

Posted: Wed Jun 26, 2013 12:54 pm
by maneus
I will change the color of a button when a door or portcullis is open or closed. Therefor I have made two models. One with green button and one with a red button.

I wrote the following script to the "red button", which is primarily there.

Code: Select all

function buttondrop()
     if khorne_door_portcullis_6:isOpen() then
     spawn("khorne_button_green", 2, 2, 19, 1)
     else
     spawn("khorne_button_red", 2, 2, 19, 1)
     end
end
All what happens now is that by opening the portcullis the red button changed into a green button. But by activating again the portcullis will be closed and the color remains green.

Re: Change the color of a button by activating

Posted: Wed Jun 26, 2013 1:09 pm
by maneus
I have did it by myself.
The code was:

Code: Select all

function buttondrop()
     if khorne_door_portcullis_6:isOpen() then
     spawn("khorne_button_green", 2, 2, 19, 1, "green_button")
     else
     green_button:destroy()
     end
end