| 02-15-2004, 05:45 PM | #1 |
I need to make a trigger that launch when a unit is hit I've tried "Unit is attacked" trigger, but a unit is only considered "attacked" when you click on it, so when your unit continues to attack it, it doesn't count Another solutionI thought about was "Unit Takes damage", but it doesn't allow variable, the unit needs to be present on the map in the beginning Can anyone help me??? |
| 02-15-2004, 06:01 PM | #2 |
[edit] This post was obsolete - way over the top for what was needed here :P. |
| 02-15-2004, 09:23 PM | #3 |
HAHAHAHAHAHAhahahahahahah EZ!!11.... erm... nevermind.Anyway i have an idea that doesnt require jass. check it out! erm... yes, it does require 2 triggers. but who cares? Events: Time elapsed - Time elapsed is exactly 1 second Actions: set variable unitHP to integer(([some unit]) current HP) -trigger 2- Conditions integer comparison - [b]integer(([some unit]) current HP) doesnt equal unitHP Actions set variable unitHP to [some unit]'s current HP (do whatever you have to do when they are attacked game - display message: aaaaah, they were attacked!!!1 p.s. the parts in bold are a conversion from real to integer. Anyway, no jass and the trigger works fine. have fun:ggani: EDIT::: I just realized that this trigger would go off like a rocked (very bad metaphor not intended) when you were poisoned. Just make sure to check the status of the unit before the trigger goes off. |
| 02-15-2004, 10:56 PM | #4 |
Do you mean Time Elapsed or Periodic 1 sec??? |
| 02-16-2004, 12:35 AM | #5 |
Time elapsed, because it sets the initial HP of the unit and should only do it once. |
| 02-16-2004, 12:55 AM | #6 |
A bit hyper, johnfn? :P Elven - what he's suggesting might do it for you, but it's one hell of a cheap, cheap hack :) Since I take it you're not a JASS guy at all then, you might be able to get away with: Event Unit - A unit Is attacked From there, check if the "Attacking Unit" is equal to the type of unit that you want to fire the trigger from... and then reference that unit using "Attacking Unit" from thereon in :). |
| 02-16-2004, 02:32 AM | #7 |
Umm... just use: Unit takes damage Unless of course the guy is invincible or something. You don't need to do all these complex things.... |
| 02-16-2004, 02:35 AM | #8 | |
..... Quote:
|
| 02-16-2004, 02:40 AM | #9 |
Um, the event Unit is attacked works just fine for me. I've used a couple triggers that have actions that are required to go off every time a certain unit is attacked and it works great. Just make sure you use event response - attacking unit to refer to the unit doing the attacking, and event response - attacked unit to refer to the one being attacked. Its really simple ^_ |
| 02-16-2004, 02:47 AM | #10 |
It does allow variables, once the variable has been set use this action: Add to (Takes Damage Trigger) the event (Unit - UnitVariable Takes damage) To create this action: Trigger - Add New Event Event -> Specific Unit Event -> Unit takes Damage . |
