Direction Based Line of Sights

● ARCHIVED · READ-ONLY
Started by Candacis 3 posts View original ↗
  1. Okay, so I've tried to do this tutorial:

    http://ccrgeek.wordpress.com/ways-to-use-scripts-2/direction-based-line-of-sight/ from the Candy Coded Blog. I chose a triangular line of sight and it works, but I want to create an event where something happens, if the player is discovered AND something different if the player is not discovered. It is an action button event. Basically the player interacts with the event and if he is spotted something different happens.

    But I just can't figure out how to go about it. Every conditional branch I tried delivered not the result I wanted.

    Here is the conditional branch for, if the player is spotted. First condition:

    ($game_map.events[5].y - $game_player.y).abs <= 4 && ($game_map.events[5].x - $game_player.x).abs <= 1 || ($game_map.events[5].x - $game_player.x).abs <= 4 && ($game_map.events[5].y - $game_player.y).abs <= 1Nested in that is the second condition:

    $game_map.events[5].direction == 2 && $game_map.events[5].y < $game_player.y || $game_map.events[5].direction == 8 && $game_map.events[5].y > $game_player.y || $game_map.events[5].direction == 4 && $game_map.events[5].x > $game_player.x || $game_map.events[5].direction == 6 && $game_map.events[5].x < $game_player.xThe 5 is the NSC Event that is moving around. This works as intended, player gets spotted. But where and how would I put conditional branches to trigger something if the player does not get spotted? I also attached a file from my event.

    Would be happy, if someone could help me out on how to do this right.

    spotted.png
  2. The logic in your event seems bizarre to me, but I'll leave that aside for now and assume that it's doing what you want it to.  You asked where to run event processing if those conditions are NOT met, right?  In the options for every conditional branch (highlight the branch and hit Spacebar), there is an option for "Set handling when conditions do not apply".  Make sure that checkbox is checked, and you'll receive an "Else" branch for when the conditions are not met.

    If BOTH of those branches need to be true for the player to be spotted, then place the "not spotted" handling inside BOTH else branches.  If EITHER of those branches need to be true for the player to be spotted, then place the entire second conditional branch inside the first "Else" branch, and copy the "Spotted" handling into each conditional's "if" branch; finally, run the "not spotted" handling inside the second "Else" branch.

    So like this if BOTH need to be true to be spotted:

    If (condition 1)

    If (condition 2)

    Spotted Handling

    Else

    Not Spotted Handling

    End (for cond 2)

    Else

    Not Spotted Handling

    End (for cond 1)

    Or like this if EITHER need to be true to be spotted:

    If (condition 1)

    Spotted Handling

    Else

    If (condition 2)

    Spotted Handling

    Else

    Not Spotted Handling

    End (for cond 2)

    End (for cond 1)
  3. Well, let me explain the bizzare event ;)

    There is a plate of food an a table, this is the event where this whole conditional branch is in it. If the player is not spotted, you can eat something from the plate, but if he is spotted, he can't eat from the plate and gets scolded. I know, a stupid event :D

    Yes, both conditions need to be true. I will try out your suggestion, thank you!