Overlaps & Collide won't change bolean

amigoniamigoni Member Posts: 78
edited November -1 in Tech Support
When you have overlap or Collide with another actor change a bolean variable from true to false or viceversa. It doesn't seem to work. It works well with other behaviours such as change attribute or speed.

Comments

  • scitunesscitunes Member, Sous Chef Posts: 4,047
    I was going nuts with a similar issue and when I changed the physics to movable my collision detection began working properly. Problem is I want good collision detection but I DONT want the actor in question to be movable. This was never a problem before!

    Gendai - please fix this!
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    I don't see a problem with this.

    @amigoni You are probably seeing an issue with boolean because it sees a collision/overlap event, so if your rules inside checks if the boolean is true, then it changes it to false, but then it sees that the attribute is false, so it changes it to true...etc. It would be best to use just the Change Attribute behavior using an integer as the flip switch.

    @scitunes I've tried this on every type of attribute with both it being movable and not movable. And it seems to work just fine for me.
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    I'm an idiot - that's you're problem. You need to pretend you are an idiot and then you'll have my problems.

    ;)

    I had a zombie actor that was eating the brains of another actor. I wanted to be sure that this only happened when the hands of the zombie were over the victims head so I had the zombie spawn an invisible actor that overlaps with the hands. The rule was when inv actor overlaps with victim do blah blah blah. Well both the victim and the spawned inv actor were set to non-movable. Once I changed the inv to movable everything worked fine.
  • LifireLifire Member Posts: 9
    Zombie post, I know, but CodeMonkey I was hoping you could explain your above post (the difference between using a bool in this case versus a 0, 1 integer setup)?

    if a = 1, change a to 0
    if a = 0, change a to 1

    is the same as:

    if a = true, change a to false
    if a = false, change a to true

    I feel like I'm missing something... Thanks!
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    You don't need to check if an attribute is 0 or 1. You just change the value using an equation such as this:

    game.Switch = 1 - game.Switch

    Rules that are active will continue to check values.

    Analogy:
    Take a normal coin. When you are told to flip it over, you just flip it over. You don't say, is it heads? Flip it to tails. At the same time you are checking if it is tails, you flip it to heads.
Sign In or Register to comment.