What trigger is it on, are you summoning minions or something with an item. If its a custom entity it should be pretty easy like this:
Obviously replace Wolf with your custom mob. If the entity your spawning could also be fighting you/ in the same area. Then make a seperate entity being the tameable one that spawns.
I put two if statements because I dont know what your trigger is but the tamed by will be either event/target entity or source entity (being the player).
Use the block: [Tame (event/target entity) by (source entity)], where event/target entity is the mob and the source entity is the player.
how to do this
What trigger is it on, are you summoning minions or something with an item. If its a custom entity it should be pretty easy like this:
Obviously replace Wolf with your custom mob. If the entity your spawning could also be fighting you/ in the same area. Then make a seperate entity being the tameable one that spawns.
I put two if statements because I dont know what your trigger is but the tamed by will be either event/target entity or source entity (being the player).