Hi, I'm new to these forums, and currently just learning about mapmaking. Excuse my horrible grammar and/or spelling, as English is not my first language. I´v searched the forum to no avail, and now I turn to you guys for help.
I making a MUI (I think) Omnislash spell, but it randomly resets (to 1) my LDTempInt1 variable if I enable "Unit - Cause OmnislashCaster[LDTempInt1] to damage TempUnit...".
I made it work by using Dummy casters and spells instead, but I would really like to know the cause of this bug. We all know how Omnislash works, but my current code sometimes stops, and leaves the caster invulnerable, because the index variable I use to reference the different arrays resets to 1. I have commented out the "Unit-casue caster to damage..." line, and then it works.
Can that line somehow pause the trigger execution, and somehow allow different code to modify the variable? Am I missing something? Comments on leaks, non-MUI behaviour and such would also be welcome.
I outlined the codelines I think are of importance. Note that the formula for calculating the damage dealt is correct, and not the cause of the problem (tested).
I making a MUI (I think) Omnislash spell, but it randomly resets (to 1) my LDTempInt1 variable if I enable "Unit - Cause OmnislashCaster[LDTempInt1] to damage TempUnit...".
I made it work by using Dummy casters and spells instead, but I would really like to know the cause of this bug. We all know how Omnislash works, but my current code sometimes stops, and leaves the caster invulnerable, because the index variable I use to reference the different arrays resets to 1. I have commented out the "Unit-casue caster to damage..." line, and then it works.
Can that line somehow pause the trigger execution, and somehow allow different code to modify the variable? Am I missing something? Comments on leaks, non-MUI behaviour and such would also be welcome.
I outlined the codelines I think are of importance. Note that the formula for calculating the damage dealt is correct, and not the cause of the problem (tested).
Code:
Omnislash periodic
Events
Time - Every 0.05 seconds of game time
Conditions
(Number of units in OmnislashDummyGroup) Greater than 0
Actions
Unit Group - Pick every unit in OmnislashDummyGroup and do (Actions)
Loop - Actions
[COLOR="Red"] Set LDTempInt1 = (Custom value of (Picked unit))[/COLOR][COLOR="RoyalBlue"][SIZE="1"]<----- Getting my temp int to be used for referencing my caster and so on.[/SIZE][/COLOR]
Set OmnislashTimer[LDTempInt1] = (OmnislashTimer[LDTempInt1] + 0.05)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
OmnislashTimer[LDTempInt1] Greater than or equal to OmnislashPeriod[LDTempInt1]
Then - Actions
Set Temp_Point = (Position of OmnislashCaster[LDTempInt1])
Set OmnislashTimer[LDTempInt1] = 0.00
Set Temp_Group = (Units within 600.00 of Temp_Point matching ((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of OmnislashCaster[LDTempInt1])) Equal to True) and ((True E
Custom script: call RemoveLocation(udg_Temp_Point)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in Temp_Group) Greater than 0
Then - Actions
Set TempUnit = (Random unit from Temp_Group)
Game - Display to (All players) the text: (Units in range: + (String((Number of units in Temp_Group))))
Set Temp_Point = (Position of TempUnit)
Selection - Remove OmnislashCaster[LDTempInt1] from selection
Unit - Move OmnislashCaster[LDTempInt1] instantly to Temp_Point
Unit - Move (Picked unit) instantly to Temp_Point
Custom script: call RemoveLocation(udg_Temp_Point)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
And - All (Conditions) are true
Conditions
(Random integer number between 1 and 100) Less than or equal to (5 + ((Level of Whirlwind for OmnislashCaster[LDTempInt1]) x 5))
Then - Actions
Game - Display to (All players) the text: Dealing AoE damage.
Set Temp_Point = (Position of OmnislashCaster[LDTempInt1])
Animation - Play OmnislashCaster[LDTempInt1]'s attack walk stand spin animation
Special Effect - Create a special effect at Temp_Point using Abilities\Spells\Human\Thunderclap\ThunderClapCaster.mdl
Special Effect - Destroy (Last created special effect)
Unit - Create 1 DummySelfcast for (Owner of (Picked unit)) at Temp_Point facing TempReal degrees
Custom script: call RemoveLocation(udg_Temp_Point)
Unit - Add a 0.20 second Generic expiration timer to (Last created unit)
Unit - Add Omnislash Aoe to (Last created unit)
Unit - Set level of Omnislash Aoe for (Last created unit) to ((Level of Berserk for OmnislashCaster[LDTempInt1]) + 1)
Unit - Order (Last created unit) to Undead Lich - Frost Nova (Last created unit)
Else - Actions
Animation - Play OmnislashCaster[LDTempInt1]'s attack animation
[COLOR="DarkGreen"] Game - Display to (All players) the text: (LDTempInt: + (String(LDTempInt1)))[/COLOR][COLOR="MediumTurquoise"]<--always correct tempint at this point.[/COLOR]
[SIZE="3"][COLOR="Red"]Unit - Cause OmnislashCaster[LDTempInt1] to damage TempUnit, dealing (Random real number between (75.00 + ((Real((Level of Berserk for OmnislashCaster[LDTempInt1]))) x 25.00)) and (125.00 + ((Real((Level of Berserk for OmnislashCaster[LDTempInt1]))) x 25.00))) damage of attack type Hero and damage type Universal[/COLOR][/SIZE][COLOR="DeepSkyBlue"]<---Disabeling this line makes the spell work perfectly. Why?[/COLOR]
Game - Display to (All players) the text: (Name of tempunit: + (Name of TempUnit))
[COLOR="DarkGreen"] Game - Display to (All players) the text: (LDTempInt: + (String(LDTempInt1)))[/COLOR][COLOR="MediumTurquoise"]<--- at this point, tempint sometimes has reverted to 1. Woooot[/COLOR]?:banghead:
Set Temp_Point = (Position of OmnislashCaster[LDTempInt1])
Custom script: call RemoveLocation(udg_Temp_Point)
Special Effect - Create a special effect attached to the chest of OmnislashCaster[LDTempInt1] using Abilities\Spells\NightElf\Blink\BlinkCaster.mdl
Special Effect - Destroy (Last created special effect)
Set OmnislashAttacksPreformed[LDTempInt1] = (OmnislashAttacksPreformed[LDTempInt1] + 1)
Game - Display to (All players) the text: ((Increasing attackcounter to: + (((String(OmnislashAttacksPreformed[LDTempInt1])) + /) + (String(OmnislashAttackLimit[LDTempInt1])))) + <Empty String>)
Else - Actions
Game - Display to (All players) the text: No units in range.
Set OmnislashAttacksPreformed[LDTempInt1] = OmnislashAttackLimit[LDTempInt1]
Custom script: call DestroyGroup(udg_Temp_Group)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
OmnislashAttacksPreformed[LDTempInt1] Greater than or equal to OmnislashAttackLimit[LDTempInt1]
Then - Actions
Game - Display to (All players) the text: Omnislash End.
Unit - Remove (Picked unit) from the game
Set OmnislashAttackLimit[LDTempInt1] = 0
Set OmnislashAttacksPreformed[LDTempInt1] = 0
Set OmnislashTimer[LDTempInt1] = 0.00
Set OmnislashPeriod[LDTempInt1] = 0.00
Selection - Add OmnislashCaster[LDTempInt1] to selection for (Owner of OmnislashCaster[LDTempInt1])
Animation - Change OmnislashCaster[LDTempInt1]'s vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
Animation - Play OmnislashCaster[LDTempInt1]'s stand ready animation
Unit - Make OmnislashCaster[LDTempInt1] Vulnerable
Set OmnislashCaster[LDTempInt1] = No unit
Else - Actions
Else - Actions