Something wrong - Tossing units and Hashtables

denmax

You can change this now in User CP.
Reaction score
155
I basically made an ability which hurls units from a target point towards your location. Before, I used real variables to store the distance and angle.

Now, after learning about Hashtables, I'm slowly trying to shift the needed reals to hashtable to make them somewhat closer to being MUI. The problem I am facing right now is that though it lifts everyone, it will only move one (random?) unit towards your. The result is everyone being lifted, with one guy slowly going towards your location.

I'm also unsure about the memory leaks concerning hashtables, so I guess that'll be part of my question too.

Here are the triggers

Trigger:
  • Lavapult cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Mandrakhor 2nd (Lavapult)
    • Actions
      • Set LavapultCaster = (Triggering unit)
      • Set Point[1] = (Target point of ability being cast)
      • Set UnitGroup[1] = (Units within 210.00 of Point[1])
      • Unit Group - Pick every unit in UnitGroup[1] and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True
              • ((Picked unit) is alive) Equal to True
              • ((Picked unit) is A structure) Not equal to True
              • ((Picked unit) is Mechanical) Not equal to True
              • ((Picked unit) is Magic Immune) Not equal to True
            • Then - Actions
              • Unit - Add Storm Crow Form to (Picked unit)
              • Unit - Remove Storm Crow Form from (Picked unit)
              • Unit - Turn collision for (Picked unit) Off
              • Unit - Pause (Picked unit)
              • Unit Group - Add (Picked unit) to LavapultTossed
              • Hashtable - Create a hashtable
              • Set LavapultHashtable = (Last created hashtable)
              • Hashtable - Save 0.00 as 0 of (Key (Picked unit)) in LavapultHashtable
              • Hashtable - Save (Angle from (Target point of ability being cast) to (Position of (Triggering unit))) as 1 of (Key (Picked unit)) in LavapultHashtable
              • Hashtable - Save (Distance between (Target point of ability being cast) and (Position of (Triggering unit))) as 2 of (Key (Picked unit)) in LavapultHashtable
            • Else - Actions
      • Special Effect - Create a special effect at Point[1] using Abilities\Spells\Other\Volcano\VolcanoDeath.mdl
      • Special Effect - Destroy (Last created special effect)
      • Custom script: call RemoveLocation(udg_Point[1])
      • Custom script: call DestroyGroup(udg_UnitGroup[1])


Trigger:
  • Lavapult toss
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in LavapultTossed and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Load 0 of (Key (Picked unit)) from LavapultHashtable) Less than 50.00
            • Then - Actions
              • Hashtable - Save ((Load 0 of (Key (Picked unit)) from LavapultHashtable) + 1.00) as 0 of (Key (Picked unit)) in LavapultHashtable
              • Set Point[1] = (Position of (Picked unit))
              • Set Point[2] = (Point[1] offset by ((Load 2 of (Key (Picked unit)) from LavapultHashtable) / 50.00) towards (Load 1 of (Key (Picked unit)) from LavapultHashtable) degrees)
              • Unit - Move (Picked unit) instantly to Point[2]
              • Set LavapultHeight = ((Power(25.00, 2.00)) - ((25.00 - (Load 0 of (Key (Picked unit)) from LavapultHashtable)) x (25.00 - (Load 0 of (Key (Picked unit)) from LavapultHashtable))))
              • Animation - Change (Picked unit) flying height to LavapultHeight at 0.00
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Load 0 of (Key (Picked unit)) from LavapultHashtable) Greater than or equal to 50.00
                • Then - Actions
                  • Unit - Turn collision for (Picked unit) On
                  • Unit - Unpause (Picked unit)
                  • Unit Group - Remove (Picked unit) from LavapultTossed
                  • Animation - Change (Picked unit) flying height to 0.00 at 0.00
                  • Special Effect - Create a special effect at Point[2] using Abilities\Spells\Orc\WarStomp\WarStompCaster.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Unit - Create 1 Peasant for (Owner of LavapultCaster) at Point[2] facing Default building facing degrees
                  • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
                  • Set Real[1] = ((60.00 x (Real((Level of Mandrakhor 2nd (Lavapult) for LavapultCaster)))) + (0.60 x (Real((Strength of LavapultCaster (Include bonuses))))))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is in ApocalypseAlsoTossed) Equal to True
                    • Then - Actions
                      • Unit - Cause (Last created unit) to damage (Picked unit), dealing (Real[1] + (Real(ApocalypseDamage))) damage of attack type Spells and damage type Normal
                      • Unit - Add Mandra Dummy (Apocalypse) - Slow to (Last created unit)
                      • Unit - Order (Last created unit) to Undead Necromancer - Cripple (Picked unit)
                      • Unit Group - Remove (Picked unit) from ApocalypseAlsoTossed
                    • Else - Actions
                      • Unit - Cause (Last created unit) to damage (Picked unit), dealing Real[1] damage of attack type Spells and damage type Normal
                  • Destructible - Pick every destructible within 200.00 of Point[2] and do (Actions)
                    • Loop - Actions
                      • Destructible - Kill (Picked destructible)
                  • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in LavapultHashtable
                • Else - Actions
              • Custom script: call RemoveLocation(udg_Point[1])
              • Custom script: call RemoveLocation(udg_Point[2])
            • Else - Actions
 

denmax

You can change this now in User CP.
Reaction score
155
Ugh.. nevermind...

I created a hashtable on the unitgroup, which caused it to create a hashtables per unit

Now my only issue is if it creates memory leaks, esp. on Loads 1 and 2
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    I ordered like five blocks for 15 dollars. They're just little aluminum blocks with holes drilled into them
  • Varine Varine:
    They are pretty much disposable. I have shitty nozzles though, and I don't think these were designed for how hot I've run them
  • Varine Varine:
    I tried to extract it but the thing is pretty stuck. Idk what else I can use this for
  • Varine Varine:
    I'll throw it into my scrap stuff box, I'm sure can be used for something
  • Varine Varine:
    I have spare parts for like, everything BUT that block lol. Oh well, I'll print this shit next week I guess. Hopefully it fits
  • Varine Varine:
    I see that, despite your insistence to the contrary, we are becoming a recipe website
  • Varine Varine:
    Which is unique I guess.
  • The Helper The Helper:
    Actually I was just playing with having some kind of mention of the food forum and recipes on the main page to test and see if it would engage some of those people to post something. It is just weird to get so much traffic and no engagement
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top