- Joined
- Sep 15, 2006
- Messages
- 426
Ok. #1: I am making a trigger for headshots, based off of a random number. Here is the trigger I have to randomize the number:
Problem #2:
I'm using a weapons system that replaces the unit with a different unit to change weapons, so I need a trigger to reset the unit when it drops its weapon. Here's what I have:
-
HS Random
-
Events
- Unit - A unit Is attacked
-
Conditions
- (Owner of (Triggering unit)) Not equal to Neutral Hostile
-
Actions
- Wait 0.10 seconds
- Set headshot[(Player number of (Owner of (Attacking unit)))] = (Random integer number between 1 and 30)
-
Events
-
Headshot
-
Events
- Unit - A unit Is attacked
-
Conditions
- (Owner of (Attacking unit)) Not equal to Neutral Hostile
- headshot[(Player number of (Owner of (Attacking unit)))] Equal to 1
- (Charges remaining in myGun[(Player number of (Owner of (Attacking unit)))]) Greater than 0
-
Actions
- Sound - Play headshot <gen>
- Game - Display to (All players) the text: ((|cff00ff00 + (Name of (Owner of (Attacking unit)))) + |r got a headshot!)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- Helmet[(Player number of (Owner of (Attacked unit)))] Equal to False
-
Then - Actions
- Unit - Cause (Attacking unit) to damage (Attacked unit), dealing (Random real number between 100.00 and 300.00) damage of attack type Hero and damage type Normal
-
Else - Actions
- Unit - Cause (Attacking unit) to damage (Attacked unit), dealing (Random real number between 50.00 and 100.00) damage of attack type Hero and damage type Normal
-
If - Conditions
-
Events
Problem #2:
I'm using a weapons system that replaces the unit with a different unit to change weapons, so I need a trigger to reset the unit when it drops its weapon. Here's what I have:
-
Drop
-
Events
- Unit - A unit Loses an item
-
Conditions
- (Unit-type of (Triggering unit)) Not equal to Marine [|cffff0000Unarmed|r] (No Weapon)
- (Item being manipulated) Equal to myGun[(Player number of (Owner of (Hero manipulating item)))]
-
Actions
- Set myGun[(Player number of (Owner of (Hero manipulating item)))] = No item
- Wait 0.01 seconds
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- myGun[(Player number of (Owner of (Hero manipulating item)))] Equal to No item
-
Then - Actions
- Unit - Replace (Hero manipulating item) with a Marine [|cffff0000Unarmed|r] (No Weapon) using The old unit's relative life and mana
- Selection - Add (Last replaced unit) to selection for (Owner of (Last replaced unit))
-
Else - Actions
- Do nothing
-
If - Conditions
-
Events