everyone 0 sec? is that a good thing? so the trigger is suppot to run faster than 0.00 seconds?
Absolutely do not ever use a 0.00 periodic timer; that frequency is extremely unnecessary (0.016 is 60 fps, for reference) and all it will do is cause your game to slow down massively if a bunch of 0.00 triggers are running at the same time. You should never need to go below 0.03 and that's ~30 fps for moving units around on the screen quickly without it being jumpy. For an application like this, as I said above, 0.25 is perfectly adequate and will have no impact on performance.
Second, you are continuing to make this trigger long, complicated, and very difficult to decipher/change by refusing to use variables, loops, and simplified damage formulas like I suggested above. You didn't add any of the extra checks to see if the target/caster is dead like I suggested so the spell can still bug out that way.
Third, no this is not a particularly good way to do a spell amplification aura. It would be best to use a Damage Detection System (that's not the only one, there are many to choose from in the resources section here) to make spells like this. This will remove the need to check for the buff periodically, save the caster/target/counter, and apply a bunch of if-statements to figure out what the proper damage amp is. Instead you'll have an even that runs when a unit takes damage, and you can then check to see what unit was the source of that damage, what level each of its skills is, what buffs the damager and the damaged have, etc..
-------- set these on map init --------
Set MAX_LEVELS_OF_ARCANE_MASTERY = 4
Set AMBuff[1] = Arcane Mastery (Level 1)
Set AMBuff[2] = Arcane Mastery (Level 2)
Set AMBuff[3] = Arcane Mastery (Level 3)
Set AMBuff[4] = Arcane Mastery (Level 4)
-------- how much bonus damage each rank of mastery gives (0.30 = 30% bonus damage; if you put 1.30 it would be 130% bonus damage for a total of 230% of the base without AM) --------
Set AMBonus[1] = 0.20
Set AMBonus[2] = 0.30
Set AMBonus[3] = 0.40
Set AMBonus[4] = 0.50
ArcaneMissileDamage
Events
Time - Every 0.25 seconds of game time
Conditions
Actions
For each (Integer ArcaneMissile_Loop) from 1 to ArcaneMissile_Index, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any condition is true
ArcaneMissile_Counter[ArcaneMissile_Loop] greater than or equal to 1.00 //This was 3.00 in the old trigger but is 1.00 in the recent trigger...?
(ArcaneMissile_Target[ArcaneMissile_Loop] is dead) equal to true
(ArcaneMissile_Cast[ArcaneMissile_Loop] is dead) equal to true
Then - Actions
-------- this is cleanup here --------
Set ArcaneMissile_Cast[ArcaneMissile_Loop] = ArcaneMissile_Cast[ArcaneMissile_Index]
Set ArcaneMissile_Target[ArcaneMissile_Loop] = ArcaneMissile_Target[ArcaneMissile_Index]
Set ArcaneMissile_Counter[ArcaneMissile_Loop] = ArcaneMissile_Counter[ArcaneMissile_Index]
Set ArcaneMissile_Loop = (ArcaneMissile_Loop - 1)
If (All conditions are true) then do (Then actions) else do (Else Actions)
If - Conditions
ArcaneMissile_Loop less than or equal to 0
Then - Actions
Trigger - Turn off (this trigger)
Else - Actions
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(ArcaneMissile_Target[ArcaneMissile_Loop] has buff Arcane Missile (Dummy Buff)) Equal to True
Then - Actions
-------- What's the level of the spell being cast, and is the caster under the effects of any mastery buff? --------
Set LVL1 = (Level of Arcane Missile for ArcaneMissile_Cast[ArcaneMissile_Loop])
Set LVL2 = 0
For each (Integer A) from 1 to MAX_LEVELS_OF_ARCANE_MASTERY do (Actions)
Loop - Actions
If (All conditions are true) then do (Then actions) else do (Else Actions)
If - Conditions
(ArcaneMissile_Target[ArcaneMissile_Loop] has buff AMBuff[(Integer A)]
Then - Actions
-------- This has the added benefit of always giving you the bonus from the highest level buff you are benefiting from, but doesn't allow you to stack AM buffs --------
Set LVL2 = (Integer A)
Else - Actions
Set INT = (Intelligence of ArcaneMissile_Cast[ArcaneMissile_Loop] (Include bonuses))
Set DMG = (20.00 x LVL1) + (2.00 x INT)
Set DMG = (DMG x (AMBonus + 1.00))
Unit - Cause ArcaneMissile_Cast[ArcaneMissile_Loop] to damage ArcaneMissile_Target[ArcaneMissile_Loop], dealing DMG damage of attack type Spells and damage type Magic
Set ArcaneMissile_Counter[ArcaneMissile_Loop] = 1.00
Else - Actions
-------- waiting for the buff to be applied, I presume? --------
-------- I still have no idea what you're using the counter variable for --------
Set ArcaneMissile_Counter[ArcaneMissile_Loop] = ArcaneMissile_Counter[ArcaneMissile_Loop] + 0.10
If you post your version of my trigger we can all look to find the error. My guess is that you gave the spell a duration of 0.01 so the buff wouldnt linger, but that duration is too short to be seen by a 0.25 timer. What’s the duration on the ability that gives the buff?
I don't think it's ever been clear what exactly the OP is trying to achieve with a targeted damage spell. Why do you need the target to have a buff? Are you trying to replicate something like WoW's Arcane Missile or is the name similarity entirely coincidence? I get that you want stat-based damage and for other things to be able to alter the damage dealt but those don't require the target to have a buff.
Depending on the ability you based your Arcane Missile Buff-applicator ability on the buff could show up in different ways. I would recommend acid bomb if you are using something different.
The target needs the buff (which is applied when the spell lands) so the trigger knows when to apply the damage. Otherwise the damage will be instant, and the projectile effect wouldn’t make any sense. (As far as I’ve figured out anyway)
The spell is just a simple single targeted damaging nuke, the damage scaling off of your intelligence + the base damage of the spell. The spell is based off of shadow strike (for no particular reason other than it being a projectile spell). All the damage is done via a trigger so I can amplify it via other passive abilities later.
I’ve have been trying out multiple different methods of getting this spell to work correctly, and am now seeing if I can do it using the Damage Dectection System which you copied too me in an earlier reply.
The current problem I have is a lack of understanding on how the damage dectection system (which you linked) works, and how I would implement my spell using said system.
The buff is only for timing. So you really don't NEED the buff, you just need the damage to be timed properly... which is exactly the entire point of involving the DDS to make this simpler. The problem with the trigger you posted above is that you didn't use UnitDamageTargetEx like the system tells you to when you want to deal additional damage from within an on-damage event trigger:The target needs the buff (which is applied when the spell lands) so the trigger knows when to apply the damage.
So the problem was you used Unit Damage Target (in GUI) in your event response trigger, which probably caused a recursive loop and threadcrashed the damage event trigger. Instead all you needed to do was modify the damage value and the system would have dealt the modified damage for you:function UnitDamageTargetEx takes unit localSource, unit localTarget, real localAmount, boolean attack, boolean ranged, attacktype localAttackType, damagetype localDamageType, weapontype localWeaponType returns boolean
Use this function to allocate attacks from a running damage event. You can use it in exactly the same way as the standard native UnitDamageTarget. The function is designed recursive, so you can allocate as many attacks as you want. Do not use this function outside of a damage event.
did my post help at all? I didn't tested it but it should work.
You're making it MUCH more complicated than it needs to be with all those nested if statements. Learn to use variables to reduce the amount of code you run; in this case you can store the level of the spell and then deal 20*LEVEL + 2*INT damage. The damage happens so many times because you never put a check in the loop to see if the unit was under the effect of the buff you wanted. This should work fine but is IMO still not a good solution, do what Devalut suggested and use a damage detection system.
What are you using the Counter variable for...? In most cases I would use an integer here to count down to 0 when it should be 'done' rather than a real that counts up to some value, but you do you.
For each integer ...
Loop - Actions
If (All Conditions are true) then do (Then actions) else do (Else actions)
If - Conditions
-------- either of these means the instance is 'done' --------
Or - Any condition is true
(ArcaneMissile_Target[ArcaneMissile_Loop] is dead) equal to true
(ArcaneMissile_Cast[ArcaneMissile_Loop] is dead) equal to true
ArcaneMissile_Counter[ArcaneMissile_Loop] greater than or equal to 3.00
Then - Actions
If (All conditions are true) then do (Then Actions) else do (Else actions)
If - Conditions
(ArcaneMissile_Target[ArcaneMissile_Loop] has buff YOUR_BUFF) equal to true
Then - Actions
Set LVL = Level of YOUR_SPELL for ArcaneMissile_Cast[ArcaneMissile_Loop]
Unit - Cause ArcaneMissile_Cast[ArcaneMissile_Loop] to damage ArcaneMissile_Target[ArcaneMissile_Loop], dealing ((20.00 x Real(LVL)) + ((Real((Intelligence of ArcaneMissile_Cast[ArcaneMissile_Loop] (Include bonuses)))) x 2.00)) damage of attack type Spells and damage type Magic
-------- this next line sets up garbage collection on this instance the next the trigger runs --------
Set ArcaneMissile_Counter[ArcaneMissile_Loop] = 3.00
Else - Actions
Set ArcaneMissile_Counter[ArcaneMissile_Loop] = ArcaneMissile_Counter[ArcaneMissile_Loop] + 0.10
Else - Actions
-------- this is cleanup here --------
Set ArcaneMissile_Cast[ArcaneMissile_Loop] = ArcaneMissile_Cast[ArcaneMissile_Index]
Set ArcaneMissile_Target[ArcaneMissile_Loop] = ArcaneMissile_Target[ArcaneMissile_Index]
Set ArcaneMissile_Counter[ArcaneMissile_Loop] = ArcaneMissile_Counter[ArcaneMissile_Index]
Set ArcaneMissile_Loop = (ArcaneMissile_Loop - 1)
You used a slightly different damage system, so I have to change the variables in the trigger. It did work, but I couldnt replicate what I did for my spell.