• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Hash handle - doesn't work sometimes

Status
Not open for further replies.

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
Trying to figure out why this lightning effect gets destroyed most of the time but frequently does not get destroyed... I am new to Hash Tables so sorry if this seems noobish

  • dt BK Attacks C
    • Actions
      • Special Effect - Create a special effect attached to the origin of TargetHero using Abilities\Spells\Undead\ReplenishMana\SpiritTouchTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Set PointTempArray[1] = (Position of TargetHero)
      • Set PointTempArray[2] = (Position of (Attacking unit))
      • Lightning - Create a Finger of Death lightning effect from source PointTempArray[1] to target PointTempArray[2]
      • Lightning - Change color of (Last created lightning effect) to (0.20 1.00 0.20) with 0.80 alpha
      • Custom script: call RemoveLocation( udg_PointTempArray[1] )
      • Custom script: call RemoveLocation( udg_PointTempArray[2] )
      • Hashtable - Save Handle Of(Last created lightning effect) as (Key (This trigger)) of (Key (Owner of (Attacking unit))) in KnightHash
      • Wait 0.75 seconds
      • Lightning - Destroy (Load (Key (This trigger)) of (Key (Owner of (Attacking unit))) in KnightHash)
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
The event occurs too frequently to store the lightning with variables...

I've tried lots of handles to get this trigger to work properly, to no avail.

The unit will attack, the lightning plays properly, then after 10 or so attacks one of the lightning effects sticks, but the lightning plays perfectly after that point with no leaked effects... it's so weird.
 
Level 13
Joined
Jun 23, 2009
Messages
297
The event occurs too frequently to store the lightning with variables...

I've tried lots of handles to get this trigger to work properly, to no avail.

The unit will attack, the lightning plays properly, then after 10 or so attacks one of the lightning effects sticks, but the lightning plays perfectly after that point with no leaked effects... it's so weird.

Well, actually lightning often act weirdly, it may be related to the "Wait", but... no, the time needed for an attack is surely bigger than the wait.

What about a dummy that casts a channeled spell (of, say, 0.75 duration) on the target using Finger of Death as the lightning style? (with no damage/effects?)
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
  • Untitled Trigger 001
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Custom script: local lightning l
      • Set Point1 = (Position of (Triggering unit))
      • Set Point2 = (Position of (Attacking unit))
      • Custom script: set l = AddLightningEx( "AFOD" , true, GetLocationX(udg_Point1), GetLocationY(udg_Point1), GetLocationZ(udg_Point1) + 60, GetLocationX(udg_Point2), GetLocationY(udg_Point2), GetLocationZ(udg_Point2) + 60)
      • Custom script: call SetLightningColor(l, 0.2, 1.0, 0.2, 0.8)
      • Custom script: call RemoveLocation(udg_Point1)
      • Custom script: call RemoveLocation(udg_Point2)
      • Wait 0.75 seconds
      • Custom script: call DestroyLightning(l)
That "+60" is the height offset from ground.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
What I don't get is why that one has inescapable glitches while this other trigger I have, which happens a million times more frequently, works flawlessly...

  • dt Ion Attacks
    • Actions
      • Set PointTempArray[1] = (Position of (Attacked unit))
      • Set PointTempArray[2] = (Position of (Attacking unit))
      • Lightning - Create a Lightning Attack lightning effect from source PointTempArray[1] to target PointTempArray[2]
      • Lightning - Change color of (Last created lightning effect) to (0.20 1.00 0.20) with 0.80 alpha
      • Custom script: call RemoveLocation( udg_PointTempArray[1] )
      • Custom script: call RemoveLocation( udg_PointTempArray[2] )
      • Hashtable - Save Handle Of(Last created lightning effect) as (Key (Attacked unit)) of (Key (Attacking unit)) in GenericHash
      • Wait 0.75 seconds
      • Lightning - Destroy (Load (Key (Attacked unit)) of (Key (Attacking unit)) in GenericHash)
When I run into glitches like this, which I can't avoid for anything, I just delete the actionscript and move on to the next thing. Which is what I've done for now. I'd still like to get Maker's code to work on my map though (I tried adding a Lightning Effect variable named "l" but the error messages still didn't change even slightly).
 
Status
Not open for further replies.
Top