How Do I Disable A Node For An Individual Object Instance?

Discussion in 'How Can I...?' started by Sundae, Sep 27, 2020.

  1. Sundae

    Sundae Boxer

    Joined:
    Apr 24, 2019
    Messages:
    2
    Likes Received:
    0
    When an Enemy gets within X units of the player, it begins to chase the player. When the player touches the enemy, the enemy goes flying/spinning into the air, then is destroyed after a delay node completes.

    Once touched, the Chase node is disabled so that the enemy doesn't try to fly back to the player while it's being killed. (It was doing that.)

    The Chase node works by measuring distance from enemy to player, then using a vector3 around its defined x/y/z speeds to send it in the direction of the player. It's not perfect but good enough for a prototype.

    Problem: Disabling the Chase node on the flowchart disables it for every instance of the enemy, including new ones that are spawned in. The untouched enemies should still continue to chase.

    Question: I'm new to BuildBox. Can someone explain to me what I need to change in order to only apply the deactivation to a single instance of the enemy (e.g., only the individual enemy the player touched) instead of applying it to every enemy?

    Thanks a bunch. :)
     
  2. Sundae

    Sundae Boxer

    Joined:
    Apr 24, 2019
    Messages:
    2
    Likes Received:
    0
    I meant to include the flowchart for reference's sake. See below...

    [​IMG]
     
  3. Josh (Nology Games)

    Josh (Nology Games) Avid Boxer

    Joined:
    Nov 27, 2017
    Messages:
    200
    Likes Received:
    155
    I'm still new to coding, but I do know the problem. The Disable script needs to be edited so that it works only on "this.entity()". Could you show the script so that we may be able to help you?.
     
  4. mohamed awad

    mohamed awad Avid Boxer

    Joined:
    Mar 10, 2019
    Messages:
    315
    Likes Received:
    158
    if ChasePlayer node inside one enemy affects all enemies, then it must have a global variable like Settings
    so you have to change this variable to local
    as Josh (Nology Games) says...
    Could you show the script so that we may be able to help you?.
     
    Josh (Nology Games) likes this.

Share This Page