Check for alive friendly non-structure units in the range of the caster, create temporary dummy, add invisibility-ability to it, make it cast the invisibility to the picked unit.
If you're unfamiliar with using dummies, feel free to ask
Example
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to <Your ability>
Actions
Set Unit_Caster = (Triggering unit)
Set Player_Owner = (Owner of Unit_Caster)
Set Point_CasterPosition = (Position of Unit_Caster)
Custom script: set bj_wantDestroyGroup = true
Unit Group - Pick every unit in (Units within <Your range> of Point_CasterPosition matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an ally of Player_Owner) Equal to True) and (((Matching unit) is A structure) Equal to False)))) and do (Actions)
Loop - Actions
Unit - Create 1 <Your dummy> for Player_Owner at Point_CasterPosition facing Default building facing degrees
Unit - Add <Your invisibility spell> to (Last created unit)
Unit - Order (Last created unit) to Human Sorceress - Invisibility (Picked unit)
Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
Custom script: call RemoveLocation(udg_Point_CasterPosition)
Edit: I think this is an ok dummy:
dummy.rar (4.8 KB)
well, since the dummies you use to make the units invisible are also units and they die after 3 seconds (see expiration timer in the trigger) they will also trigger your gold-drop-trigger. what you just have to do is to check in your gold-drop-trigger if the dying unit is a dummy or not, if it is you just end the trigger, or set the chance to 0%.
Just like jopi said, run the gold giving units through a filter where you filter out units of type <Your dummy>.i have triggers that have a chance to create gold when units die. Now if i use the ability it drops 1 gold piece for every unit that get the invisibilty.
By the way, I just gave you an inefficient trigger, I didn't know the (Last created unit) runs through function call,
change the enum to this:
Unit Group - Pick every unit in (Units within <Your range> of Point_CasterPosition matching ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an ally of Player_Owner) Equal to True) and (((Matching unit) is A structure) Equal to False)))) and do (Actions)
Loop - Actions
Unit - Create 1 <Your dummy> for Player_Owner at Point_CasterPosition facing Default building facing degrees
Set Unit_Dummy = (Last created unit)
Unit - Add Invisibility to Unit_Dummy
Unit - Order Unit_Dummy to Human Sorceress - Invisibility (Picked unit)
Unit - Add a 3.00 second Generic expiration timer to Unit_Dummy
Just like jopi said, run the gold giving units through a filter where you filter out units of type <Your dummy>.
Edit: Can you post the gold bounty triggers here?