That script has 3 results inside the if; if can accept between 1-2 results,
(if <true> <then> [<else>])
For you, if the ai count is equal to zero, you're returning true. Otherwise, you're placing AI. Then you have one invalid statement afterwards that'll never read, about going to a vehicle.
If you remove that word, true, it will make it so AI will spawn when the count is zero, and if the first encounter is alive, it will send the second encounter to the turret.
I'm under the impression, that the script you're looking for is
(if (= (ai_living_count enc_1a) 0)
(begin
(ai_place enc_1)
(ai_go_to_vehicle enc_1/cannon tur1 "")
)
)
This categorizes both as what to do when its true, since the begin itself is what it sees for that, and everything else is just inside it.