| 10-20-2006, 03:56 AM | #1 |
I was making a charged ability and it was based off a channel and fired off when you stopped channeling, that is, did anything else but continue, dealing whatever charged damage you had stored. However, i don't want anything to fire if you were stopped by some other hero or effect, such as a pushback or stun (which is really the equivilant). How can i detect when you're unintentionally stopped, and when intentionaly stopped. |
| 10-20-2006, 12:47 PM | #2 |
It's a case-by-case issue. If you use a single dummy ability to custom stun a unit, then you you could detect the casting of said spell. If you have a custom pause function, you could simply figure out when that runs. Otherwise there is no EVENT_PLAYER_UNIT_STUNNED or anything of the sort. How to do it is entirely based on your map and how you do things. |
| 10-20-2006, 02:37 PM | #3 |
One way of checking that works for me is to look at the unit's buffs. Here is a custom script I have to return true or false. JASS:function unitIsStunned takes unit target returns boolean if GetUnitAbilityLevel(target, 'BPSE')>0 then return true elseif GetUnitAbilityLevel(target, 'BUsl')>0 then return true elseif GetUnitAbilityLevel(target, 'BNsi')>0 then return true elseif GetUnitAbilityLevel(target, 'BEer')>0 then return true elseif GetUnitAbilityLevel(target, 'BUim')>0 then return true elseif GetUnitAbilityLevel(target, 'Btsp')>0 then return true elseif GetUnitAbilityLevel(target, 'BOhx')>0 then return true endif return false endfunction Those are all default buff's in the object editor. I didn't change them. So far I have had 0 trouble by using all those. You could also register an event to the trigger using EVENT_UNIT_SPELL_ENDCAST. I just started using that in some new work I've been doing which seems to detect stun, stop, hold, movement during channel, all that good stuff. Thanks to Vex and BDSM for the that Event I didn't know about before. Between those 2 things, you should be able to get it working. |
| 10-20-2006, 11:43 PM | #4 |
There is a special order that is issued to a unit by the game engine when it gets stunned. It's a unit target order that is issued to the stunned unit and it targets the stunning unit. You could detect this order, it has no orderstring but it has an order ID. Note: if the unit is already stunned, then it receives no orders at all, so this method will not detect stun effects on already stunned units - however, you don't need that anyway. |
| 10-20-2006, 11:47 PM | #5 |
Ah, very good. Mine works, but that would be even better. I'll have to run a BJDebug msg and see what the order Id is. |
