| 07-12-2007, 10:51 AM | #1 |
Hey wc3. I want to create my own attack system in warcraft. The problem is there isn't any event like "any unit takes damage". So I will use the orb + buff method, to detect when a units get hit. My problem is: I cant find any good way to check if an unit have the buff. So does anyone know a good way to detect if unit x have buff x? Thanks. |
| 07-12-2007, 10:56 AM | #2 |
Using an timer that checks for the buff? -Av3n |
| 07-12-2007, 11:00 AM | #3 |
does the condition (triggering unit) has buff of type (buff type) equal to true help? because that's in there. i'm not completely sure what it is you're trying to do though. ![]() |
| 07-12-2007, 11:42 AM | #4 |
Av3n: I cant see how I can use the timers to get this to work? btw I dont know how to use the timers. Maximilianx: Thanks, but the condition isnt my problem. Sorry if I wasn't clear enouqh. What im looking for is somekind of event that will detect if unit have a buff. Something like the trigger below. JASS:function Trig_Unit_Has_Buff_Actions takes nothing returns nothing if GetUnitAbilityLevel(u,'B000) > 0 then //Do something endif endfunction //=========================================================================== function InitTrig_Unit_Has_Buff takes nothing returns nothing set gg_trg_Unit_Has_Buff = CreateTrigger( ) call TriggerRegisterTimerEventPeriodic( gg_trg_Unit_Has_Buff, 0.10 ) call TriggerAddAction( gg_trg_Unit_Has_Buff, function Trig_Unit_Has_Buff_Actions ) endfunction |
| 07-12-2007, 01:00 PM | #5 |
Oh, you mean an event "unit receives a buff"? Nope, nothing of that sort exists. The way I did it (back in my GUI times when I didn't want to use the damage event) was with a periodic trigger that checked all units for the buff every 0.04 seconds, so I always detected the buff only a moment after it was created. It wasn't 100% (for example, what if two attackers with the buff-on-attack hit the same unit within those 0.04 seconds), but close enough. Using the unit takes damage event is better though. Edit: oh, you already have something like that set up. What's the problem then? |
