| 12-31-2006, 08:05 PM | #1 |
I have this spell, and somehow it dont want to work... JASS:function Trig_Maim_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A00O' endfunction function Maim_Damage takes nothing returns nothing local timer t = GetExpiredTimer() local unit caster = GetHandleUnit( t, "caster" ) local unit target = GetHandleUnit( t, "target" ) local real dmgtaken = GetHandleReal( t, "dmgtaken" ) local real currentlife = GetHandleReal( t, "currentlife" ) local real secdamage = GetHandleReal( t, "secdamage" ) local real damage local integer count = GetHandleInt( t, "count" ) local unit dummy local real x = GetUnitX( target ) local real y = GetUnitY( target ) local effect fx if count < 5 and GetUnitState( target, UNIT_STATE_LIFE ) >= 0.405 then set dummy = CreateUnit( GetOwningPlayer( caster ), 'h000', x, y, 0 ) set dmgtaken = dmgtaken+( currentlife-GetUnitState( target, UNIT_STATE_LIFE ) ) set currentlife = GetUnitState( target, UNIT_STATE_LIFE ) set damage = damage+( dmgtaken/100*25 ) call UnitDamageTarget( dummy, target, damage, true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS ) call UnitDamageTarget( dummy, target, secdamage, true, true, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS ) call SetHandleInt( t, "count", count+1 ) call SetHandleReal( t, "dmgtaken", dmgtaken ) call SetHandleReal( t, "currentlife", currentlife ) call SetHandleReal( t, "damage", damage ) call RemoveUnit( dummy ) set dummy = null call AddSpecialEffectTarget( "Objects\\Spawnmodels\\Other\\BeastmasterBlood\\BeastmasterBlood.mdl", target, "chest" ) call DestroyEffect( fx ) set fx = null elseif count >= 5 or GetUnitState( target, UNIT_STATE_LIFE ) <= 0.404 then call FlushHandleLocals( t ) call PauseTimer( t ) call DestroyTimer( t ) set t = null endif set caster = null set target = null endfunction function Trig_Maim_Actions takes nothing returns nothing local timer t = CreateTimer() local unit caster = GetTriggerUnit() local unit target = GetSpellTargetUnit() local real currentlife = GetUnitStateSwap( UNIT_STATE_LIFE, target ) local real damage = 30+( 10*GetUnitAbilityLevel( caster, 'A00O' ) ) local real secdamage = 4+( 6*GetUnitAbilityLevel( caster, 'A00O' ) ) local effect fx call SetHandleHandle( t, "caster", caster ) call SetHandleHandle( t, "target", target ) call SetHandleReal( t, "dmgtaken", 0 ) call SetHandleReal( t, "currentlife", currentlife ) call SetHandleReal( t, "damage", 0 ) call SetHandleReal( t, "secdamage", secdamage ) call SetHandleInt( t, "count", 0 ) call TimerStart( t, 1.0, true, function Maim_Damage ) call UnitDamageTarget( caster, target, damage, false, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_WHOKNOWS ) call AddSpecialEffectTarget( "Objects\\Spawnmodels\\Other\\BeastmasterBlood\\BeastmasterBlood.mdl", target, "chest" ) call DestroyEffect( fx ) set fx = null set t = null set caster = null set target = null endfunction //=========================================================================== function InitTrig_Maim takes nothing returns nothing set gg_trg_Maim = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Maim, EVENT_PLAYER_UNIT_SPELL_CAST ) call TriggerAddCondition( gg_trg_Maim, Condition( function Trig_Maim_Conditions ) ) call TriggerAddAction( gg_trg_Maim, function Trig_Maim_Actions ) endfunction The problem is, that the function "Maim_Damage" dont want to work. Nothing in it seems to take effect at all. The spell is supposed to deal a few points of damage when casted, and then, every second it takes some damage + 25% of the total damage taken over the total period. However, for some wierd reason Maim_Damage dont seems to be executed... |
| 12-31-2006, 08:20 PM | #2 |
change JASS:EVENT_PLAYER_UNIT_SPELL_CAST JASS:EVENT_PLAYER_UNIT_SPELL_EFFECT |
| 12-31-2006, 08:24 PM | #3 |
Lol where did that one came from? Thanks. EDIT: The damage after the timer STILL dont want to work. Only the damage in the initiating func. |
| 12-31-2006, 09:38 PM | #4 |
EVENT_PLAYER_UNIT_SPELL_EFFECT isn't for the function, it's so that the trigger is executed properly when the spell takes effect, instead of when the hero does his animation thing (something like that). |
| 12-31-2006, 09:40 PM | #5 |
you are not assigning fx and the whole : "elseif count >= 5 or GetUnitState( target, UNIT_STATE_LIFE ) <= 0.404 then" is logically innecessary. What exactly do you mean with "the damage after the timer"? |
| 01-01-2007, 04:48 PM | #6 |
/Damage over time. The effects in the "Maim_Damage" function simply dont want to work. |
| 01-01-2007, 06:52 PM | #7 |
you arent initialating your damage var. then you try to iteriate it. JASS:local real damage set damage = damage+( dmgtaken/100*25 ) edit: to fix the problem: local real damage = 0 |
| 01-03-2007, 08:36 AM | #8 |
Ah, right... Forgot that var. Thanks. EDIT: It is easy forgetting some lines when you work on multiple spells at the same time... |
| 01-03-2007, 05:16 PM | #9 |
sure it is. and to solve that problem i just usually throw it away, starting on something new and more intresting. |
| 01-04-2007, 01:37 PM | #10 |
Well, its a spell for a hero in my hap... Whatever, thanks, it works now. |
