It doesn't matter wether you use gold,lumber,items with charges,leaderboard, or whatever else you can come up with.
It will still take your ammo when you are starting to shoot because the event "A Unit is Attacked" refers to when the unit STARTS to attack.
If you want him to actualy attack you need a damage detection system.
If he will do that trigger, I am sure that if the attack missed, the lumber/ammo of the owner of unit will not be deducted.