Hello, what is the best way to handle an NPC with fire capabilities, have it use raycast like the player or projectiles?
If i use raycast, will the AI almost always have a lock on the player, or will it be possible to avoid its fire?
What advantage does one have over the other, what disadvantage?

That’s more a design question than a technical question. It all depends on how your AI firing behaviour is going to be. Do you want the shot to hit immediately or will it take some time to get to the player? Do you want the player to be able to dodge the bullets? Do you want the enemy to be able to miss the shot?

You can use Raycast to have the NPC “lock” on the target, but that doesn’t mean it will hit him. The raycast can be used to get the direction of the bullet and then apply some math to make the shot miss. Or it can be used just to get the direction of the shot and then use it to apply some force. Or it can be an instant shot.

Same thing happens with a projectile, it can be fired and miss, but you can also attach some script that makes it follow the player to never miss.

As I said, this is first a design decision, then a logic and coding matter.