Double Masters And Logic Gates

venomusvenomus 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).

Comments

  • OlljOllj our themepark-stalking nightmare Fade Join Date: 2002-12-12 Member: 10696Members
    edited May 2003
    With trigger_changetarget you can change targets of any relay or button.
    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....
  • tommy14tommy14 Join Date: 2002-11-15 Member: 8839Members
    um, a multisource IS an "and gate". you seem to be using it as a relay.

    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.
  • venomusvenomus Join Date: 2002-11-16 Member: 8951Members
    I figured it out in 2 minutes this morning. Sleep rocks <!--emo&;)--><img src='http://www.unknownworlds.com/forums/html/emoticons/wink.gif' border='0' style='vertical-align:middle' alt='wink.gif'><!--endemo-->

    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.
  • YamazakiYamazaki Join Date: 2002-01-24 Member: 21Members, NS1 Playtester, Contributor
    edited May 2003
    Usinf func_buttons and multisources together is problematic. There are issues where the multisource holds the wrong value because of a bug in how it works with func_buttons. The best state storing system is env_global.

    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.
  • venomusvenomus Join Date: 2002-11-16 Member: 8951Members
    edited May 2003
    Yes, I am using env_globals to store control the states (one for on, one for off). I have heard of other ways to set global states, but never used them.


    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.
Sign In or Register to comment.