How to enum locusted units?

NeuroToxin

New Member
Reaction score
46
Okay, as the title says, How do I select a random unit from a group, heck it doesnt even have to be random, it can just be the first of a group w/e as long as it properly selects a unit. The problem? My units are locusted. As some of you may or may not know, locusted units aren't picked up in the Matching functions, like "Random unit from group" I have all of them in a group, but I cant pick one.
 

canons200

New Member
Reaction score
50
upon created your locust dummy, set him a variable, then use the variable to perform action.
 

NeuroToxin

New Member
Reaction score
46
I know that, but they were already used, and I need to pick a random one from the group. Did you read the post?
 

canons200

New Member
Reaction score
50
same thing, upon create the dummy, set it variable, then add it to a special unit group(with all dummy?)
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
locusted units aren't picked up in the Matching functions, like "Random unit from group" I have all of them in a group, but I cant pick one.

Locust units are only unable to be picked by area-based enumerations like Units In Region. Random from group ought to work, no problem, so something else must be wrong. Can you show your triggers (the whole triggers) where you add the units to the group, and where you are trying to pick them?

One maybe relevant note that I'd just like to mention ahead of time: if you're using [ljass]set bj_wantDestroyGroup = true[/ljass], that will prevent Random # From Group from working due to awkward Blizzard code. :(
 

NeuroToxin

New Member
Reaction score
46
Well, I was doing this. [Note its a system and a spell together, be prepared.] [Another note, It's in GUI, be prepared again] Only thing is, it works sort of now that I removed Locust from the units in the first trigger, but Id like to keep it there. Nevertheless, It now moves units to center of the map in the Send Soul Loop, and IDK why. Just heres the triggers. W/e
Trigger:
  • SenseOfTheSouls
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Caster_Value Greater than or equal to 5000
        • Then - Actions
          • Set Caster_Value = 0
        • Else - Actions
          • Set Caster_Value = (Caster_Value + 1)
      • Set Deadunit[Caster_Value] = (Triggering unit)
      • Set Deadunitloc = (Position of Deadunit[Caster_Value])
      • Set MaxRange = 2000.00
      • Set SoulCaster = (Units within MaxRange of Deadunitloc matching ((Level of Sense of the Souls for (Matching unit)) Greater than 0))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in SoulCaster) Greater than 1
        • Then - Actions
          • Unit Group - Pick every unit in SoulCaster and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Number of units in SoulCaster) Equal to 0) or ((Number of units in Circling_Units[(Custom value of (Picked unit))]) Greater than or equal to (10 + ((Level of Sense of the Souls for (Picked unit)) x 5)))
                • Then - Actions
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is in SoS_Casters) Equal to False
                    • Then - Actions
                      • Unit Group - Add (Picked unit) to SoS_Casters
                      • Unit - Set the custom value of (Picked unit) to CustomValue
                      • Set CustomValue = (CustomValue + 1)
                    • Else - Actions
                  • Set SoulMaster[Caster_Value] = (Picked unit)
                  • Set SoulMasterLoc = (Position of SoulMaster[Caster_Value])
                  • -------- Angle to move from Deadunitloc to Soulmaster --------
                  • Set Angle[Caster_Value] = (Angle from Deadunitloc to (Position of (Picked unit)))
                  • -------- --------------------------------------------- --------
                  • Unit - Create 1 DUMMY_UNIT for (Owner of (Picked unit)) at Deadunitloc facing Angle[Caster_Value] degrees
                  • Set Dummyunit[Caster_Value] = (Last created unit)
                  • Unit - Remove Locust from Dummyunit[Caster_Value]
                  • Unit - Set the custom value of Dummyunit[Caster_Value] to (Custom value of (Picked unit))
                  • Animation - Change Dummyunit[Caster_Value] flying height to (Random real number between 100.00 and 300.00) at 100.00
                  • Unit Group - Add Dummyunit[Caster_Value] to Dummyunits
                  • Custom script: call RemoveLocation(udg_SoulMasterLoc)
                  • Set Caster_Value = (Caster_Value + 1)
        • Else - Actions
          • Unit Group - Pick every unit in SoulCaster and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Number of units in SoulCaster) Equal to 0) or ((Number of units in Circling_Units[(Custom value of (Picked unit))]) Greater than or equal to (10 + ((Level of Sense of the Souls for (Picked unit)) x 5)))
                • Then - Actions
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is in SoS_Casters) Equal to False
                    • Then - Actions
                      • Unit Group - Add (Picked unit) to SoS_Casters
                      • Unit - Set the custom value of (Picked unit) to CustomValue
                      • Set CustomValue = (CustomValue + 1)
                    • Else - Actions
                  • Set SoulMaster[Caster_Value] = (Picked unit)
                  • Set SoulMasterLoc = (Position of (Picked unit))
                  • -------- Angle to move from Deadunitloc to Soulmaster --------
                  • Set Angle[Caster_Value] = (Angle from Deadunitloc to (Position of (Picked unit)))
                  • -------- --------------------------------------------- --------
                  • Unit - Create 1 DUMMY_UNIT for (Owner of (Picked unit)) at Deadunitloc facing Angle[Caster_Value] degrees
                  • Set Dummyunit[Caster_Value] = (Last created unit)
                  • Unit - Set the custom value of Dummyunit[Caster_Value] to (Custom value of (Picked unit))
                  • Animation - Change Dummyunit[Caster_Value] flying height to (Random real number between 100.00 and 300.00) at 100.00
                  • Unit Group - Add Dummyunit[Caster_Value] to Dummyunits
                  • Custom script: call RemoveLocation(udg_SoulMasterLoc)
      • Custom script: call RemoveLocation(udg_Deadunitloc)
      • Custom script: call DestroyGroup(udg_SoulCaster)
      • Trigger - Turn on SoS Loop <gen>

Trigger:
  • SoS Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 0 to Caster_Value, do (Actions)
        • Loop - Actions
          • Set SoulMasterLoc = (Position of SoulMaster[(Integer A)])
          • Set Dummyloc = (Position of Dummyunit[(Integer A)])
          • Set Angle[(Integer A)] = (Angle from Dummyloc to SoulMasterLoc)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Distance between Dummyloc and SoulMasterLoc) Less than or equal to 200.00) and ((Dummyunit[(Integer A)] is in Circling_Units[(Custom value of SoulMaster[(Integer A)])]) Equal to False)
            • Then - Actions
              • Unit Group - Remove Dummyunit[(Integer A)] from Dummyunits
              • Unit Group - Add Dummyunit[(Integer A)] to Circling_Units[(Custom value of SoulMaster[(Integer A)])]
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Dummyunit[(Integer A)] is in Circling_Units[(Custom value of SoulMaster[(Integer A)])]) Equal to True
                • Then - Actions
                  • Custom script: call RemoveLocation(udg_Offset)
                  • Set CirclingAngle[(Integer A)] = (CirclingAngle[(Integer A)] + 3.50)
                  • Set Offset = (SoulMasterLoc offset by 200.00 towards CirclingAngle[(Integer A)] degrees)
                  • Unit - Move Dummyunit[(Integer A)] instantly to Offset
                • Else - Actions
                  • Set Offset = (Dummyloc offset by 20.00 towards Angle[(Integer A)] degrees)
                  • Unit - Move Dummyunit[(Integer A)] instantly to Offset
          • Custom script: call RemoveLocation(udg_SoulMasterLoc)
          • Custom script: call RemoveLocation(udg_Offset)
          • Custom script: call RemoveLocation(udg_Dummyloc)

Trigger:
  • Cleanup
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is in SoS_Casters) Equal to True
    • Actions
      • Unit Group - Pick every unit in Circling_Units[(Custom value of (Triggering unit))] and do (Actions)
        • Loop - Actions
          • Unit - Remove (Picked unit) from the game

Trigger:
  • SSLearn
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Sense of the Souls
    • Actions
      • Unit - Add Send Soul to (Triggering unit)
      • Unit - Set level of Send Soul for (Triggering unit) to (Level of Sense of the Souls for (Triggering unit))

Trigger:
  • SSCast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Send Soul
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Circling_Units[(Custom value of (Triggering unit))] is empty) Equal to True
        • Then - Actions
          • Skip remaining actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SS_Integer Greater than or equal to 2999
        • Then - Actions
          • Set SS_Integer = 0
        • Else - Actions
          • Set SS_Integer = (SS_Integer + 1)
      • Set SS_Caster[SS_Integer] = (Triggering unit)
      • Set SS_Target[SS_Integer] = (Target unit of ability being cast)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (SS_Target[SS_Integer] is in SS_NO_DAMAGE) Equal to True
        • Then - Actions
          • Unit Group - Remove SS_Target[SS_Integer] from SS_NO_DAMAGE
        • Else - Actions
      • Set SS_Damage[SS_Integer] = (10.00 + (10.00 x (Real((Level of (Ability being cast) for (Triggering unit))))))
      • Set SS_Dummy[SS_Integer] = (Random unit from Circling_Units[(Custom value of (Triggering unit))])
      • Unit Group - Remove SS_Dummy[SS_Integer] from Circling_Units[(Custom value of (Triggering unit))]
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SS_Dummy[SS_Integer] Equal to No unit
        • Then - Actions
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: No Dummy Unit Selec...
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SS_Integer Equal to 0
            • Then - Actions
              • Set SS_Integer = 0
            • Else - Actions
              • Set SS_Integer = (SS_Integer + 1)
        • Else - Actions
          • Trigger - Turn on SSLoop <gen>

Trigger:
  • SSLoop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 0 to SS_Integer, do (Actions)
        • Loop - Actions
          • Set SS_Dummyloc = (Position of SS_Dummy[(Integer A)])
          • Set SS_TargetLoc = (Position of SS_Target[(Integer A)])
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Distance between SS_Dummyloc and SS_TargetLoc) Less than or equal to 80.00) and ((SS_Target[(Integer A)] is in SS_NO_DAMAGE) Equal to False)
            • Then - Actions
              • Custom script: call RemoveLocation(udg_SS_Dummyloc)
              • Custom script: call RemoveLocation(udg_SS_TargetLoc)
              • Unit - Cause SS_Caster[(Integer A)] to damage SS_Target[(Integer A)], dealing SS_Damage[(Integer A)] damage of attack type Spells and damage type Normal
              • Unit - Remove SS_Dummy[(Integer A)] from the game
              • Unit Group - Add SS_Target[(Integer A)] to SS_NO_DAMAGE
            • Else - Actions
              • Set SS_Dummyloc = (Position of SS_Dummy[(Integer A)])
              • Set SS_TargetLoc = (Position of SS_Target[(Integer A)])
              • Set SS_Angle[(Integer A)] = (Angle from SS_Dummyloc to SS_TargetLoc)
              • Set SS_Offset = (SS_Dummyloc offset by 20.00 towards Angle[(Integer A)] degrees)
              • Unit - Move SS_Dummy[(Integer A)] instantly to SS_Offset, facing Angle[(Integer A)] degrees
              • Custom script: call RemoveLocation(udg_SS_Dummyloc)
              • Custom script: call RemoveLocation(udg_SS_TargetLoc)
              • Custom script: call RemoveLocation(udg_SS_Offset)
 

Weep

Godspeed to the sound of the pounding
Reaction score
400
Well, I was doing this. [Note its a system and a spell together, be prepared.] [Another note, It's in GUI, be prepared again] Only thing is, it works sort of now that I removed Locust from the units in the first trigger, but Id like to keep it there. Nevertheless, It now moves units to center of the map in the Send Soul Loop, and IDK why.
I'm having a hard time following your indexing, so I'm sorry I'm not able to be as helpful as I might otherwise. :eek: Posting a test map might be useful?

I don't see a reason why removing Locust would make a difference in these triggers. :( There's an occasional leak and unnecessary condition, but I don't offhand see anything wrong that would cause the units to teleport to the center of the map, although you probably meant to use SS_Angle[] instead of Angle[] in the last trigger.
 

NeuroToxin

New Member
Reaction score
46
I'm having a hard time following your indexing, so I'm sorry I'm not able to be as helpful as I might otherwise. :eek: Posting a test map might be useful?

I don't see a reason why removing Locust would make a difference in these triggers. :( There's an occasional leak and unnecessary condition, but I don't offhand see anything wrong that would cause the units to teleport to the center of the map, although you probably meant to use SS_Angle[] instead of Angle[] in the last trigger.

Here's the problem now, it selects the unit, but it doesn't move it. At all. and Idk why. Anyways, Its pretty simple indexing, heres a map anyways.

EDIT: I inserted a condition in my looping trigger of the Send Soul, it still says no unit.

Trigger:
  • SSCast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Send Soul
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Circling_Units[(Custom value of (Triggering unit))] is empty) Equal to True
        • Then - Actions
          • Skip remaining actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SS_Integer Greater than or equal to 2999
        • Then - Actions
          • Set SS_Integer = 0
        • Else - Actions
          • Set SS_Integer = (SS_Integer + 1)
      • Set SS_Caster[SS_Integer] = (Triggering unit)
      • Set SS_Target[SS_Integer] = (Target unit of ability being cast)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (SS_Target[SS_Integer] is in SS_NO_DAMAGE) Equal to True
        • Then - Actions
          • Unit Group - Remove SS_Target[SS_Integer] from SS_NO_DAMAGE
        • Else - Actions
      • Set SS_Damage[SS_Integer] = (10.00 + (10.00 x (Real((Level of (Ability being cast) for (Triggering unit))))))
      • Set SS_Dummy[SS_Integer] = (Random unit from Circling_Units[(Custom value of (Triggering unit))])
      • Unit Group - Remove SS_Dummy[SS_Integer] from Circling_Units[(Custom value of (Triggering unit))]
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SS_Dummy[SS_Integer] Equal to No unit
        • Then - Actions
          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: No Dummy Unit Selec...
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SS_Integer Equal to 0
            • Then - Actions
              • Set SS_Integer = 0
            • Else - Actions
              • Set SS_Integer = (SS_Integer - 1)
        • Else - Actions
          • Trigger - Turn on SSLoop <gen>
          • Game - Display to (All players) the text: Running SSLoop


Trigger:
  • SSLoop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Game - Display to (All players) the text: Looping
      • For each (Integer A) from 0 to SS_Integer, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SS_Dummy[(Integer A)] Not equal to No unit
            • Then - Actions
              • Set SS_Dummyloc = (Position of SS_Dummy[(Integer A)])
              • Set SS_TargetLoc = (Position of SS_Target[(Integer A)])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Distance between SS_Dummyloc and SS_TargetLoc) Less than or equal to 80.00) and ((SS_Target[(Integer A)] is in SS_NO_DAMAGE) Equal to False)
                • Then - Actions
                  • Custom script: call RemoveLocation(udg_SS_Dummyloc)
                  • Custom script: call RemoveLocation(udg_SS_TargetLoc)
                  • Unit - Cause SS_Caster[(Integer A)] to damage SS_Target[(Integer A)], dealing SS_Damage[(Integer A)] damage of attack type Spells and damage type Normal
                  • Unit - Remove SS_Dummy[(Integer A)] from the game
                  • Unit Group - Add SS_Target[(Integer A)] to SS_NO_DAMAGE
                • Else - Actions
                  • Set SS_Angle[(Integer A)] = (Angle from SS_Dummyloc to SS_TargetLoc)
                  • Set SS_Offset = (SS_Dummyloc offset by 20.00 towards Angle[(Integer A)] degrees)
                  • Unit - Move SS_Dummy[(Integer A)] instantly to SS_Offset, facing Angle[(Integer A)] degrees
                  • Custom script: call RemoveLocation(udg_SS_Dummyloc)
                  • Custom script: call RemoveLocation(udg_SS_TargetLoc)
                  • Custom script: call RemoveLocation(udg_SS_Offset)
            • Else - Actions
              • Game - Display to (All players) the text: No Unit
 

Attachments

  • Soulstealer Pack.w3x
    34.9 KB · Views: 179

Weep

Godspeed to the sound of the pounding
Reaction score
400
Ahh, it's so much easier to debug something when you can actually try out the changes.

Here are the needed fixes. BTW, you don't have to remove Locust; Locust had nothing to do with the problem.

Trigger:
  • SoS Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 0 to Caster_Value, do (Actions)
        • Loop - Actions
          • Set SoulMasterLoc = (Position of SoulMaster[(Integer A)])
          • Set Dummyloc = (Position of Dummyunit[(Integer A)])
          • Set Angle[(Integer A)] = (Angle from Dummyloc to SoulMasterLoc)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Distance between Dummyloc and SoulMasterLoc) Less than or equal to 200.00) and ((Dummyunit[(Integer A)] is in Circling_Units[(Custom value of SoulMaster[(Integer A)])]) Equal to False)
            • Then - Actions
              • Unit Group - Remove Dummyunit[(Integer A)] from Dummyunits
              • Unit Group - Add Dummyunit[(Integer A)] to Circling_Units[(Custom value of SoulMaster[(Integer A)])]
This is re-adding the sent souls to the circling trigger. You need to provide some kind of check whether a soul has been sent; I suggest making another unit group variable, adding the souls to that unit group when they are sent, and not doing the circling trigger for dummies that are in that group.

Trigger:
  • SSLoop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Game - Display to (All players) the text: Looping
      • For each (Integer A) from 0 to SS_Integer, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SS_Dummy[(Integer A)] Not equal to No unit
That's not what it is in the map you uploaded; it's set as Equal to. What you posted, Not equal to, is what it should be.

Trigger:
  • Set SS_Offset = (SS_Dummyloc offset by 20.00 towards Angle[(Integer A)] degrees)
    • Unit - Move SS_Dummy[(Integer A)] instantly to SS_Offset, facing Angle[(Integer A)] degrees
I think you mean to use SS_Angle[], not Angle[].

Attached is a fixed map.
 

Attachments

  • Soulstealer Pack.w3x
    35.6 KB · Views: 181

NeuroToxin

New Member
Reaction score
46
<3 Thanks :p I always make some idiotic mistakes. +Rep and I know, its so much easier to do on a test map.

One quick thing though, I tested it and it works, but the dummy is never headed exactly for the unit, its always off a little bit, any ideas? Usually it heads straight for them.
 

Attachments

  • Fail Angle.jpg
    Fail Angle.jpg
    418 KB · Views: 286

Weep

Godspeed to the sound of the pounding
Reaction score
400
I'm pretty sure it's just up in the air due to the flying height. You could reset it to 0 at rate 100 or something when sending a soul, maybe.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top