The next step in configuring the NPC to follow my player, was to construct a blueprint so that the AI could competently tell the distance it was from the player.
This needed a Function to be created within the character blueprint, from here a set of distance based branch decisions were placed, besed on the length of the vector drawn between the NPC and my player character.
For example, using a '<=' or '>=' float within the blueprint editor allows us to set a condition based on whether or not a distance is more than or equal to a specific number, and also less than or equal to a specific value.
Based on these values, Long, Mid and Close range were set and represented on screen in play in form of a print string, which would fire each "Long Range", "Mid Range" and "Close Range" call when the AI breaches the vector distance based condition plugged into the branches to determine at which range the play currently stands.
Below is a small snippet of my blueprint, showing the basic theory behind the work, in which if the distance is less than or equal to 999 units between the AI and the player, the branch then fires true, setting the range to close range and firing the appropriate print string to be displayed on screen.

No comments:
Post a Comment