• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

Teleport Strike Spell Bug

Status
Not open for further replies.
Level 10
Joined
Jun 6, 2007
Messages
392
I've made a Telepost Strike spell, which basically makes then caster to teleport to the target unit and slash it 5/10/15 times. If the target unit dies and the caster still has slashes left, it proceeds to the next valid target.

Here's some info about my hashtable:
index purpose
0 damage (per slash)
1 counter (number of slashes left)
2 target unit
3 caster's position when it begins casting
4 special effect attached to weapon
5 first illusion
6 second illusion

Here's the code:
  • Teleport Strike
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Teleport Strike
    • Actions
      • Set Target = (Target unit of ability being cast)
      • Set Counter = (5 x (Level of Teleport Strike for (Triggering unit)))
      • Set Damage = ((Real((Agility of (Triggering unit) (Include bonuses)))) x 1.25)
      • Set TempPoint = (Position of (Triggering unit))
      • Hashtable - Save Damage as 0 of (Key (Triggering unit)) in TeleportStrikeTable
      • Hashtable - Save Counter as 1 of (Key (Triggering unit)) in TeleportStrikeTable
      • Hashtable - Save Handle OfTarget as 2 of (Key (Triggering unit)) in TeleportStrikeTable
      • Hashtable - Save Handle OfTempPoint as 3 of (Key (Triggering unit)) in TeleportStrikeTable
      • Unit Group - Add (Triggering unit) to TeleportStrikeGroup
      • Unit - Pause (Triggering unit)
      • Special Effect - Create a special effect attached to the weapon of (Triggering unit) using war3mapImported\TornadoMissile.mdx
      • Hashtable - Save Handle Of(Last created special effect) as 4 of (Key (Triggering unit)) in TeleportStrikeTable
      • Trigger - Turn on Teleport Strike Effect <gen>

  • Teleport Strike Effect
    • Events
      • Time - Every 0.30 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in TeleportStrikeGroup and do (Actions)
        • Loop - Actions
          • Set Counter = (Load 1 of (Key (Picked unit)) from TeleportStrikeTable)
          • Set Damage = (Load 0 of (Key (Picked unit)) from TeleportStrikeTable)
          • Set Caster = (Picked unit)
          • Set Target = (Load 2 of (Key (Picked unit)) in TeleportStrikeTable)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Counter Greater than 0
            • Then - Actions
              • Set TempPoint = (Position of Caster)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • (Target is dead) Equal to True
                      • (Target has buff Invulnerable) Equal to True
                • Then - Actions
                  • Set TempGroup = (Units within 800.00 of TempPoint matching ((((Owner of (Matching unit)) is an ally of (Owner of (Picked unit))) Equal to False) and ((((Matching unit) is A ground unit) Equal to True) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) is M
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in TempGroup) Equal to 0
                    • Then - Actions
                      • Custom script: call RemoveLocation (udg_TempPoint)
                      • Custom script: call DestroyGroup (udg_TempGroup)
                      • Set Counter = 0
                      • Hashtable - Save Counter as 1 of (Key (Picked unit)) in TeleportStrikeTable
                      • Skip remaining actions
                    • Else - Actions
                  • Set Target = (Random unit from TempGroup)
                  • Custom script: call DestroyGroup (udg_TempGroup)
                • Else - Actions
              • Set TempPoint3 = (Position of Target)
              • Set TempPoint2 = (TempPoint3 offset by 50.00 towards (Angle from TempPoint to TempPoint3) degrees)
              • Unit - Move Caster instantly to TempPoint2, facing (Angle from TempPoint2 to TempPoint) degrees
              • Set TempUnit = (Load 6 of (Key (Picked unit)) in TeleportStrikeTable)
              • Unit - Remove TempUnit from the game
              • Set TempUnit = (Load 5 of (Key (Picked unit)) in TeleportStrikeTable)
              • Hashtable - Save Handle Of(Last created unit) as 6 of (Key (Picked unit)) in TeleportStrikeTable
              • Set CloneLocation = TempPoint2
              • Set ClonedUnit = Caster
              • Trigger - Run Clone Unit <gen> (ignoring conditions)
              • Animation - Change (Last created unit)'s vertex coloring to (30.00%, 30.00%, 100.00%) with 40.00% transparency
              • Unit - Add Zero Damage (item) to (Last created unit)
              • Unit - Remove classification of A Hero from (Last created unit)
              • Hashtable - Save Handle Of(Last created unit) as 5 of (Key (Picked unit)) in TeleportStrikeTable
              • Special Effect - Create a special effect at TempPoint2 using Abilities\Spells\NightElf\Blink\BlinkCaster.mdl
              • Special Effect - Destroy (Last created special effect)
              • Animation - Play Caster's attack animation
              • Unit - Cause Caster to damage Target, dealing Damage damage of attack type Spells and damage type Enhanced
              • Custom script: call RemoveLocation (udg_TempPoint)
              • Custom script: call RemoveLocation (udg_TempPoint3)
              • Custom script: call RemoveLocation (udg_TempPoint2)
              • Set Counter = (Counter - 1)
              • Hashtable - Save Counter as 1 of (Key (Picked unit)) in TeleportStrikeTable
              • Hashtable - Save Handle OfTarget as 2 of (Key (Picked unit)) in TeleportStrikeTable
            • Else - Actions
              • Set TempUnit = (Load 6 of (Key (Picked unit)) in TeleportStrikeTable)
              • Unit - Remove TempUnit from the game
              • Set TempUnit = (Load 5 of (Key (Picked unit)) in TeleportStrikeTable)
              • Unit - Remove TempUnit from the game
              • Set TempPoint = (Load 3 of (Key (Picked unit)) in TeleportStrikeTable)
              • Unit - Move Caster instantly to TempPoint
              • Custom script: call RemoveLocation (udg_TempPoint)
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in FireBreathTable
              • Unit - Unpause (Picked unit)
              • Set TempEffect = (Load 4 of (Key (Picked unit)) in TeleportStrikeTable)
              • Special Effect - Destroy TempEffect
              • Unit Group - Remove (Picked unit) from TeleportStrikeGroup
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in TeleportStrikeGroup) Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
The problem is that sometimes the caster remains paused after finishing the spell. Also, sometimes the caster isn't teleported back to its original location or it doesn't find a new target (even if surrounded by enemies).
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
You don't need the skip remaining actions and this should be in the else:
  • Set Target = (Random unit from TempGroup)
Where is the clone trigger?

Who knows what the last created unit is here:
  • Hashtable - Save Handle Of(Last created unit) as 6 of (Key (Picked unit)) in TeleportStrikeTable
There more but I'd rather have you post the spell in a map file so I can fix it.
 
Level 10
Joined
Jun 6, 2007
Messages
392
Thanks for your reply.
  • Set Target = (Random unit from TempGroup)
This line is in then actions, because a new target is only selected when the old target isn't valid anymore (in other words, it's dead).

I didn't post the clone trigger, since I added the clone feature afterwards, and those bugs happened even before. So the clone trigger shouldn't cause those problems.

  • Hashtable - Save Handle Of(Last created unit) as 6 of (Key (Picked unit)) in TeleportStrikeTable
This line had an error, it was supposed to have TempUnit instead of Last Created Unit. The latest illusion is stored at index 5, and the earlier one at index 6.

I can't upload the original map where I made this spell (it has too much custom stuff, imported files...), but I made a new test map. The strange thing is that on the test map, I didn't yet manage to get those bugs, but instead the ability stopped creating illusions at some point.

I'll attach the test map on this post.

Edit: I have been usin blizzard's map Emerald Gardens as a test map. I noticed that when I use the spell on mur'guls, it doesn't find a next target. When I use it on creeps I've added myself, player units or makruras, it finds a next target as it should.
Edit2: I found the cause of that problem. Mur'guls aren't ground units, so I changed the condition into "matching unit is a flying unit is equal to false". Still the caster doesn't always teleport back to his original position.
 

Attachments

  • Teleport Test.w3x
    43 KB · Views: 43
Last edited:
Level 10
Joined
Jun 6, 2007
Messages
392
It still doesn't always move the caster to his original location, and it stops creating illusions at some point (that one can be fixed easily though). That move bug is serious, because it may allow the hero to access unaccessible areas. Anyway, thank you for your help, I believe at least it's a little better coded now.

Edit: Finally I found out what caused that bug. In the loop, TempPoint is set to position of caster. However, when the loop is run the first time, position of caster is equal to start point (where caster should be teleported after the spell). So, removing TempPoint removes them both, and start point becomes null. I fixed it by preventing TempPoint from being removed the first time. I'm not sure if it leaks, but the spell is for a single player campaign, so it shouldn't be a big deal.
 
Last edited:
Status
Not open for further replies.
Top