I’ve got a player character, and when the player presses “Shift”, he will turn invisible. Is there any way I could check if the player is invisible, and then execute another command? I am thinking of letting the player fly when he’s invisible, and not when he’s visible.
These forums are great! You guys are really helpful!
So if you want him to be able to fly just test to see if the inivisible property is TRUE.
I’m assuming you know how to toggle his visibility on and off. So when you make him visible again after being inivisible just change the “invisible” property back to FALSE.
Ok. As far as I can see, properties only affects the model currently activated. How could I then execute a command on another model from the player-model? Let’s say that I want the player to be able to move a box with the numpad-arrows only when he’s invisible.
This is the basic way of doing it via logic bricks. To summarize when you set the player to be invisible, also send a message to the cube or to all objects that you want effected telling them that the player is invisible. Then set their “playerInvisible” property to be true. Now hook up any logic bricks that you want to say the cube and have it only work when “playerInvisible” property is true.
That was the messy logic brick way of doing it. You can do it via python easily by obtaining the player object via python and just checking to see if the property “invisible” of the player object is set to true, then just execute whatever script or logic you have hooked up to the cube. You can find out how to get objects in a scene from here http://www.blender.org/documentation/pydoc_gameengine/PyDoc-Gameengine-2.34/KX_Scene.KX_Scene-class.html.