• 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.

Hashtable learning

Status
Not open for further replies.
Level 6
Joined
Oct 4, 2011
Messages
226
I'm working on trying to make bugproof, memory leak proof, abilities & more and I have my first concept pretty much mapped out inside my head. I only know (GUI) and no jass sorry.
[Heatseeker]: Every 4 seconds the Blazing Fiend ejects a 50 dmg fireball towards the closest enemy in 450 range. (If no unit is near no fireball is ejected) Now I am new to hashtables but am getting better. heres my testmap so far

{Thankyou}

....

Can a whole ability even be made using all hashtables? or do I need to use other variables instead of hashtables. Idk where to find how to clearify these things.
 

Attachments

  • Undecided Name Map .0001.w3x
    31.8 KB · Views: 54
Last edited by a moderator:
Level 37
Joined
Mar 6, 2006
Messages
9,243
Here's the basic idea how it should be done, however some things are still not right. Add units with the ability into Heatseeker_Casters.


  • Heatseeker
    • Events
      • Time - Every 4.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Heatseeker_Casters and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
            • Then - Actions
              • Set point1 = (Position of (Picked unit))
              • -------- *detect closest unit here* --------
              • Set point2 = Point1 offset by 25 towards...
              • Unit - Create 1 Fireball (Projectile) for (Owner of (Picked unit)) at Point2 facing some angle
              • Unit Group - Add (Last created unit) to Heatseeker_CUgrp
              • Hashtable - Save Handle Of(Owner of (Picked unit)) as (Key player) of (Key caster) in Heatseeker_hashTable
              • Trigger - Turn on Heatseeker2 <gen>
              • Special Effect - Create a special effect at point1 using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
  • Heatseeker2
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in Heatseeker_CUgrp) Greater than 0
        • Then - Actions
          • Unit Group - Pick every unit in Heatseeker_CUgrp and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Distance between x and y) Less than or equal to 25.00
                • Then - Actions
                  • Unit - Cause (Load (Key caster) of (Key fireball) in Heatseeker_hashTable) to damage (Load (Key foundtarget) of (Key fireball) in Heatseeker_hashTable), dealing 50.00 damage of attack type Spells and damage type Fire
                  • Unit - Kill (Picked unit)
                  • Hashtable - Clear all child hashtables of child (Key (Load (Key location) of (Key fireball) in Heatseeker_hashTable)) in Heatseeker_hashTable
                  • Remove unit from group
                • Else - Actions
                  • set point1 = post of picked unit
                  • set point2 = point1 offset by x towards y
                  • Unit - Movepicked unit instantly to point2, facing angle
                  • Custom script: call RemoveLocation(udg_point1)
                  • Custom script: call RemoveLocation(udg_point2)
        • Else - Actions
          • Trigger - Turn off (This trigger)


Getting closest unit:
http://www.hiveworkshop.com/forums/1909890-post3.html
 
Level 6
Joined
Oct 4, 2011
Messages
226
Yeah not really looking to solve it through barrage, although thanks. Maker, your a life-saver your triggers are helping me understand more. But some stuff I have questions about. alot of your hashtable info never seemed to be saved.[ (caster) of (fireball)] [(location) of (fireball)]and even [(foundtarget) of (fireball)]. I was also wondering how to detect [(x) and (y)] that Heatseeker2 uses to measure the distance and direction of travel.

Edit: Do you use the same 2 point variables in both triggers or is that point1 and point 2 for trigger 1 and point 3 and 4 for trigger 2.
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
But some stuff I have questions about. alot of your hashtable info never seemed to be saved.[ (caster) of (fireball)] [(location) of (fireball)]and even [(foundtarget) of (fireball)]. I was also wondering how to detect [(x) and (y)] that Heatseeker2 uses to measure the distance and direction of travel.

Edit: Do you use the same 2 point variables in both triggers or is that point1 and point 2 for trigger 1 and point 3 and 4 for trigger 2.

I didn't finish the triggers, I left some work for you to do :)

I use same variables for both triggers. Save the stuff you need yourself.

X is the speed, Y is the angle. Use whatever you want.
 
Level 6
Joined
Oct 4, 2011
Messages
226
Ah I see. thanks for that its better for learning that way anyways.
Okay i will be tinkering when I have time. Thanks for taking the time to help me Maker. +rep

Edit: added my current map and what I got. I got a damage leak going on right now to where whenever one of the fiends fireballs hit it does more then 50 damage. this is because its doing damage for more then one of the fireballs I think. (Type b to spawn 1 red 1 blue fiend and c to spawn a red. for testing)
 

Attachments

  • Undecided Name Map .0001.w3x
    33.1 KB · Views: 68
Last edited:
Level 6
Joined
Oct 4, 2011
Messages
226
Thanks. It seems to work all good now. there was one instance where if the fireball chased the target for too long it wouldnt damage it. but I obviously wasn't going to keep it at that slow of a rate. so when I increased the movement real from 4.00 to 13.45 It seems to exclude this bug. I owe you! :D
 
Status
Not open for further replies.
Top