• 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] Weird problem with spell

Status
Not open for further replies.
I was messing around, making a spell and I came upon a problem. My spell is supposed to create 2 earth walls, that move towards each other, dragging units towards the center. Sometimes the units slip out, or move from one spot to the other in the spell. Here are triggers.

  • Earth Clap Variables
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set EC_Hash = (Last created hashtable)
      • Set EC_DummyEarth = Dummy
      • Set EC_BaseDamage = 150.00
      • Set EC_BaseDamage = 75.00
  • Earth Clap Cast Copy
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Earth Clap
    • Actions
      • Set EC_TotalDamage = (EC_BaseDamage + (EC_LevelDamage x (Real((Level of (Ability being cast) for (Triggering unit))))))
      • Set EC_Timer = 1.00
      • Set EC_Caster = (Triggering unit)
      • Set EC_Point1 = (Position of EC_Caster)
      • Set EC_Point2 = (Target point of ability being cast)
      • Set EC_CastAngle = (Angle from EC_Point1 to EC_Point2)
      • Set EC_Point3 = (EC_Point2 offset by 500.00 towards (EC_CastAngle - 90.00) degrees)
      • Set EC_Point4 = (EC_Point3 offset by 250.00 towards (EC_CastAngle - 90.00) degrees)
      • Set EC_PositionMove = 0.00
      • For each (Integer A) from 1 to 5, do (Actions)
        • Loop - Actions
          • Set EC_Point5 = (EC_Point4 offset by EC_PositionMove towards EC_CastAngle degrees)
          • Unit - Create 1 EC_DummyEarth for (Triggering player) at EC_Point5 facing (EC_CastAngle + 90.00) degrees
          • Unit Group - Add (Last created unit) to EC_Group1
          • Custom script: call RemoveLocation(udg_EC_Point5)
          • Set EC_PositionMove = (EC_PositionMove + 100.00)
          • Hashtable - Save EC_Timer as 1 of (Key (Last created unit)) in EC_Hash
          • Hashtable - Save EC_CastAngle as 2 of (Key (Last created unit)) in EC_Hash
          • Hashtable - Save EC_TotalDamage as 3 of (Key (Last created unit)) in EC_Hash
      • Custom script: call RemoveLocation(udg_EC_Point3)
      • Custom script: call RemoveLocation(udg_EC_Point4)
      • Set EC_Point3 = (EC_Point2 offset by 500.00 towards (EC_CastAngle + 90.00) degrees)
      • Set EC_Point4 = (EC_Point3 offset by 250.00 towards (EC_CastAngle + 90.00) degrees)
      • Set EC_PositionMove = 0.00
      • For each (Integer A) from 1 to 5, do (Actions)
        • Loop - Actions
          • Set EC_Point5 = (EC_Point4 offset by EC_PositionMove towards EC_CastAngle degrees)
          • Unit - Create 1 EC_DummyEarth for (Triggering player) at EC_Point5 facing (EC_CastAngle - 90.00) degrees
          • Unit Group - Add (Last created unit) to EC_Group1
          • Custom script: call RemoveLocation(udg_EC_Point5)
          • Set EC_PositionMove = (EC_PositionMove + 100.00)
          • Hashtable - Save EC_Timer as 1 of (Key (Last created unit)) in EC_Hash
          • Hashtable - Save EC_CastAngle as 2 of (Key (Last created unit)) in EC_Hash
          • Hashtable - Save EC_TotalDamage as 3 of (Key (Last created unit)) in EC_Hash
      • Custom script: call RemoveLocation(udg_EC_Point1)
      • Custom script: call RemoveLocation(udg_EC_Point2)
      • Custom script: call RemoveLocation(udg_EC_Point3)
      • Custom script: call RemoveLocation(udg_EC_Point4)
      • Trigger - Turn on Earth Clap Loop Copy <gen>
  • Earth Clap Loop Copy
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((EC_Group1 is empty) Equal to True) and ((EC_Group2 is empty) Equal to True)
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
          • Unit Group - Pick every unit in EC_Group1 and do (Actions)
            • Loop - Actions
              • Set EC_Timer = (Load 1 of (Key (Picked unit)) from EC_Hash)
              • Set EC_Rock = (Picked unit)
              • Set EC_Point1 = (Position of EC_Rock)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • EC_Timer Greater than 0.00
                • Then - Actions
                  • Hashtable - Save (EC_Timer - 0.04) as 1 of (Key (Picked unit)) in EC_Hash
                  • Set EC_CastAngle = (Load 2 of (Key (Picked unit)) from EC_Hash)
                  • Set EC_Point2 = (EC_Point1 offset by 28.00 towards (Facing of EC_Rock) degrees)
                  • Unit - Move EC_Rock instantly to EC_Point2
                  • Unit Group - Pick every unit in (Units within 101.00 of EC_Point2 matching ((((Matching unit) belongs to an enemy of (Owner of EC_Rock)) Equal to True) and (((Matching unit) is alive) Equal to True))) and do (Actions)
                    • Loop - Actions
                      • Unit - Move (Picked unit) instantly to EC_Point2
                      • Special Effect - Create a special effect attached to the chest of (Picked unit) using Objects\Spawnmodels\Other\BeastmasterBlood\BeastmasterBlood.mdl
                      • Special Effect - Destroy (Last created special effect)
                  • Custom script: call RemoveLocation(udg_EC_Point1)
                  • Custom script: call RemoveLocation(udg_EC_Point2)
                • Else - Actions
                  • Set EC_TotalDamage = (Load 3 of (Key (Picked unit)) from EC_Hash)
                  • Unit Group - Pick every unit in (Units within 100.00 of EC_Point1 matching (((Matching unit) belongs to an enemy of (Owner of EC_Rock)) Equal to True)) and do (Actions)
                    • Loop - Actions
                      • Unit - Cause EC_Rock to damage (Picked unit), dealing EC_TotalDamage damage of attack type Chaos and damage type Universal
                  • Unit - Create 1 Dummy2 for (Owner of EC_Rock) at EC_Point1 facing Default building facing degrees
                  • Unit - Order (Last created unit) to Human Mountain King - Thunder Clap
                  • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in EC_Hash
                  • Unit Group - Remove EC_Rock from EC_Group1
                  • Unit - Remove EC_Rock from the game
Here is the map with the spell on it

View attachment 102815
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,259
That is because you get the units affected to pile up onto each other. The game's automatic displacement then trys to find an unocupied location for the unit and so will cause rather messy and random displacement. Try turning off collision for the unit during the spells effect on it or use the SetUnitX/Y natives which ignore displacement.
 
Status
Not open for further replies.
Top