| 07-22-2008, 07:03 PM | #1 |
Hi guys, I was making my multiboard system, when I notest that my kill counter was not increasing (keeps track of units I kill). Why ?? Well, if a unit dies while being devoured by a Kodo beast or, in the case a dragon, the "Unit Dies Event" won't be fired .... Is there a way for me to fix this bug ?? can anyone help me ?? =S I was thinking of keeping track of the unit, but for that I would have to build up a system using Table or PUI =S Is there a simpler way ? |
| 07-22-2008, 07:13 PM | #2 |
how about triggering the devour-spell? just base it off the already existing devour, and simply change the damage per second to 0 and deal it yourself. |
| 07-22-2008, 07:43 PM | #3 |
If this is MPI then try to catch the event "when a unit casts devour" then get the devoured unit and do your stuff on the unit, if this is meant to be MUI then just use PUI together with a kill counter system. |
| 07-23-2008, 02:51 PM | #4 |
Ok guys, this is what I made ... and now it works !!! thx guys =) +rep JASS://=========================================================================== //A triggered version of the spell Devour. This way if a unit dies while being //devoured, it will fire the "UNIT_DIES" event. // //vJASS spell //Requires CSData and CSSafety // //@author Flame_Phoenix // //@credits //- Blubb-Tec, chobibo //- My first teacher of vJASS: Blue_Jeans //- All other people I forgot or ignored // //@version 1.0 //=========================================================================== scope Devour initializer Init //=========================================================================== //=============================SETUP START=================================== //=========================================================================== private constant function SpellIds takes nothing returns boolean return (GetSpellAbilityId() == 'Adev') or (GetSpellAbilityId() == 'A00V') endfunction private constant function Damage takes nothing returns real return 5. endfunction private constant function Cycle takes nothing returns real return 1. endfunction //=========================================================================== //=============================SETUP END===================================== //=========================================================================== private struct MyStruct unit caster unit target timer t static method create takes unit caster, unit target returns MyStruct local MyStruct data = MyStruct.allocate() //set variables set data.caster = caster set data.target = target set data.t = NewTimer() return data endmethod method onDestroy takes nothing returns nothing call ReleaseTimer(.t) endmethod endstruct //=========================================================================== private function Effect takes nothing returns nothing local MyStruct data = MyStruct(GetCSData(GetExpiredTimer())) if (GetWidgetLife(data.caster) > 0.405) and (GetWidgetLife(data.target) > 0.405) then call UnitDamageTarget(data.caster, data.target, Damage(), false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_UNIVERSAL, null) else call data.destroy() endif endfunction //=========================================================================== private function Conditions takes nothing returns boolean local MyStruct data if (SpellIds()) then set data = MyStruct.create(GetTriggerUnit(), GetSpellTargetUnit()) //we attach the struct to the timer call SetCSData(data.t, integer(data)) call TimerStart(data.t, Cycle(), true, function Effect) endif return false endfunction //=========================================================================== private function Init takes nothing returns nothing local trigger DevourTrigger = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(DevourTrigger, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition(DevourTrigger, Condition( function Conditions ) ) set DevourTrigger = null endfunction endscope |
| 07-23-2008, 04:28 PM | #5 |
When an unit has a custom ability (or a native one) with these originals strings values (not edited ones) for the Order String Off (Unorder) : - "undefend" - "magicundefense" The unit receive these immediate order one time when she dead and second time when she disappear. And his life at this moment == 0. Btw she receive first the ability added the last time then the preview and so one. I dunno if they are other abilities like them . If the abilities are deactivated for the unit owner player, the unit will receive the order anyway. But if a technology requirement is needed and the owner player hasn't it, then the unit won't get the order. So you can easily make a dummy ability with no technology requirement, deactivated it for all players and add it to a unit when she enter in the map. Then it's pretty easy to detect his die and end of decay. It's useful (or not) for systems but not really for what you want, because you can't really get the unit killer. Or maybe in his case the kodo beast and the unit have exactly the same position ? I didn't try. |
