I’ve got a problem…, how do I make a phyton logic brick onely activate when two sensors are active?, just dragging two lines to it won’t work: it will behave lake a OR controller, it activates when one of the two sensors are active, it onely need it to activate when both sensors are active…
thanks in advance,
paashaas
(is the problem clear enough?, or schould I provide you with even more details?)
uhmm Its kind of hard to answer this question, maybe your two active sensor are not really active, take a print screen, this ll make it easier for us to understand
visible = True : Show mouse
visible = False : Don’t show mouse
and for your sensors fill in the “name_of_first” and second, to whatever the names of your sensors are.
import bge # import bge functions
mouse = bge.logic.mouse # setup up mouse variable for ease of use
sensor1 = controller.sensors['name_of_first_sensor_needing_to_be_active'] # first sensor
sensor2 = controller.sensors['name_of_second_sensor_needing_to_be_active'] # second sensor
if sensor1.positive == True and sensor2.positive == True: #only runs if sensors are true
mouse.visible = True # if you want the mouse to show if the sensors are active
else: # else if sensors arent activated do this
mouse.visible = False
When you come in range of the door, it runs a show mouse script :
import Rasterizer as r
r.showMouse(1)
When mouse is over, click the button in the left corner, property one is active(the code(forgot to schow in the vid, srry,:o)) it runs the hide mouse script:
import bge
import bge functions
mouse = bge.logic.mouse
setup up mouse variable for ease of use
sensor1 = controller.sensors[‘left botton’]
first sensor
sensor2 = controller.sensors[‘over’]
second sensor
if sensor1.positive == True and sensor2.positive == True:
#only runs if sensors are true
mouse.visible = False
I don’t know much about Python… still learning.
But… will this work?
-create a Boolean property, name it trigger… or something
-next create your two sensors that both need to be activated. Attach them to a And Controller, and attach that to a Property Actuator.
-Make the Property Actuator a Toggle with the trigger property.
-This way… when both sensors are true, they will toggle the trigger property.
-now… make a property sensor, Evaluation type: Equal, with the trigger property, and set the value to TRUE.
-Attach that to a python sensor with your script.
-now when the trigger property is equal to TRUE, your script should run
I haven’t tested this… I’m just writing this off the top of my head.
Give it a shot though.
Good luck
M
but I will change the code panel numbers: see, a friend of me can draw really good, and he is working on some cool numbers, but thanks so much!!!, when finished, the game will probably pe posteds at kongreagate.com, I will put your name in the discription!