• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

[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 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,243
  • 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: 84
Status
Not open for further replies.
Top