More logic questions

Discussion in 'Mapping Questions & Discussion' started by Riever, Jul 14, 2012.

  1. Riever

    Riever L2: Junior Member

    Messages:
    86
    Positive Ratings:
    0
    Dear all,

    Although I am still stuck on my previous problems :confused: ( http://forums.tf2maps.net/showthread.php?t=19697 ) I wonder if someone can help with the following.

    I have two math counters (1 and 2) and each store 0-6.

    At a particular point in the game I want 2 capture points (A and B) to be enabled depending on the values in the counters.

    If counter 1 and counter 2 are both less than 5 activate Cap Point A
    If counter 1 and counter 2 are both equal to or greater than 5 activate Cap Point B

    If counter 1 is < 5 and counter 2 is =>5 activate A to be capped by blue and B to be capped by red.

    If counter 2 is =>5 and counter 2 is <5 activate A to be capped by red and B to be capped by blue.

    It that wasn't complex enough the counters are tested elsewhere by using get_value and so I cannot use this to start above tests as I only want them to run at one point in the map.

    I've played around with duplicated counters and logic_cases and just ended up with non-working spaghetti. :(

    So could anyone please suggest a way to even start on this.

    I live in hope...
     
  2. A Boojum Snark

    aa A Boojum Snark Toraipoddodezain Mazahabado

    Messages:
    4,767
    Positive Ratings:
    5,508
    You will need one additional math_counter, four logic_branch, and three logic_case.

    logic_case
    names: case_one & case_two
    case04: 4
    case05: 5

    logic_branch
    names:
    • branch_one_uptofive
    • branch_one_downtofour
    • branch_two_uptofive
    • branch_two_downtofour
    intitial value: 0, assuming your two counters start at 0. If not, and you aren't sure how to set them, let me know.

    math_counter
    name: counter_total

    logic_case
    name: case_counterstate
    case01: 1
    case02: 2
    case03: 3
    case04: 0
    (when dealing with numbers like this, I prefer to put zero at the end so the rest match up to the key and output)


    Set up the following outputs:

    Column 1 Column 2 Column 3 Column 4 Column 5
    Source Entity Output Target Entity Input Parameter
    counter_one OutValue case_one InValue
    counter_two OutValue case_two InValue
    case_one OnCase04 branch_one_uptofive SetValue 1
    case_one OnCase04 branch_one_downtofour Test
    case_one OnCase05 branch_one_uptofive Test
    case_one OnCase05 branch_one_downtofour SetValue 1
    case_two OnCase04 branch_two_uptofive SetValue 1
    case_two OnCase04 branch_two_downtofour Test
    case_two OnCase05 branch_two_uptofive Test
    case_two OnCase05 branch_two_downtofour SetValue 1
    branch_one_uptofive OnTrue !self SetValue 0
    branch_one_uptofive OnTrue counter_total Add 1
    branch_one_downtofour OnTrue !self SetValue 0
    branch_one_downtofour OnTrue counter_total Subtract 1
    branch_two_uptofive OnTrue !self SetValue 0
    branch_two_uptofive OnTrue counter_total Add 2
    branch_two_downtofour OnTrue !self SetValue 0
    branch_two_downtofour OnTrue counter_total Subtract 2
    counter_total OutValue case_counterstate InValue


    Keeping track of four states (two things with "on/off") is easy enough, but this got more complicated because your on and off is actually 7 different states. When counter one is "on" (5 or more) it counts as a value of 1 in counter_total. When counter two is on, it counts as 2. This provides us with four unique values for the four states you want to use.

    The mess of logic_branch stuff was required to ensure the total count only changes when going in the right direction. We want to add when going from 4 to 5, but not when going from 6 to 5. Likewise when going to 4.

    Finally, the outputs for case_counterstate:
    OnCase01: value of 1, (1+0) counter_one is above four. Use this for A red, B blu.
    OnCase02: value of 2, (0+2) counter_two is above four. Use this for A blu, B red.
    OnCase03: value of 3, (1+2) both are above four. Use this for B active.
    OnCase04: value of 0, (0+0) both are below five. Use this for A active.
     
    • Thanks Thanks x 1