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

[Trigger] Spell - Hashtable Related [bug]

Status
Not open for further replies.
Hello dear Hivers ;)

Yes it's me again :p

Here is the deal, I've made some spell using hashatables, the spell works as it should, there is just a bug appearing if the unit casts the spell more than 3 times in a row (Instant casts, no coolodwn)

As far as I tested there is a problem with FS_Shards variable, it seems that it doesn't load sometimes or it gets overwritten.
Maybe its the FS_Counter, dunno.

If someone would know a better way around (saving the value in some other way)

Here a little spell description:

Sends an ice orb that shoots out ice shards, if any enemy unit comes in contact with shard there is a dummy that casts frost nova.

Bug looks like that:

Normal there is one shard spawned every .09 second, but when it bugs there is a shard spawned every .03 second, or some times but just sometimes shards doesn't spawn at all...

  • Orb of Frost
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Orb of Frost
    • Actions
      • Set FS_Caster = (Triggering unit)
      • Set FS_Unit_Handle = (Triggering unit)
      • Set FS_Location_I = (Position of FS_Caster)
      • Set FS_Location_II = (Target point of ability being cast)
      • Set FS_Ability_Level = (Level of (Ability being cast) for FS_Caster)
      • Hashtable - Save FS_Ability_Level as (Key level) of (Key FS_Unit_Handle) in DummyTable
      • -------- ------------------------------------------------------------------------------------------------- --------
      • Set FS_Angle = (Angle from FS_Location_I to FS_Location_II)
      • Set FS_Speed = 8.00
      • Set FS_Distance = 1000.00
      • -------- ------------------------------------------------------------------------------------------------- --------
      • -------- ------------------------------------------------------------------------------------------------- --------
      • Unit - Create 1 Dummy(Orb of Frost) for (Owner of FS_Caster) at FS_Location_I facing Default building facing degrees
      • Unit - Pause (Last created unit)
      • Unit - Turn collision for (Last created unit) Off
      • Unit Group - Add (Last created unit) to FS_Move_Group
      • -------- ------------------------------------------------------------------------------------------------- --------
      • Hashtable - Save FS_Angle as (Key angle) of (Key (Last created unit)) in FrostTable
      • Hashtable - Save FS_Speed as (Key speed) of (Key (Last created unit)) in FrostTable
      • Hashtable - Save FS_Distance as (Key distance) of (Key (Last created unit)) in FrostTable
      • -------- ------------------------------------------------------------------------------------------------- --------
      • -------- ------------------------------------------------------------------------------------------------- --------
      • Custom script: call RemoveLocation(udg_FS_Location_I)
      • Custom script: call RemoveLocation(udg_FS_Location_II)
  • OoF Move
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in FS_Move_Group and do (Actions)
        • Loop - Actions
          • Set FS_Angle = (Load (Key angle) of (Key (Picked unit)) from FrostTable)
          • Set FS_Distance = (Load (Key distance) of (Key (Picked unit)) from FrostTable)
          • Set FS_Speed = (Load (Key speed) of (Key (Picked unit)) from FrostTable)
          • Set FS_Counter = (Load (Key counter) of (Key (Picked unit)) from FrostTable)
          • Set FS_Shards = (Load (Key shards) of (Key (Last created unit)) from FrostTable)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • FS_Distance Greater than 0.00
            • Then - Actions
              • Set FS_Move_Loc_I = (Position of (Picked unit))
              • Set FS_Move_Loc_II = (FS_Move_Loc_I offset by FS_Speed towards FS_Angle degrees)
              • Hashtable - Save (FS_Distance - FS_Speed) as (Key distance) of (Key (Picked unit)) in FrostTable
              • Set FS_Shards = (FS_Shards + 1)
              • Set FS_Counter = (FS_Counter + 10.00)
              • Hashtable - Save FS_Shards as (Key shards) of (Key (Last created unit)) in FrostTable
              • Hashtable - Save FS_Counter as (Key counter) of (Key (Picked unit)) in FrostTable
              • Unit - Move (Picked unit) instantly to FS_Move_Loc_II
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • FS_Shards Equal to 3
                • Then - Actions
                  • Set FS_Dummy_Cast_Point = (Position of (Last created unit))
                  • Set FS_Dummy_Cast_Point2 = (FS_Dummy_Cast_Point offset by 50.00 towards FS_Counter degrees)
                  • Set FS_Shard_Distance = 600.00
                  • Set FS_Shard_Speed = 15.00
                  • Set FS_Shard_Angle = (Angle from FS_Dummy_Cast_Point to FS_Dummy_Cast_Point2)
                  • Unit - Create 1 Dummy(Orb of Frost Missile) for (Owner of (Picked unit)) at FS_Move_Loc_II facing Default building facing degrees
                  • Set FS_Dummy_Missile = (Last created unit)
                  • Unit - Make FS_Dummy_Missile face FS_Shard_Angle over 0.00 seconds
                  • Unit Group - Add FS_Dummy_Missile to FS_Dummy_Group
                  • Hashtable - Save FS_Shard_Angle as (Key angle) of (Key (Last created unit)) in DummyTable
                  • Hashtable - Save FS_Shard_Speed as (Key speed) of (Key (Last created unit)) in DummyTable
                  • Hashtable - Save FS_Shard_Distance as (Key distance) of (Key (Last created unit)) in DummyTable
                  • Set FS_Shards = 0
                  • Hashtable - Save FS_Shards as (Key shards) of (Key (Last created unit)) in FrostTable
                  • Custom script: call RemoveLocation(udg_FS_Dummy_Cast_Point)
                  • Custom script: call RemoveLocation(udg_FS_Dummy_Cast_Point2)
                • Else - Actions
              • Custom script: call RemoveLocation(udg_FS_Move_Loc_I)
              • Custom script: call RemoveLocation(udg_FS_Move_Loc_II)
            • Else - Actions
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in FrostTable
              • Hashtable - Clear all child hashtables of child (Key (Last created unit)) in FrostTable
              • Unit - Kill (Picked unit)
              • Unit Group - Remove (Picked unit) from FS_Move_Group
      • Unit Group - Pick every unit in FS_Dummy_Group and do (Actions)
        • Loop - Actions
          • Set FS_Ability_Level = (Load (Key level) of (Key FS_Unit_Handle) from DummyTable)
          • Set FS_Shard_Angle = (Load (Key angle) of (Key (Picked unit)) from DummyTable)
          • Set FS_Shard_Speed = (Load (Key speed) of (Key (Picked unit)) from DummyTable)
          • Set FS_Shard_Distance = (Load (Key distance) of (Key (Picked unit)) from DummyTable)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • FS_Shard_Distance Greater than 0.00
            • Then - Actions
              • Set FS_DummyLocI = (Position of (Picked unit))
              • Set FS_DummyLocII = (FS_DummyLocI offset by FS_Shard_Speed towards FS_Shard_Angle degrees)
              • Set FS_Dummy_Damage_Group = (Units within 100.00 of FS_DummyLocII matching ((((Matching unit) is A structure) Equal to False) and (((((Matching unit) is alive) Equal to True) and (((Matching unit) has buff Slowed) Not equal to True)) and (((Owner of (Matching unit)) is an enemy of (Owne
              • Hashtable - Save (FS_Shard_Distance - FS_Shard_Speed) as (Key distance) of (Key (Picked unit)) in DummyTable
              • Unit - Move (Picked unit) instantly to FS_DummyLocII
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in FS_Dummy_Damage_Group) Greater than or equal to 1
                • Then - Actions
                  • Unit - Set life of (Picked unit) to 5.00
                • Else - Actions
              • Custom script: call DestroyGroup(udg_FS_Dummy_Damage_Group)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Life of (Picked unit)) Less than 10.00
                • Then - Actions
                  • Unit - Kill (Picked unit)
                  • Unit - Remove (Picked unit) from the game
                  • Unit Group - Remove (Picked unit) from FS_Dummy_Group
                  • Set FS_Location = (Position of (Picked unit))
                  • Set FS_Damage_Group = (Units within 125.00 of FS_Location matching ((((Matching unit) is A structure) Equal to False) and (((((Matching unit) is alive) Equal to True) and (((Matching unit) has buff Slowed) Not equal to True)) and (((Owner of (Matching unit)) is an enemy of (Owner
                  • Unit - Create 1 Dummy for (Owner of (Picked unit)) at FS_Location facing Default building facing degrees
                  • Set FS_Dummy = (Last created unit)
                  • Unit - Add a 1.00 second Generic expiration timer to FS_Dummy
                  • Unit - Add Frost Shatter (Dummy) to FS_Dummy
                  • Unit - Set level of Frost Nova for FS_Dummy to FS_Ability_Level
                  • Special Effect - Create a special effect at FS_Location using Abilities\Spells\Undead\FreezingBreath\FreezingBreathMissile.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Unit Group - Pick every unit in FS_Damage_Group and do (Actions)
                    • Loop - Actions
                      • Unit - Order FS_Dummy to Undead Lich - Frost Nova (Picked unit)
                  • Custom script: call RemoveLocation(udg_FS_Location)
                  • Custom script: call DestroyGroup(udg_FS_Damage_Group)
                • Else - Actions
              • Custom script: call RemoveLocation(udg_FS_DummyLocI)
              • Custom script: call RemoveLocation(udg_FS_DummyLocII)
            • Else - Actions
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in DummyTable
              • Hashtable - Clear all child hashtables of child (Key FS_Unit_Handle) in DummyTable
              • Unit - Remove (Picked unit) from the game
              • Unit Group - Remove (Picked unit) from FS_Dummy_Group
Thanks!

~Berzie ;)
 
Level 12
Joined
Jul 27, 2008
Messages
1,181
How to use Hashtable v1.0 by Reaper (trying to look like a geek :p)

A)Create & initialize.

B)Bind variables to hashtable keys, with parent-key = GetHandleId(unit) & child-key numbers (0, 1, 2, 3, 4, ,5...)

C)Add unit to group.

D)Loop through units of said group.

E)Enjoy a working spell.

So no need for any other variables, arraays, or other ugly stuff. You can even bind info almost like in structs.
 
How to use Hashtable v1.0 by Reaper (trying to look like a geek :p)

A)Create & initialize.

B)Bind variables to hashtable keys, with parent-key = GetHandleId(unit) & child-key numbers (0, 1, 2, 3, 4, ,5...)

C)Add unit to group.

D)Loop through units of said group.

E)Enjoy a working spell.

So no need for any other variables, arraays, or other ugly stuff. You can even bind info almost like in structs.

Jeberish :0

Can I pastebin you the map?
 
Level 22
Joined
Nov 14, 2008
Messages
3,256
the only thing that makes me go bad is that I guess it works but you use last created unit in the top of the loop and there are no created units in the toopp aaahhh

but it seems that this hashtable problem procs my indestinated wrath of not working stuff so I will leave it unfortunatly :(
 
Seems I got rid of the problem, I simply moved this part to the top of the if/the/else
Set FS_Shards = 0
Hashtable - Save FS_Shards as (Key shards) of (Key (Last created unit)) in FrostTable

And store id as a key of Picked unit. It doesn't seem to bug anymore, thou, I'll need to run a few more tests.

Thanks guys for your time :D Now free cookies for everyone ;)
 
Status
Not open for further replies.
Top