Double Masters And Logic Gates
venomus
Join Date: 2002-11-16 Member: 8951Members
<div class="IPBDescription">Any experience?</div> I have a situation where I want to give a button two 'Masters'. To cut a long story short, this button should only be operable when two different multisources (controlled by two global states) are On. The Master field of a func_button only lets you pick one multisource master.
I had a think about this and realised I need something like an AND logic gate. This could be accomplished by using the func_buttons Master key with one of the multisources, and then having the func_button target some sort of relay to check for the second multisource.
I imagined a few vague ideas of how this could be accomplished, with the ominous feeling that some tedious testing lay ahead of me. However, I'm tired <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif'><!--endemo--> . So I'm asking anyone here if you have ever done anything like this. Maybe someone can tell me the best way to do this (and any entity logic ideas you might like to share with us).
I had a think about this and realised I need something like an AND logic gate. This could be accomplished by using the func_buttons Master key with one of the multisources, and then having the func_button target some sort of relay to check for the second multisource.
I imagined a few vague ideas of how this could be accomplished, with the ominous feeling that some tedious testing lay ahead of me. However, I'm tired <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif'><!--endemo--> . So I'm asking anyone here if you have ever done anything like this. Maybe someone can tell me the best way to do this (and any entity logic ideas you might like to share with us).
Comments
Now you have a chain of 2 switches, what makes this, right...
not sure if it will work that way or cause some nice bugs on reset....
have both globals feed into the multisource, and have the button use the multisource as the master.
so, both globals on, multisource on, button workable.
only one global on, MS off, button not workable.
no global on, MS off, button not workable.
that is the way it SHOULD work.
I used the multisource master of the func_button as one 'checkpoint'. If it is satisfied, the func_button targets another multisource directly, and this multisource is the second checkpoint. The second multisource targets the final event if it's global state is also satisfied.
Here's what I propose:
Entity A and B must be on in order for entity C to work.
Use two env_global/multisource pairs, one for A, one for B. They all start Off.
Add one more env_global/multisouce pair which is AB both being on, it also starts off.
When something triggers global A to be on (like a multimanager), it also attempts to trigger a button which has the B env_global/multisource as its master. This button attempts to turn AB on. So if A turns on, and B also happens to be on (as tested by the button), then AB turns on. Vice versa for when something turns global B on.
Your Entity C uses AB as its master.
Now, if you want to be able to turn A or B off, which would turn AB off also, then you'll need to put in some extra logic checks on top of this. Probably just invert the whole process or use some changetargets.
This system will work without any nasty multisource bugs getting in the way.
However, I did encounter another problem which had me headbutting the wall for a few hours. Remember this:
MULTISOURCES HAVE TO BE SPECIFICALLY TARGETTED TO WORK !!!
They will not work if you trigger them from a multi_manager, trigger_random etc. They might even fail to work if you trigger them from the 'message' key of a path_corner, though I havn't tested this.
In these circumstances, use a trigger_relay to, umm, relay the call to the multisource.