• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Im having some trubble

Status
Not open for further replies.
Level 4
Joined
Jan 8, 2009
Messages
68
i want to create a trigger that does the following:

Unit A attackes Unit C, if Unit B also is attacking Unit C then do something.

please help me..

+rep
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
You need to be a bit more specific. What counts as attacking?

Would you be satisfied with a solution that checks if both A and B damage unit C within given time period?

I mean, unit B could be attacking/targeting unit D, but it causes some splash damage to unit C. Does that count?
 
Level 4
Joined
Jan 8, 2009
Messages
68
A and B are Heroes. but they dont have to be on the map since they can be bought. and they are bought sepreatly
C is any unit.
 
Level 10
Joined
Sep 21, 2007
Messages
517
hmm.. Gui ) Create 3 3 variables, one called UnitA, UnitB, UnitC, now set them to whatever youd like: next... Create a trigger and set event a unit is attacked and conditions attacking unit = unit A and attacked unit equal to C, now create a boolean variable called "BAttacked", then in that trigger you first created go to actions and do If BAttacked = true then // actions if unit B is attacked else // actions if unit B is not attacked
now last step....
create a trigger and a timer variable called TimerAttackB and in the new trigger set event A unit is attacked, condition if triggering unit equal to UnitB
then set the variable BAttacked = True and start the timer TimerAttackB as a non-periodiic timer that ends in 2-3 seconds (whichever number you prefer) and create the final trigger and set its event to TimerAttackB expires
and the action is set the variable BAttacked = False...

Phew. You better rep me for this!
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
  • Hit Test
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Attacking unit) Equal to Footman 0000 <gen>
          • (Attacking unit) Equal to Footman 0001 <gen>
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Attacking unit) Equal to Footman 0001 <gen>
        • Then - Actions
          • Set Temp_Unit_1 = (Attacked unit)
          • Set Temp_Boolean = True
        • Else - Actions
          • Set Temp_Unit_2 = (Attacked unit)
          • Set Temp_Boolean_2 = True
      • Countdown Timer - Start Temp_Timer as a One-shot timer that will expire in 3.00 seconds
      • Trigger - Turn on Expire <gen>
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Temp_Boolean Equal to True
          • Temp_Boolean_2 Equal to True
          • Temp_Unit_1 Equal to Temp_Unit_2
        • Then - Actions
          • Trigger - Turn off Expire <gen>
          • Set Temp_Boolean = False
          • Set Temp_Boolean_2 = False
          • Set Temp_Unit_1 = No unit
          • Set Temp_Unit_2 = No unit
        • Else - Actions
  • Expire
    • Events
      • Time - Temp_Timer expires
    • Conditions
    • Actions
      • Set Temp_Boolean = False
      • Set Temp_Boolean_2 = False
      • Set Temp_Unit_1 = No unit
      • Set Temp_Unit_2 = No unit
 

Attachments

  • test.w3x
    13.6 KB · Views: 83
Status
Not open for further replies.
Top