How do I make an entity attack a random unit or player?

There is no function I can find to make an entity attack a random unit or player, can yall provide a script to make this happen?

2 Likes

man what i found that can make it work is:
every time a player join he will get a random number;
and on the script he gets a random number between 1 and the number of players that can join in the game (like the basic one is 32);
if the random number is = the selected player/entity number;
make ai attacks selected player/unit.

2 Likes

every sec trigger for the script, for all unit, if selected unit type == the entity who will attack name
command unit to move to target variable unit
attack function to target if there is one if there isnt one use
use item at angle of target


for all unit unit, if selected unit =/= the entity who will attack name
set variable unit target as selected unit