| 04-19-2006, 10:38 PM | #1 |
tried making an ability that only works when activated like frost arrows, here is what I came up with JASS:function Trig_Seep_Conditions takes nothing returns boolean return GetLearnedSkill() == '9999' //ability id endfunction function Seep_Detect takes nothing returns boolean if GetTriggerEventId()==EVENT_PLAYER_UNIT_ATTACKED then if GetUnitAbilityLevel(GetAttacker(),'9999')==0 then //ability id return false else return true endif elseif GetTriggerEventId()==EVENT_UNIT_SPELL_EFFECT then if GetSpellAbilityId()=='9999' then //ability id return true else return false endif endif return false endfunction function Seep_Effects takes nothing returns nothing local real r local unit targ = GetTriggerUnit() local unit cast = GetEventDamageSource() local texttag t if GetUnitAbilityLevel(targ,'9999') and GetUnitAbilityLevel(cast,'9999')>0 then // check for ability and buff call DisableTrigger(GetTriggeringTrigger()) set r = GetUnitState(targ,UNIT_STATE_LIFE)*.05 set t = CreateTextTag() call SetTextTagText(t,"-"+I2S(R2I(r)),.023) call SetTextTagPosUnit(t,targ,15) call SetTextTagColor(t,100,0,0,50) call SetTextTagVelocity(t,.0355 * Cos(90 * bj_DEGTORAD),.0355 * Sin(90 * bj_DEGTORAD)) call UnitDamageTarget(cast,targ,r,false,false,ATTACK_TYPE_HERO,DAMAGE_TYPE_DIVINE,null) call SetUnitState(cast,UNIT_STATE_LIFE,GetUnitState(cast,UNIT_STATE_LIFE)+r) call PolledWait(1) call DestroyTextTag(t) endif set targ = null set cast = null set t = null endfunction function Seep_Detect_Actions takes nothing returns nothing local trigger trig=CreateTrigger() local unit u if GetTriggerEventId()==EVENT_UNIT_SPELL_EFFECT then set u=GetSpellTargetUnit() else set u=GetTriggerUnit() endif call TriggerRegisterUnitEvent(trig,u,EVENT_UNIT_DAMAGED) call TriggerAddAction(trig,function Seep_Effects) call PolledWait(2) call DestroyTrigger(trig) set trig = null set u = null endfunction function Trig_Seep_Actions takes nothing returns nothing local unit u=GetTriggerUnit() local integer lvl=GetUnitAbilityLevel(u,'9999') //ability id local trigger trig if lvl==1 then set trig=CreateTrigger() call TriggerRegisterAnyUnitEventBJ(trig,EVENT_PLAYER_UNIT_ATTACKED) call TriggerRegisterUnitEvent(trig,u,EVENT_UNIT_SPELL_EFFECT) call TriggerAddCondition(trig,Condition(function Seep_Detect)) call TriggerAddAction(trig,function Seep_Detect_Actions) endif set u = null endfunction //=========================================================================== function InitTrig_Seep takes nothing returns nothing set gg_trg_Seep = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Seep, EVENT_PLAYER_HERO_SKILL ) call TriggerAddCondition( gg_trg_Seep, Condition( function Trig_Seep_Conditions ) ) call TriggerAddAction( gg_trg_Seep, function Trig_Seep_Actions ) endfunction wasnt sure if this was the best way to go about it ,just checking, and also for any trigger leaks, if there are some, how to clean them up ty for the help |
| 04-19-2006, 10:47 PM | #2 |
Eh.. why all those events, like a hero skill detection, etc? are you trying to make it so that when you activate it like frost arrows, each attack will cause a certain effect? |
| 04-19-2006, 10:48 PM | #3 |
well as seen in the Seep_Effect function, it damages the target for 5% of its current hp and gives it to the attacker like I said i wasnt exactly sure how to go about doing this, but it seems to work |
| 04-19-2006, 11:09 PM | #4 |
JASS:call SetTextTagVelocity(t,0,.0355) I think you should split the AnyUnitEventBJ event into a separate trigger that is only created once. You don't need a copy for each caster. Why do you use AnyUnitEventBJ for the targets and a unit event for the caster? Shouldn't only one be necessary, and if both work, won't that double the effects? |
| 04-23-2006, 07:57 AM | #5 |
You need a projectile function to create that effect you want exactly then when the arrow hits the target. You need to detect when the unit attacks, then order the arrows targetorderid. This requires you to have another trigger which detects when the arrowspell is casted. Then create a projectile which seeks the target. Wait till the projectile hits the target and the start your effects. Oh yeah and you have to check in the attack event trigger if the unit has activated the arrowspell before. PM if you need help or a finished script. ;D By the way: This way of arrowtriggering allows you to use the cooldown of the arrowspell. Hope I could help. |
| 04-24-2006, 12:39 AM | #6 |
well too tell ya the truth, after a good bit of testing this method seems to work pretty well, and I have yet to find a bug with it, som ima use that unless anything comes up |
| 04-30-2006, 11:08 AM | #7 |
Which method did refer to in your last post? |
| 04-30-2006, 11:37 PM | #8 |
something very similar to what I have posted above |
