execute at @e[type=pig,tag=!nocusmob] run scoreboard players add i mob 1
execute at @e[type=pig,tag=!nocusmob] if score i mob matches 50.. run function rfi:mob/trader/trader
execute at @e[type=pig,tag=!nocusmob] run tag @e[distance=..1] add nocusmob