• 🏆 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!

Something Weird or Something Broken? (Spell)

Status
Not open for further replies.
Level 11
Joined
Aug 6, 2009
Messages
697
So I was just testing out my MUI spell that, before, I saw no bugs.
But all of a sudden when I used the spell he went flying off the map.

After that happened, I left and remade to try it again, it worked fine!
What the hell happened?
The spell I used was Chidori when the glitch happened I used chidori nagashi THEN regular Chidori and it glitched.
I tried it in the same way when I remade and it was fine.

  • Chidori
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Chidori
    • Actions
      • Set ChidoriVictim = (Target unit of ability being cast)
      • Set ChidoriAngle = (Angle from (Position of (Target unit of ability being cast)) to (Position of (Triggering unit)))
      • Set ChidoriDistance = ((Distance between (Position of (Triggering unit)) and (Target point of ability being cast)) - 1.00)
      • Set ChidoriTime = (Distance between (Position of (Triggering unit)) and (Position of (Target unit of ability being cast)))
      • Hashtable - Save ChidoriAngle as 0 of (Key (Triggering unit)) in ChidoriHash
      • Hashtable - Save ChidoriTime as 2 of (Key (Target unit of ability being cast)) in ChidoriHash
      • Hashtable - Save Handle OfChidoriVictim as 3 of (Key (Triggering unit)) in ChidoriHash
      • Unit Group - Add (Triggering unit) to ChidoriChargeGroup


  • ChidoriLoop
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in ChidoriChargeGroup and do (Actions)
        • Loop - Actions
          • Set ChidoriAngle = (Load 0 of (Key (Picked unit)) from ChidoriHash)
          • Set ChidoriTime = (Load 2 of (Key (Picked unit)) from ChidoriHash)
          • Set ChidoriVictim = (Load 3 of (Key (Picked unit)) in ChidoriHash)
          • Special Effect - Create a special effect attached to the left hand of (Picked unit) using Abilities\Spells\Human\StormBolt\StormBoltMissile.mdl
          • Set ChidoriEffects[1] = (Last created special effect)
          • Special Effect - Create a special effect attached to the left hand of (Picked unit) using Abilities\Spells\Human\Thunderclap\ThunderClapCaster.mdl
          • Set ChidoriEffects[4] = (Last created special effect)
          • Special Effect - Create a special effect attached to the left hand of (Picked unit) using Abilities\Weapons\Bolt\BoltImpact.mdl
          • Set ChidoriEffects[5] = (Last created special effect)
          • Special Effect - Destroy ChidoriEffects[1]
          • Special Effect - Destroy ChidoriEffects[4]
          • Special Effect - Destroy ChidoriEffects[5]
          • Unit - Turn collision for (Picked unit) Off
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Distance between (Position of (Picked unit)) and (Position of ChidoriVictim)) Greater than 120.00
            • Then - Actions
              • Unit - Move (Picked unit) instantly to ((Position of (Picked unit)) offset by ChidoriTime towards ChidoriAngle degrees)
              • Hashtable - Save (ChidoriTime - 1.00) as 2 of (Key (Picked unit)) in ChidoriHash
            • Else - Actions
              • Special Effect - Create a special effect attached to the chest of ChidoriVictim using Abilities\Weapons\Bolt\BoltImpact.mdl
              • Set ChidoriEffects[2] = (Last created special effect)
              • Special Effect - Create a special effect attached to the origin of ChidoriVictim using Abilities\Spells\Orc\LightningBolt\LightningBoltMissile.mdl
              • Set ChidoriEffects[3] = (Last created special effect)
              • Special Effect - Create a special effect attached to the origin of ChidoriVictim using Abilities\Spells\Orc\WarStomp\WarStompCaster.mdl
              • Set ChidoriEffects[6] = (Last created special effect)
              • Special Effect - Destroy ChidoriEffects[2]
              • Special Effect - Destroy ChidoriEffects[3]
              • Special Effect - Destroy ChidoriEffects[6]
              • Unit - Cause (Picked unit) to damage ChidoriVictim, dealing ((Real((Level of Chidori for (Picked unit)))) x 400.00) damage of attack type Chaos and damage type Normal
              • Unit - Turn collision for (Picked unit) On
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in ChidoriHash
              • Unit Group - Remove (Picked unit) from ChidoriChargeGroup


  • Nagashi
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Nagashi
    • Actions
      • Set NagashiCaster = (Triggering unit)
      • Custom script: set udg_ID = GetHandleId (udg_NagashiCaster)
      • Set NagashiAngle2 = 0.00
      • Set NagashiPoint = (Position of NagashiCaster)
      • Set NagashiTime = 3.00
      • Set DummyKill = 3.00
      • Set NagashiLoops = 0.00
      • Set NagashiAngle = 0.00
      • Hashtable - Save NagashiAngle as 0 of ID in NagashiHash
      • Hashtable - Save NagashiAngle2 as 1 of ID in NagashiHash
      • Hashtable - Save NagashiTime as 2 of ID in NagashiHash
      • Hashtable - Save Handle OfNagashiCaster as 3 of ID in NagashiHash
      • Hashtable - Save Handle OfNagashiPoint as 4 of ID in NagashiHash
      • Hashtable - Save NagashiLoops as 6 of ID in NagashiHash
      • Hashtable - Save DummyKill as 7 of ID in NagashiHash
      • Unit - Pause NagashiCaster
      • Unit Group - Add NagashiCaster to NagashiDummyGroup


  • Nagashi Loop
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in NagashiDummyGroup and do (Actions)
        • Loop - Actions
          • Custom script: set udg_ID = GetHandleId(GetEnumUnit())
          • Set NagashiAngle = (Load 0 of ID from NagashiHash)
          • Set NagashiAngle2 = (Load 1 of ID from NagashiHash)
          • Set NagashiTime = (Load 2 of ID from NagashiHash)
          • Set NagashiCaster = (Load 3 of ID in NagashiHash)
          • Set NagashiPoint = (Load 4 of ID in NagashiHash)
          • Set NagashiPoint2 = (Load 5 of ID in NagashiHash)
          • Set NagashiLoops = (Load 6 of ID from NagashiHash)
          • Set DummyKill = (Load 7 of ID from NagashiHash)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • NagashiTime Greater than 0.00
            • Then - Actions
              • For each (Integer A) from 1 to 20, do (Actions)
                • Loop - Actions
                  • Set NagashiPoint = (Position of NagashiCaster)
                  • Set NagashiPoint2 = (NagashiPoint offset by NagashiLoops towards NagashiAngle degrees)
                  • Hashtable - Save Handle OfNagashiPoint2 as 5 of ID in NagashiHash
                  • Unit - Create 1 Nagashi Dummy for (Owner of NagashiCaster) at NagashiPoint2 facing Default building facing degrees
                  • Unit - Add a DummyKill second Generic expiration timer to (Last created unit)
                  • Set NagashiAngle = (NagashiAngle + (360.00 / 20.00))
                  • Hashtable - Save NagashiAngle as 0 of ID in NagashiHash
                  • Custom script: call RemoveLocation (udg_NagashiPoint)
                  • Custom script: call RemoveLocation (udg_NagashiPoint2)
              • Hashtable - Save (NagashiTime - 0.50) as 2 of ID in NagashiHash
              • Hashtable - Save (NagashiLoops + 100.00) as 6 of ID in NagashiHash
              • Hashtable - Save (DummyKill - 0.50) as 7 of ID in NagashiHash
            • Else - Actions
              • Hashtable - Clear all child hashtables of child ID in NagashiHash
              • Unit Group - Pick every unit in DummyRemoveGroup and do (Unit - Remove (Picked unit) from the game)
              • Unit - Unpause NagashiCaster
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
Hashtable - Save ChidoriAngle as 0 of (Key (Triggering unit)) in ChidoriHash
Hashtable - Save ChidoriTime as 2 of (Key (Target unit of ability being cast)) in ChidoriHash
Hashtable - Save Handle OfChidoriVictim as 3 of (Key (Triggering unit)) in ChidoriHash

Set ChidoriAngle = (Load 0 of (Key (Picked unit)) from ChidoriHash)
Set ChidoriTime = (Load 2 of (Key (Picked unit)) from ChidoriHash)
Set ChidoriVictim = (Load 3 of (Key (Picked unit)) in ChidoriHash)

You are saving the Time (index 2) to the wrong unit key in the setup trigger. Not sure if it is the cause of your bug but certainly is a cause of a leak and possibly other bugs. A possible reason for this causing your bug is that the value loaded is not initialized and so some other system might be giving it the wrong value.

Do remember that maps can have at most 256 hashtables or gamecaches.
 
Level 8
Joined
Dec 30, 2011
Messages
134
Don't use arrays if you don't need it

Here are some leaks, make some TempPoint variables to fix it
  • Set ChidoriAngle = (Angle from (Position of (Target unit of ability being cast)) to (Position of (Triggering unit)))
  • Set ChidoriDistance = ((Distance between (Position of (Triggering unit)) and (Target point of ability being cast)) - 1.00)
  • Set ChidoriTime = (Distance between (Position of (Triggering unit)) and (Position of (Target unit of ability being cast)))
For example:
  • Set TempPoint1 = Position of (Triggering unit)
  • Set TempPoint2 = Position of (Target unit of ability being cast)
  • Set ChidoriAngle = (Angle from TempPoint2 to TempPoint1)
  • Set ChidoriDistance = ((Distance between TempPoint1 and TempPoint2 - 1.00)
  • Set ChidoriTime = (Distance between (TempPoint1 and TempPoint2))
  • Custom script: call RemoveLocation(udg_TempPoint1)
  • Custom script: call RemoveLocation(udg_TempPoint2)
  • Special Effect - Create a special effect attached to the left hand of (Picked unit) using Abilities\Spells\Human\StormBolt\StormBoltMissile.mdl
  • Set ChidoriEffects[1] = (Last created special effect)
  • Special Effect - Create a special effect attached to the left hand of (Picked unit) using Abilities\Spells\Human\Thunderclap\ThunderClapCaster.mdl
  • Set ChidoriEffects[4] = (Last created special effect)
  • Special Effect - Create a special effect attached to the left hand of (Picked unit) using Abilities\Weapons\Bolt\BoltImpact.mdl
  • Set ChidoriEffects[5] = (Last created special effect)
  • Special Effect - Destroy ChidoriEffects[1]
  • Special Effect - Destroy ChidoriEffects[4]
  • Special Effect - Destroy ChidoriEffects[5]
FIDEX:
  • Special Effect - Create a special effect attached to the left hand of (Picked unit) using Abilities\Spells\Human\StormBolt\StormBoltMissile.mdl
  • Special Effect - Destroy (Last created special effect)
  • Special Effect - Create a special effect attached to the left hand of (Picked unit) using Abilities\Spells\Human\Thunderclap\ThunderClapCaster.mdl
  • Special Effect - Destroy (Last created special effect)
  • Special Effect - Create a special effect attached to the left hand of (Picked unit) using Abilities\Weapons\Bolt\BoltImpact.mdl
  • Special Effect - Destroy (Last created special effect)
If you have much functions to do with a unit, don't use (Triggering Unit) or (Picked unit) every time you have to do anything with he... Create a global variable named TempUnit, because the Trigger Unit calls a function and it's stupid to do much times in one function,,, Sorry for my english
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
My spell doesn't work if I change it to (Key (triggering unit)), I made it key target unit of ability being cast because I want it to save it on that unit.
Except you do not load it from that unit (a leak)?
Set ChidoriTime = (Load 2 of (Key (Picked unit)) from ChidoriHash)
You never add the target of the ability to the group you iterate through.
 
Status
Not open for further replies.
Top