| 05-16-2006, 06:26 AM | #1 |
JASS:function Trig_Liquid_Shield_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A03S' endfunction function Liquid_Shield_Child takes nothing returns nothing local trigger trig = GetTriggeringTrigger() local unit targ = GetTriggerUnit() local real dam = GetEventDamage() local real damage = GetHandleReal(trig,"damage") local real ish = dam*((GetHandleInt(trig,"lvl")*.1)+.1) call SetUnitState(targ,UNIT_STATE_LIFE,GetUnitState(targ,UNIT_STATE_LIFE)+ish) call SetHandleReal(targ,"damage",damage+ish) set targ = null set trig = null endfunction function Liquid_Shield_Filter takes nothing returns boolean return IsUnitAlly(GetFilterUnit(),bj_groupEnumOwningPlayer)==false endfunction function Trig_Liquid_Shield_Actions takes nothing returns nothing local unit u = GetTriggerUnit() local unit targ = GetSpellTargetUnit() local unit dum local integer lvl = GetUnitAbilityLevel(u,'A03S') local trigger trig = CreateTrigger() local timer t = CreateTimer() local effect sfx = AddSpecialEffectTarget("Defensive Barrier big.mdx",targ,"chest") local real damage = 0 local group g = CreateGroup() local boolexpr b = Condition(function Liquid_Shield_Filter) call TriggerRegisterUnitEvent(trig,targ,EVENT_UNIT_DAMAGED) call TriggerAddAction(trig,function Liquid_Shield_Child) call TimerStart(t,10.+(2*lvl),false,null) call SetHandleReal(trig,"damage",damage) call SetHandleInt(trig,"lvl",lvl) loop exitwhen TimerGetRemaining(t)<=.1 call TriggerSleepAction(.1) call BJDebugMsg(R2S(TimerGetRemaining(t))) endloop call PauseTimer(t) call DestroyTimer(t) set damage = GetHandleReal(trig,"damage") call FlushHandleLocals(trig) call DestroyTrigger(trig) call DestroyEffect(sfx) set bj_groupEnumOwningPlayer = GetOwningPlayer(targ) call GroupEnumUnitsInRange(g,GetUnitX(targ),GetUnitY(targ),400,b) set damage = damage/CountUnitsInGroup(g) call BJDebugMsg(R2S(damage)) loop set dum = FirstOfGroup(g) exitwhen dum == null call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl",dum,"origin")) call UnitDamageTarget(targ,dum,damage,false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,null) endloop set u = null set targ = null set trig = null set t = null set sfx = null call DestroyGroup(g) set g = null call DestroyBoolExpr(b) set b = null endfunction //=========================================================================== function InitTrig_Liquid_Shield takes nothing returns nothing set gg_trg_Liquid_Shield = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Liquid_Shield, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( gg_trg_Liquid_Shield, Condition( function Trig_Liquid_Shield_Conditions ) ) call TriggerAddAction( gg_trg_Liquid_Shield, function Trig_Liquid_Shield_Actions ) endfunction creates a shield that absorbs a % damage taken for x seconds, at the end the damage reduced is distributed among enemies in the area it makes it half way throguh the spell, up to the point where the timer runs out, then it freezes WC3, any ideas? |
| 05-16-2006, 09:14 AM | #2 |
I don't know about JASS very much but i think that your problem is here. JASS:loop exitwhen TimerGetRemaining(t)<=.1 call TriggerSleepAction(.1) call BJDebugMsg(R2S(TimerGetRemaining(t))) endloop And you don't need to pause a timer, if you destroy it right after,... or do you?? |
| 05-16-2006, 10:33 AM | #3 |
JASS:loop set dum = FirstOfGroup(g) exitwhen dum == null call DestroyEffect(AddSpecialEffectTarget("Objects\\Spawnmodels\\Naga\\NagaDeath\\NagaDeath.mdl",dum,"origin")) call UnitDamageTarget(targ,dum,damage,false,false,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_NORMAL,null) endloop Also, it would be probably better if you split your main function into two, and have the timer run the second one when it expires. True, you would need to store more handle variables in order to pass data between the two functions, but you wouldn't have to have a thread contantly running and checking if the timer has already expired. |
| 05-16-2006, 03:16 PM | #4 |
thnx, yea im a tard, i shoulda realized that when it only crashed if u were near creeps at the end of the timer |
| 05-16-2006, 04:18 PM | #5 | |
Quote:
Yes, you do. |
| 05-16-2006, 08:59 PM | #6 |
If you dont pause a timer before destroying it, odd things can happen to your map ingame ![]() |
| 05-17-2006, 01:58 AM | #7 | |
Quote:
|
| 05-17-2006, 09:20 AM | #8 | |
Quote:
|
