• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Double Check I Imported Barbarian Spell Pack Correctly?

Level 21
Joined
Mar 16, 2008
Messages
958
This comes from the Barbarian Spell Pack. Players keep reporting it's causes deysncs/freezes to scorescreen. I don't think it has any problems but would anyone else be generous enough to look this over to double check?

Could this be a MUI problem?

  • Feral Impact
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Skill_FeralImpact
    • Actions
      • Trigger - Run Feral Impact Index <gen> (ignoring conditions)
      • Set VariableSet point = (Position of (Triggering unit))
      • Set VariableSet point2 = (Target point of ability being cast)
      • Custom script: set udg_tmpCasterZ = GetLocationZ( udg_point )
      • Custom script: set udg_tmpTargetZ = GetLocationZ( udg_point2 )
      • Set VariableSet tmpDiffHeight = (tmpTargetZ - tmpCasterZ)
      • Set VariableSet tmpHeight = ((Max(0.00, tmpDiffHeight)) + FI_DefaultHeight)
      • Set VariableSet tmpDistance = (Distance between point and point2)
      • -------- Setting up data --------
      • Set VariableSet FI_Hero[fi] = (Triggering unit)
      • Set VariableSet FI_z[fi] = tmpCasterZ
      • Set VariableSet FI_Angle[fi] = (Angle from point to point2)
      • Set VariableSet FI_Vz[fi] = (Square root((-2.00 x (g x tmpHeight))))
      • Set VariableSet FI_Height[fi] = tmpCasterZ
      • Set VariableSet tmpTime = (((-1.00 x FI_Vz[fi]) / g) - ((Square root(((-2.00 x g) x (tmpHeight - tmpDiffHeight)))) / g))
      • Set VariableSet FI_Vp[fi] = (tmpDistance / tmpTime)
      • Set VariableSet FI_AnimSpeed[fi] = (0.50 / tmpTime)
      • -------- Setting up the rest --------
      • Animation - Change FI_Hero[fi]'s animation speed to (FI_AnimSpeed[fi] x 100.00)% of its original speed
      • Unit - Turn collision for FI_Hero[fi] Off.
      • Unit - Add Storm Crow Form to FI_Hero[fi]
      • Unit - Remove Storm Crow Form from FI_Hero[fi]
      • Unit - Make FI_Hero[fi] Invulnerable
      • Special Effect - Create a special effect at point using FI_EffectA
      • Special Effect - Destroy (Last created special effect)
      • Special Effect - Create a special effect attached to the chest of FI_Hero[fi] using FI_EffectB
      • Special Effect - Destroy (Last created special effect)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • FI_Sound Not equal to <Empty String>
        • Then - Actions
          • Custom script: set udg_tmpSound = CreateSound(udg_FI_Sound, false, true, false, 12700, 12700, "")
          • Sound - Play tmpSound at 100.00% volume, attached to FI_Hero[fi]
          • Custom script: call KillSoundWhenDone(udg_tmpSound)
        • Else - Actions
      • -------- Activate! --------
      • Trigger - Turn on Feral Impact Move <gen>
      • Custom script: call RemoveLocation(udg_point)
      • Custom script: call RemoveLocation(udg_point2)
  • Feral Impact Move
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer fi) from 1 to FI_Max, do (Actions)
        • Loop - Actions
          • Set VariableSet point = (Position of FI_Hero[fi])
          • Set VariableSet point2 = (point offset by (FI_Vp[fi] x 0.02) towards FI_Angle[fi] degrees.)
          • Unit - Move FI_Hero[fi] instantly to point2
          • Custom script: set udg_real = GetLocationZ( udg_point2 )
          • Set VariableSet FI_z[fi] = (FI_z[fi] + (FI_Vz[fi] x 0.02))
          • Set VariableSet FI_Vz[fi] = (FI_Vz[fi] + (g x 0.02))
          • Set VariableSet real2 = (FI_z[fi] - real)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • real2 Greater than 0.00
            • Then - Actions
              • -------- Barbarian is still flying. --------
              • Animation - Change FI_Hero[fi] flying height to real2 at 0.00
              • Custom script: call RemoveLocation(udg_point2)
            • Else - Actions
              • -------- Barbarian has landed. Tremble, mortals! --------
              • -------- Animation --------
              • Animation - Change FI_Hero[fi] flying height to 0.00 at 0.00
              • Unit - Turn collision for FI_Hero[fi] On.
              • Animation - Change FI_Hero[fi]'s animation speed to 100.00% of its original speed
              • -------- lZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZl --------
              • -------- #2 CUSTOMIZE: change here to change the landing effect --------
              • Special Effect - Create a special effect at point2 using Abilities\Spells\Orc\WarStomp\WarStompCaster.mdl
              • Set VariableSet FI_Sfx_Var = (Last created special effect)
              • -------- lZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZl --------
              • Set VariableSet FI_AnimSpeed[fi] = 1.00
              • Unit - Make FI_Hero[fi] Vulnerable
              • -------- lZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZl --------
              • -------- Damage and Knockback --------
              • Set VariableSet FI_FallHeight = (((Max(FI_Height[fi], real)) + FI_DefaultHeight) - real)
              • -------- lZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZl --------
              • -------- #4 CUSTOMIZE: change here to set the damage and AoE --------
              • Set VariableSet real = (((Real((Level of Skill_FeralImpact for FI_Hero[fi]))) x 55.00) + 150.00)
              • Set VariableSet real2 = ((((Real((Level of Skill_FeralImpact for FI_Hero[fi]))) x 75.00) + 75.00) x (FI_FallHeight / FI_DefaultHeight))
              • -------- lZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZl --------
              • Floating Text - Create floating text that reads ((String((Integer((FI_FallHeight / (FI_DefaultHeight / 100.00)))))) + %!) above FI_Hero[fi] with Z offset 0.00, using font size 13.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
              • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
              • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
              • Set VariableSet group = (Units within real of point2 matching ((((Matching unit) belongs to an enemy of (Owner of FI_Hero[fi]).) Equal to True) and (((Matching unit) is alive) Equal to True)).)
              • Custom script: call RemoveLocation(udg_point2)
              • Unit Group - Pick every unit in group and do (Actions)
                • Loop - Actions
                  • Unit - Cause FI_Hero[fi] to damage (Picked unit), dealing real2 damage of attack type Spells and damage type Normal
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A structure) Equal to False
                    • Then - Actions
                      • Trigger - Run Knockback Index <gen> (ignoring conditions)
                      • Set VariableSet KB_Unit[kb] = (Picked unit)
                      • Set VariableSet point2 = (Position of KB_Unit[kb])
                      • Set VariableSet KB_Angle[kb] = (Angle from point to point2)
                      • -------- lZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZl --------
                      • -------- #5 CUSTOMIZE: change here to set the knockback range/speed --------
                      • Set VariableSet KB_MaxDist[kb] = 300.00
                      • Set VariableSet KB_Speed[kb] = 50.00
                      • -------- lZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZl --------
                      • Set VariableSet KB_Dist[kb] = 0.00
                      • Trigger - Turn on Knockback Move <gen>
                      • Custom script: call RemoveLocation(udg_point2)
                    • Else - Actions
              • -------- Finish --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • FI_Max Equal to 1
                • Then - Actions
                  • Special Effect - Destroy FI_Sfx_Var
                  • Trigger - Turn off (This trigger)
                • Else - Actions
                  • -------- Recycle index --------
                  • Set VariableSet FI_Angle[fi] = FI_Angle[FI_Max]
                  • Set VariableSet FI_AnimSpeed[fi] = FI_AnimSpeed[FI_Max]
                  • Set VariableSet FI_Height[fi] = FI_Height[FI_Max]
                  • Set VariableSet FI_Hero[fi] = FI_Hero[FI_Max]
                  • Set VariableSet FI_Vp[fi] = FI_Vp[FI_Max]
                  • Set VariableSet FI_Vz[fi] = FI_Vz[FI_Max]
                  • Set VariableSet FI_z[fi] = FI_z[FI_Max]
                  • Set VariableSet fi = (fi - 1)
              • Set VariableSet FI_Max = (FI_Max - 1)
              • Custom script: call DestroyGroup(udg_group)
          • Custom script: call RemoveLocation(udg_point)
  • Feral Impact Move
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer fi) from 1 to FI_Max, do (Actions)
        • Loop - Actions
          • Set VariableSet point = (Position of FI_Hero[fi])
          • Set VariableSet point2 = (point offset by (FI_Vp[fi] x 0.02) towards FI_Angle[fi] degrees.)
          • Unit - Move FI_Hero[fi] instantly to point2
          • Custom script: set udg_real = GetLocationZ( udg_point2 )
          • Set VariableSet FI_z[fi] = (FI_z[fi] + (FI_Vz[fi] x 0.02))
          • Set VariableSet FI_Vz[fi] = (FI_Vz[fi] + (g x 0.02))
          • Set VariableSet real2 = (FI_z[fi] - real)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • real2 Greater than 0.00
            • Then - Actions
              • -------- Barbarian is still flying. --------
              • Animation - Change FI_Hero[fi] flying height to real2 at 0.00
              • Custom script: call RemoveLocation(udg_point2)
            • Else - Actions
              • -------- Barbarian has landed. Tremble, mortals! --------
              • -------- Animation --------
              • Animation - Change FI_Hero[fi] flying height to 0.00 at 0.00
              • Unit - Turn collision for FI_Hero[fi] On.
              • Animation - Change FI_Hero[fi]'s animation speed to 100.00% of its original speed
              • -------- lZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZl --------
              • -------- #2 CUSTOMIZE: change here to change the landing effect --------
              • Special Effect - Create a special effect at point2 using Abilities\Spells\Orc\WarStomp\WarStompCaster.mdl
              • Set VariableSet FI_Sfx_Var = (Last created special effect)
              • -------- lZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZl --------
              • Set VariableSet FI_AnimSpeed[fi] = 1.00
              • Unit - Make FI_Hero[fi] Vulnerable
              • -------- lZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZl --------
              • -------- Damage and Knockback --------
              • Set VariableSet FI_FallHeight = (((Max(FI_Height[fi], real)) + FI_DefaultHeight) - real)
              • -------- lZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZl --------
              • -------- #4 CUSTOMIZE: change here to set the damage and AoE --------
              • Set VariableSet real = (((Real((Level of Skill_FeralImpact for FI_Hero[fi]))) x 55.00) + 150.00)
              • Set VariableSet real2 = ((((Real((Level of Skill_FeralImpact for FI_Hero[fi]))) x 75.00) + 75.00) x (FI_FallHeight / FI_DefaultHeight))
              • -------- lZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZl --------
              • Floating Text - Create floating text that reads ((String((Integer((FI_FallHeight / (FI_DefaultHeight / 100.00)))))) + %!) above FI_Hero[fi] with Z offset 0.00, using font size 13.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
              • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 1.50 seconds
              • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
              • Set VariableSet group = (Units within real of point2 matching ((((Matching unit) belongs to an enemy of (Owner of FI_Hero[fi]).) Equal to True) and (((Matching unit) is alive) Equal to True)).)
              • Custom script: call RemoveLocation(udg_point2)
              • Unit Group - Pick every unit in group and do (Actions)
                • Loop - Actions
                  • Unit - Cause FI_Hero[fi] to damage (Picked unit), dealing real2 damage of attack type Spells and damage type Normal
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is A structure) Equal to False
                    • Then - Actions
                      • Trigger - Run Knockback Index <gen> (ignoring conditions)
                      • Set VariableSet KB_Unit[kb] = (Picked unit)
                      • Set VariableSet point2 = (Position of KB_Unit[kb])
                      • Set VariableSet KB_Angle[kb] = (Angle from point to point2)
                      • -------- lZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZl --------
                      • -------- #5 CUSTOMIZE: change here to set the knockback range/speed --------
                      • Set VariableSet KB_MaxDist[kb] = 300.00
                      • Set VariableSet KB_Speed[kb] = 50.00
                      • -------- lZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZl --------
                      • Set VariableSet KB_Dist[kb] = 0.00
                      • Trigger - Turn on Knockback Move <gen>
                      • Custom script: call RemoveLocation(udg_point2)
                    • Else - Actions
              • -------- Finish --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • FI_Max Equal to 1
                • Then - Actions
                  • Special Effect - Destroy FI_Sfx_Var
                  • Trigger - Turn off (This trigger)
                • Else - Actions
                  • -------- Recycle index --------
                  • Set VariableSet FI_Angle[fi] = FI_Angle[FI_Max]
                  • Set VariableSet FI_AnimSpeed[fi] = FI_AnimSpeed[FI_Max]
                  • Set VariableSet FI_Height[fi] = FI_Height[FI_Max]
                  • Set VariableSet FI_Hero[fi] = FI_Hero[FI_Max]
                  • Set VariableSet FI_Vp[fi] = FI_Vp[FI_Max]
                  • Set VariableSet FI_Vz[fi] = FI_Vz[FI_Max]
                  • Set VariableSet FI_z[fi] = FI_z[FI_Max]
                  • Set VariableSet fi = (fi - 1)
              • Set VariableSet FI_Max = (FI_Max - 1)
              • Custom script: call DestroyGroup(udg_group)
          • Custom script: call RemoveLocation(udg_point)
  • Feral Impact Index
    • Events
    • Conditions
    • Actions
      • Set VariableSet FI_Max = (FI_Max + 1)
      • Set VariableSet fi = FI_Max
  • Knockback Index
    • Events
    • Conditions
    • Actions
      • Set VariableSet KB_Max = (KB_Max + 1)
      • Set VariableSet kb = KB_Max
  • Knockback Move
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer kb) from 1 to KB_Max, do (Actions)
        • Loop - Actions
          • Set VariableSet point = (Position of KB_Unit[kb])
          • Set VariableSet point2 = (point offset by KB_Speed[kb] towards KB_Angle[kb] degrees.)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Terrain pathing at point2 of type Walkability is off) Equal to True
                  • KB_Dist[kb] Greater than or equal to KB_MaxDist[kb]
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • KB_Max Equal to 1
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
                  • -------- Recycle index --------
                  • Set VariableSet KB_Angle[kb] = KB_Angle[KB_Max]
                  • Set VariableSet KB_Dist[kb] = KB_Dist[KB_Max]
                  • Set VariableSet KB_MaxDist[kb] = KB_MaxDist[KB_Max]
                  • Set VariableSet KB_Speed[kb] = KB_Speed[KB_Max]
                  • Set VariableSet KB_Unit[kb] = KB_Unit[KB_Max]
                  • Set VariableSet kb = (kb - 1)
              • Set VariableSet KB_Max = (KB_Max - 1)
            • Else - Actions
              • Unit - Move KB_Unit[kb] instantly to point2
              • Special Effect - Create a special effect at point2 using Abilities\Spells\Human\FlakCannons\FlakTarget.mdl
              • Special Effect - Destroy (Last created special effect)
              • Set VariableSet KB_Dist[kb] = (KB_Dist[kb] + KB_Speed[kb])
          • Custom script: call RemoveLocation( udg_point )
          • Custom script: call RemoveLocation( udg_point2 )
 
Last edited:
Level 24
Joined
Feb 27, 2019
Messages
833
The function GetLocationZ() is known to cause desyncs in the right circumstances. I dont think setting a point contains any Z value anyways... if it did, it would be catastrophical.

In essence set udg_tmpCasterZ = GetLocationZ( udg_point ) should be set_tmpCasterZ = GetUnitFlyingHeight(GetTriggerUnit()) to avoid the desyncs
and in the loop Custom script: set udg_real = GetUnitFlyingHeight( FI_Hero[fi] )
 
Last edited:
There is some interesting discussion on GetLocationZ here:

Essentially, if you have one person playing on reforged and one person playing on classic, GetLocationZ can return inconsistent values (far more often than it used to pre-reforged), even just on default terrain.

This isn't necessarily a problem in itself, but if you have conditional logic based off GetLocationZ(...), that's where things can get hairy. For example, "Feral Impact Move" sets real2 based off GetLocationZ, and then checks if the real2 is greater than 0.00. If the Z value returns 0.00 for one player but not the other player, then that could lead to the "then" actions executing for one player and not the others. Those actions include creating effects and such => leads to a desync.

It'll probably require a bit of surgery with the code. The continuation/ending condition shouldn't be based off anything asynchronous between players. I think the reason the code was written that way was so that if you jump up a really steep slope, the code would end once the player intersects the ground (instead of them just "sliding" across the land). But I'd rather take a weird slide than a desync, haha. So it'd probably involve tweaking the conditions to things that are synced between players (i.e. a fixed duration, or when the unit reaches that point/some unpathable point).

Duckfarter said:
The function GetLocationZ() is known to cause desyncs in the right circumstances. I dont think setting a point contains any Z value anyways... if it did, it would be catastrophical.

In essence set udg_tmpCasterZ = GetLocationZ( udg_point ) should be set_tmpCasterZ = GetUnitFlyingHeight(GetTriggerUnit()) to avoid the desyncs
and in the loop Custom script: set udg_real = GetUnitFlyingHeight( FI_Hero[fi] )

Sadly, using fly height would likely prevent the desync but the spell probably won't end up working the same way--the Z calculations are mostly to handle slopes correctly, especially since most of these projectile/jump systems (at least back in the day) used dummy units with a fly height to position an effect in the air. For example, if I have a caster with 0 fly height, it is going to return 0 fly height whether I'm on a big hill or on a steep valley. And if you set the fly height without using GetLocationZ(...) to offset it, it'll just end up moving in a really weird arc based off the terrain beneath it (so if you have very hilly terrain, the projectile arc would follow a similar hilly pattern).
 
Top