I've been searching through for a while, but I couldn't find the solution or the reason.
The spells that I'm having trouble with are the extremely simple types where after the effect goes off, a dummy unit is created and is ordered to cast another spell at the same target. What's really weird is that this is causing significant lag on some abilities, but not all. I've played around with some of the possible solutions such as pre-loading the abilities on a dummy unit at map initialization and removing it. I've also made 25 dummy units for each player to recycle through during map init.
So for example, here's a spell that does NOT lag. Basically what it does is it has a dummy unit use Thunderclap on top of the target unit.
And then here's one that lags SOMETIMES. It's just the Volcano ability, except that it uses a Dummy unit so that it doesn't channel. This one has a very brief lag (less than 1 second) and the lag varies a lot. Sometimes the lag is about a second and sometimes the lag doesn't occur at all.
And lastly, here's one that lags the game the entire duration of this spell. I'm not sure what exactly is the problem on this. It might not even be the triggers. The lag lasts until the unit has lost the buff altogether. This is a spell based off of Frost Arrow (I think), and uses triggers to deal a critical strike and Cripple the target for a short period. This spell lags differently based on the unit type of the target for some reason. A custom unit based off of Knight will lag the game for the entire duration of the buff, but on a Paladin it'll lag only for about 2 seconds.
Should I change these spells to JASS? I know how to use some basic and rudimentary JASS, but I probably could if I needed to. But even if I did change to JASS, I'm not sure if it'll fix it since I have no idea what the cause is. Can the lag be simply because I used GUI?
The spells that I'm having trouble with are the extremely simple types where after the effect goes off, a dummy unit is created and is ordered to cast another spell at the same target. What's really weird is that this is causing significant lag on some abilities, but not all. I've played around with some of the possible solutions such as pre-loading the abilities on a dummy unit at map initialization and removing it. I've also made 25 dummy units for each player to recycle through during map init.
So for example, here's a spell that does NOT lag. Basically what it does is it has a dummy unit use Thunderclap on top of the target unit.
Code:
Paladin 1 Hammer Slam
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Paladin 1 Hammer Slam
Actions
Set Point_Temp = (Position of (Target unit of ability being cast))
Set Unit_Temp = (Random unit from UnitGroup_Dummies[(Player number of (Owner of (Triggering unit)))])
Unit - Move Unit_Temp instantly to Point_Temp
Unit - Set level of Paladin 1 Hammer Slam for Unit_Temp to (Level of Paladin 1 Hammer Slam for (Triggering unit))
Special Effect - Create a special effect at Point_Temp using Abilities\Spells\Human\Thunderclap\ThunderClapCaster.mdl
Environment - Create a 1.00 second wave deformation from Point_Temp to Point_Temp with radius 250.00, depth 96.00, and a 0.00 second trailing delay
Unit - Order Unit_Temp to Human Mountain King - Thunder Clap
Unit Group - Remove Unit_Temp from UnitGroup_Dummies[(Player number of (Owner of (Triggering unit)))]
Unit Group - Add Unit_Temp to UnitGroup_UsedDummies
Set Real_Temp = 2.00
Custom script: call SaveReal(udg_AA_GlobalHashtable, StringHash("DummyReal"), GetHandleId(udg_Unit_Temp), udg_Real_Temp)
Custom script: call RemoveLocation (udg_Point_Temp)
And then here's one that lags SOMETIMES. It's just the Volcano ability, except that it uses a Dummy unit so that it doesn't channel. This one has a very brief lag (less than 1 second) and the lag varies a lot. Sometimes the lag is about a second and sometimes the lag doesn't occur at all.
Code:
Firelord 2 Volcano
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Firelord 2 Volcano
Actions
Set Point_Temp = (Target point of ability being cast)
Set Unit_Temp = (Random unit from UnitGroup_Dummies[(Player number of (Owner of (Triggering unit)))])
Unit - Move Unit_Temp instantly to Point_Temp
Unit - Set level of Firelord 2 Volcano for Unit_Temp to (Level of Firelord 2 Volcano for (Triggering unit))
Unit - Order Unit_Temp to Neutral Fire Lord - Volcano (Target point of ability being cast)
Unit Group - Remove Unit_Temp from UnitGroup_Dummies[(Player number of (Owner of (Triggering unit)))]
Unit Group - Add Unit_Temp to UnitGroup_UsedDummies
Set Real_Temp = 15.00
Custom script: call SaveReal(udg_AA_GlobalHashtable, StringHash("DummyReal"), GetHandleId(udg_Unit_Temp), udg_Real_Temp)
Custom script: call RemoveLocation (udg_Point_Temp)
And lastly, here's one that lags the game the entire duration of this spell. I'm not sure what exactly is the problem on this. It might not even be the triggers. The lag lasts until the unit has lost the buff altogether. This is a spell based off of Frost Arrow (I think), and uses triggers to deal a critical strike and Cripple the target for a short period. This spell lags differently based on the unit type of the target for some reason. A custom unit based off of Knight will lag the game for the entire duration of the buff, but on a Paladin it'll lag only for about 2 seconds.
Code:
Tuskarr Hunter 4 Wounding Spear
Events
Game - GDD_Event becomes Equal to 0.00
Conditions
Or - Any (Conditions) are true
Conditions
(GDD_DamagedUnit has buff Tuskarr Hunter 4 Wounding Spear (Non-stacking)) Equal to True
(GDD_DamagedUnit has buff Tuskarr Hunter 4 Wounding Spear (Stacking)) Equal to True
Actions
Trigger - Turn off (This trigger)
Set Point_Temp = (Position of GDD_DamagedUnit)
Set Unit_Temp = (Random unit from UnitGroup_Dummies[(Player number of (Owner of GDD_DamageSource))])
Unit - Move Unit_Temp instantly to Point_Temp
Unit - Set level of Tuskarr 4 Wounding Spear Wound for Unit_Temp to 1
Unit - Order Unit_Temp to Neutral Alchemist - Acid Bomb GDD_DamagedUnit
Unit - Remove Tuskarr Hunter 4 Wounding Spear (Non-stacking) buff from GDD_DamagedUnit
Unit - Remove Tuskarr Hunter 4 Wounding Spear (Stacking) buff from GDD_DamagedUnit
Unit - Cause GDD_DamageSource to damage GDD_DamagedUnit, dealing (GDD_Damage x (0.00 + (Real((Level of Tuskarr Hunter 4 Wounding Spear for GDD_DamageSource))))) damage of attack type Hero and damage type Universal
Floating Text - Create floating text that reads (String((((Real((Level of Tuskarr Hunter 4 Wounding Spear for GDD_DamageSource))) + 0.00) x GDD_Damage))) at (((Position of GDD_DamagedUnit) offset by 0.00 towards 45.00 degrees) offset by 100.00 towards 45.00 degrees) with Z offset 0.00, using font size 9.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Set the velocity of (Last created floating text) to 100.00 towards 90.00 degrees
Floating Text - Change the fading age of (Last created floating text) to 0.25 seconds
Floating Text - Change the lifespan of (Last created floating text) to 1.51 seconds
Unit Group - Remove Unit_Temp from UnitGroup_Dummies[(Player number of (Owner of GDD_DamageSource))]
Unit Group - Add Unit_Temp to UnitGroup_UsedDummies
Set Real_Temp = 2.00
Custom script: call SaveReal(udg_AA_GlobalHashtable, StringHash("DummyReal"), GetHandleId(udg_Unit_Temp), udg_Real_Temp)
Custom script: call RemoveLocation (udg_Point_Temp)
Trigger - Turn on (This trigger)
Should I change these spells to JASS? I know how to use some basic and rudimentary JASS, but I probably could if I needed to. But even if I did change to JASS, I'm not sure if it'll fix it since I have no idea what the cause is. Can the lag be simply because I used GUI?