Make unit attack another unit when there was no issued order.

romanandre

New Member
Reaction score
2
I want unit A to attack unit B target when unit B automatically without ordering unit B to attack.
Just a exemple.
Unit B is in "aggro" range of creep and unit B automatically attack the creep , I want the Unit A to attack the same target , can anyone help.
I almost got that with this code.
function Trig_Shadow_Orbs_3_Actions takes nothing returns nothing
call IssueTargetOrder( udg_AvatarUnit, "attack", GetTriggerUnit() ) // this unit is probaly the problem
endfunction

//===============================================================
function InitTrig_Debug_Order_1 takes nothing returns nothing
set gg_trg_Debug_Order_1 = CreateTrigger( )
call TriggerRegisterUnitEvent( gg_trg_Debug_Order_1, udg_AvatarCaster, EVENT_UNIT_ACQUIRED_TARGET )
call TriggerAddAction( gg_trg_Debug_Order_1, function Trig_Shadow_Orbs_3_Actions )
endfunction

Sometimes the unit A attack another unit and sometimes unit A doesn't even move.
Thanks for helping, any questions just ask.
 

dudeim

New Member
Reaction score
22
Well change the GetTriggerUnit() to GetEventTargetUnit() then it should attack the target but it won't be perfect.
If you want a threat system you better download one from here or one of the other wc3 sites.
 

romanandre

New Member
Reaction score
2
I don't realy want it to use for a threat system but thanks for help , I will try with GetEventTargetUnit().
If anyone know a better solution , help if possible :)
+rep
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top