No announcement yet.

Cant reference enemy for is attacking variable.

  • Filter
  • Time
  • Show
Clear All
new posts

    Cant reference enemy for is attacking variable.

    Essentially i am trying to program a health system for a game and i want to delineate an attack vs a hit. A attack which means the enemy's is attacking Boolean is true does 10 damage whereas a hit is 5. This blueprint is the enemy sword so that that sword with special properties will snap to the enemy and do damage to the player so that if the AI was using the regular sword it wouldn't do damage to allies nor to itself. Aside from that quick explanation as you can see in the blueprint below you need to return true or false based on the condition that the AiIsAttacking variable is true. To do this you have to make a reference to enemy and call the AiIsAttacking variable to plug into the branch. Now this doesn't work because then the object tick is left blank because you are unable to call the enemy volume unlike the player volume. Also i figured that if AiIsAttacking is a global variable meaning able to be referenced in other blueprints that you could reference it here but unfortunately i don't know how to do that. Any solution would be helpful thank you.

    I'm having hard time understanding the concept behind this. Maybe because it's so early for me. You want to delete that cast on event tick. Casting every frame of the same doesn't sound like a good idea in the first place.
    I think what you could trying using these two nodes below. First one will apply damage to a target (say on overlap - when your sword hits the target), and then on the receiving end (your character/other ai) you run Event Any Damage. You can then check who hit you or what hit you and based on that you do subtract from you health.

    I can produce an example if you need one.
    Attached Files