| 08-17-2006, 04:27 PM | #1 |
Hi, im having another spell problem. JASS:function Trig_Secret_Jutsu_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A003' endfunction function Secret_Jutsu_Effects takes nothing returns nothing local effect array efx local unit caster = GetTriggerUnit() set efx[1] = AddSpecialEffectTarget("Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl", caster, "origin") set efx[2] = AddSpecialEffectTarget("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl", caster, "origin") call TriggerSleepAction(1.) set caster = null call DestroyEffect(efx[1]) call DestroyEffect(efx[2]) endfunction function Trig_Secret_Jutsu_Actions takes nothing returns nothing local unit caster = GetTriggerUnit() local unit target = GetSpellTargetUnit() local real casterX = GetUnitX(caster) local real casterY = GetUnitY(caster) local timer effecttimer = CreateTimer() call PauseUnit(caster, true) call PauseUnit(target, true) call TimerStart(effecttimer, 0.50, true, function Secret_Jutsu_Effects) call TriggerSleepAction(3.00) call PauseTimer(effecttimer) call SetUnitAnimation(caster, "attack") call UnitDamageTarget(caster, target, 1000, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_CLAW_HEAVY_SLICE) call PauseUnit(caster, false) call PauseUnit(target, false) call DestroyTimer(effecttimer) set effecttimer = null set caster = null set target = null endfunction //=========================================================================== function InitTrig_Secret_Jutsu takes nothing returns nothing set gg_trg_Secret_Jutsu = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Secret_Jutsu, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( gg_trg_Secret_Jutsu, Condition( function Trig_Secret_Jutsu_Conditions ) ) call TriggerAddAction( gg_trg_Secret_Jutsu, function Trig_Secret_Jutsu_Actions ) call Preload("Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl") call Preload("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl") endfunction |
| 08-17-2006, 04:46 PM | #2 |
there is no trigger unit on Timer Expiration. |
| 08-17-2006, 04:49 PM | #3 |
So, how would i find the caster, if i didnt want to use the game cache? |
| 08-17-2006, 04:50 PM | #4 |
I believe that GetTriggerUnit is being called later in a seperate thread, so it's possible that it's returning null and not the caster. Try putting it in the same function as the other actions and see what happens. Edit: Vexorian beat me to it. Anyway, if you're opposed to using a gamacache you can use arrays, keep everything in the same function, or write a function that takes a unit and applies the effect to that unit. |
| 08-17-2006, 04:51 PM | #5 |
EDIT: Ok, i guees i will just do a loop :) Thanks alot both of you, +Rep! EDIT2: Im very sorry Naakaloh, but i cant give you rep right now, will as soon as i can :) Must spread some more before giving to you again xD |
| 08-17-2006, 04:54 PM | #6 |
I don't think it is up to likes and dislikes but to needs. |
| 08-17-2006, 04:58 PM | #7 |
TriggerSleepAction is very inaccurate, by the way. And to attach it to a timer you could use the TimerAttach function (search the forums). |
| 08-17-2006, 05:10 PM | #8 |
The CSCache 13.7 style: (won't use gamecache) JASS:function Trig_Secret_Jutsu_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A003' endfunction function Secret_Jutsu_Effects_T takes nothing returns nothing local effect efx1 local effect efx2 //Why alocate 4KB if you are only going to use 8 bytes?, no need for local array here local integer k=GetCSData(t) local unit caster = GetArrayUnit(k,0) //You can use return bug on the unit directly instead of using a 1 sized array, but that's up to you set efx1 = AddSpecialEffectTarget("Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl", caster, "origin") set efx2 = AddSpecialEffectTarget("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl", caster, "origin") call TriggerSleepAction(1.) set caster = null call DestroyEffect(efx1) call DestroyEffect(efx2) endfunction function Secret_Jutsu_Effects takes nothing returns nothing //Notice that waits do not work on expire events, you have to create a new thread: call ExecuteFunc("Secret_Jutsu_Effects_T") endfunction function Trig_Secret_Jutsu_Actions takes nothing returns nothing local unit caster = GetTriggerUnit() local unit target = GetSpellTargetUnit() local real casterX = GetUnitX(caster) local real casterY = GetUnitY(caster) local timer effecttimer = CreateTimer() local integer k=NewArray(1,false) call SetArrayObject(k,0,caster) call SetCSData(effecttimer,k) call PauseUnit(caster, true) call PauseUnit(target, true) call TimerStart(effecttimer, 0.50, true, function Secret_Jutsu_Effects) call TriggerSleepAction(3.00) call PauseTimer(effecttimer) call SetUnitAnimation(caster, "attack") call UnitDamageTarget(caster, target, 1000, true, false, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, WEAPON_TYPE_CLAW_HEAVY_SLICE) call PauseUnit(caster, false) call PauseUnit(target, false) call TriggerSleepAction(5.) //Better give it some time to take breath, since the timer's function has a wait this seems like a good idea. call DestroyTimer(effecttimer) call DestroyArray(k) set effecttimer = null set caster = null set target = null endfunction //=========================================================================== function InitTrig_Secret_Jutsu takes nothing returns nothing set gg_trg_Secret_Jutsu = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Secret_Jutsu, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( gg_trg_Secret_Jutsu, Condition( function Trig_Secret_Jutsu_Conditions ) ) call TriggerAddAction( gg_trg_Secret_Jutsu, function Trig_Secret_Jutsu_Actions ) call Preload("Abilities\\Spells\\Human\\MarkOfChaos\\MarkOfChaosTarget.mdl") call Preload("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl") endfunction |
| 08-17-2006, 05:11 PM | #9 |
Don't worry about giving me rep for everything; as nice as it is to be recognized, a simple thank you will usually do. If I weren't here to help I probably wouldn't be here. |
| 08-17-2006, 06:16 PM | #10 |
Here ye for modesty at its best. :D Take your bloody rep, fiend. |
| 08-17-2006, 07:58 PM | #11 |
People who help for rep, rather than for the mere pleasure of helping shouldn't be really helping. |
| 08-17-2006, 08:32 PM | #12 |
I agree. |
| 08-17-2006, 08:41 PM | #13 |
OMG then my user title sux :( |
| 08-17-2006, 09:10 PM | #14 |
...unless you are a mercenary for hire. ;P |
