| 06-08-2008, 10:57 PM | #1 |
Hi everybody: There's one spell that has made me sick for a long time and it's called Ambush. The spell does the following:
Unfortunately I've been noticing some issues in this spell, and more if you play in bigger maps (there's more chance to get the non known issue). So I have 2 options:
Meanwhile I'll show you how's the code of this spell so you can get the idea how it was developed. JASS:library Ambush requires HandleVars, MovSys, ProjSys globals private constant integer SpellID = 'A00C' // Spell ID, based on Web private constant integer BuffID = 'B00Z' // Buff ID private constant real Height = 5. // Sets the height location of the caster respect the flying height of the target unit private constant real dt = 0.1 // timer interval private constant real Speed = 1500. endglobals private struct AData static integer index = 0 static group Amb unit caster unit target boolean hasbuff private static method onInit takes nothing returns nothing set AData.Amb = CreateGroup() endmethod static method create takes unit c, unit t returns AData local AData A = AData.allocate() set A.caster = c set A.target = t set A.hasbuff = false if integer(A) > AData.index then set AData.index = integer(A) endif return A endmethod method onDestroy takes nothing returns nothing call PauseUnit(.caster, false) call SetUnitPosition(.caster, GetUnitX(.caster), GetUnitY(.caster)) call SetUnitFlyHeight(.caster, 0, 0) set .caster = null set .target = null if integer(this) == AData.index then set AData.index = AData.index - 1 endif set this = 0 endmethod endstruct private function Loop takes nothing returns nothing local integer i = 0 local AData A loop exitwhen i > AData.index set A = AData( i ) if integer(A) > 0 then if not A.hasbuff and GetUnitAbilityLevel(A.target, BuffID) > 0 and IsUnitInGroup(A.caster, AData.Amb) then set A.hasbuff = true endif if A.hasbuff and GetUnitAbilityLevel(A.target, BuffID) > 0 then call SetUnitFlyHeight(A.caster, GetUnitFlyHeight(A.target) + Height, 0.) // this seems it doesn't work endif if GetWidgetLife(A.caster) < 0.405 then call SetUnitAbilityLevel(A.target, BuffID, 0) endif if A.hasbuff and GetUnitAbilityLevel(A.target, BuffID) < 1 then call GroupRemoveUnit(AData.Amb, A.caster) call A.destroy() endif endif set i = i + 1 endloop endfunction private function end takes nothing returns nothing call PauseUnit(GetUnitProjectile(), true) call SetUnitAnimation(GetUnitProjectile(), "stand") call GroupAddUnit(AData.Amb, GetUnitProjectile()) endfunction private function Conditions takes nothing returns boolean return GetSpellAbilityId() == SpellID endfunction private function EffectActions takes nothing returns nothing call SetHandleInt(GetTriggerUnit(), "Data", integer(AData.create(GetTriggerUnit(), GetSpellTargetUnit()))) endfunction private function Actions takes nothing returns nothing local unit c =GetTriggerUnit() local AData A = AData( GetHandleInt(c, "Data") ) local vector pi = vector.create(GetUnitX(c), GetUnitY(c), GetUnitFlyHeight(c)) local vector pf = vector.create(GetUnitX(A.target), GetUnitY(A.target), GetUnitFlyHeight(A.target)) local vector vi = vector.create(Speed, GetUnitFacing(c) * bj_DEGTORAD, bj_PI/2) local vector vf = vector.create(Speed, GetUnitsAngle(c, A.target), 0.) local Projectile P = Projectile.createSpherical(c, pi, pf, vi, vf, GetUnitsDist(c, A.target) / Speed, true) call P.SetEndCode(SCOPE_PRIVATE + "end") call FlushHandleLocals(c) set c = null endfunction //=========================================================================== function InitTrig_Ambush takes nothing returns nothing set gg_trg_Ambush = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Ambush, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( gg_trg_Ambush, Condition( function Conditions ) ) call TriggerAddAction( gg_trg_Ambush, function EffectActions ) set gg_trg_Ambush = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Ambush, EVENT_PLAYER_UNIT_SPELL_ENDCAST ) call TriggerAddCondition( gg_trg_Ambush, Condition( function Conditions ) ) call TriggerAddAction( gg_trg_Ambush, function Actions ) call TimerStart(CreateTimer(), dt, true, function Loop) endfunction endlibrary |
| 06-10-2008, 11:59 PM | #2 |
I know you're all about amazing custom triggered abilities... But you could go for an aerial version of Devour (Aerial Capture), and just have the unit that uses it have a custom animation where he jumps high into the air and opens his mouth. Basically would just be Devour, with targets modified to be "Air" (although I'm sure you knew that) :/ |
| 06-11-2008, 01:47 AM | #3 |
That might be hard to model because devor puts the devoured unit inside the devourer's stomach. Thus, the devoured unit's model disappears. You would have to create another dummy model or something and that's just really messy. |
| 06-11-2008, 02:19 AM | #4 |
Oh. I was suggesting a similar, replacement ability. I agree, making a dummy model would be messy. |
| 06-11-2008, 02:50 AM | #5 | |
Quote:
|
| 06-11-2008, 03:45 AM | #6 |
Ah, I didn't know the unit that would be using it... Well, you could always fob it off with some method of removing the "eating unit" icon... Otherwise, no idea. |
| 07-06-2008, 03:19 AM | #7 |
Ok, since we have other unit which can neutralize air units (Dark Drake), I've decided to change this Ambush ability with this one: Spell Name: Carnage. Spell type: Passive. Description: Gives to the Demon soldier the ability to have a chance of 15% of deal 10 additional damage and convert this damage into heal for themselves (10 hitpoints gained). What do you think?? |
| 07-06-2008, 04:05 AM | #8 |
So a passive 15% to deal 10 bonus damage and get 10 hp back?... Interesting in theory, but execution seems weak. Unless this unit is: A - very low HP, B - very low attack damage, or C - extremely high attack rate, Then this ability will benefit him almost nothing. I would suggest either one or two of the following: - Increase the chance-percentage (like 25%, or 40%) - Increase the bonus-damage and heal amount (perhaps 50, like a critical strike + effective heal) - Make him deal X bonus damage (10, ~20, etc), but instead he Heals equal to the amount of damage he does in total (i.e., if he has 12-15 attack damage and deals 13 damage + 10, he gets healed 23 damage) Meh, just a thought. Cool idea, though; an interesting mix of Critical Strike and Vampiric Aura. |
| 07-06-2008, 04:16 AM | #9 |
Why not base the ambush ability off of aerial shackles? Just mess with the units' flying heights at the beginning when you cast it, and when it ends, and remove the lightning-effect of the ability. |
| 07-06-2008, 04:48 AM | #10 | ||
Quote:
Quote:
One of my last test seems that it showed me the cause: if the target unit dies when the caster is flying toward him, the spell gets the bug. Unfortunately it has been difficult for me to repeat the effect in order to confirm. |
| 07-06-2008, 04:50 AM | #11 |
No, I don't think Aerial Shackles enables ground units to attack it; only Ensnare or Web used on Air units. Assuming you're able to mess with flying height upon casting of Aerial Shackles, I think that's a totally viable option; fits all the parameters you set, and requires minimal (like, GUI even) triggers. |
| 07-06-2008, 04:59 AM | #12 |
I need that the land melee units would be able to attack the affected unit, so I based in on web. Additionally there's other problem, if you get the flyheight of the webbed unit, it won't show the current one, but the standard fly height (as it weren't affected by the spell), that means that the caster will look flying over him which is utterly ugly. |
| 07-06-2008, 05:55 PM | #13 |
Perhaps you can get the fly height - a number? |
| 07-09-2008, 03:14 AM | #14 |
Oh, I thought you didn't want allied ground melee units to be able to attack the targetted air unit. Ahh... Then I got nothing. However, if you do decide to go with the Carnage ability, realize that I meant nothing against the ability itself; it's great. But you're right, the numbers are a bit off. I didn't realize you were just posing "test numbers". My bad. |
| 02-11-2009, 01:56 AM | #15 |
Solved & closed |
