• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Locusted Unit Not Being Selected?

Status
Not open for further replies.
Level 6
Joined
Aug 20, 2009
Messages
95
Okay, in my spell-pack I'm using Custom Value of units as a way to determine which dummy units belong to which unit. When I try to select a unit to move it (It's locusted) it does not select the unit. I do a random unit from the CirclingUnits[Custom value of (Triggering unit)] and I know it's not empty, it ALWAYS returns null. Heres the map.
The triggers are a lot longer.
  • 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 - 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>
  • 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)
  • 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))
  • 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 SoS_Casters = (Units owned by (Owner of (Triggering unit)) matching ((Custom value of (Matching unit)) Not equal to (Custom value of (Triggering unit))))
      • Set SS_Dummy[SS_Integer] = (Random unit from SoS_Casters)
      • Unit Group - Remove SS_Dummy[SS_Integer] from Circling_Units[(Custom value of (Triggering unit))]
      • Game - Display to (All players) the text: (String((Unit-type of SS_Dummy[SS_Integer])))
      • Trigger - Turn on SSLoop <gen>
  • 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)])
          • Set SS_Angle[(Integer A)] = (Angle from SS_Dummyloc to SS_TargetLoc)
          • 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)
              • Game - Display to (All players) the text: Damaging
              • 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_Offset = (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
              • Game - Display to (All players) the text: Moving
              • Custom script: call RemoveLocation(udg_SS_Dummyloc)
              • Custom script: call RemoveLocation(udg_SS_TargetLoc)
              • Custom script: call RemoveLocation(udg_SS_Offset)
 

Attachments

  • Soulstealer Pack.w3x
    34.5 KB · Views: 50
Level 22
Joined
Sep 24, 2005
Messages
4,821
IIRC, locusted units cannot be retrieved by group enum functions, better put the locusted units in a group first then do your actions for the said group.
 
Level 22
Joined
Sep 24, 2005
Messages
4,821
Dr Super Good, is the player group enum available in gui? It seems like the most easiest solution to illegalpie's problem.

illegalpie, could you elaborate on what your spell does, I can't give a clear solution because I can't understand GUI triggers, sorry.

EDIT
Try using this group enumeration, I checked the script and it uses the player enumeration grouping.
  • Locut grouping
    • Events
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units owned by Player 1 (Red)) and do (Actions)
        • Loop - Actions
 
Dr Super Good, is the player group enum available in gui? It seems like the most easiest solution to illegalpie's problem.

Yes. @illegalpie: It would look something like this:
  • Set GroupVar = Units owned by Neutral Passive matching ((Unit-type of (Matching Unit)) Equal to Dummy)
Something like that. :p Just change "Neutral Passive" to whatever player you are making the dummies for and change "Dummy" to your dummies' unit type.
 
Level 6
Joined
Aug 20, 2009
Messages
95
Yes. @illegalpie: It would look something like this:
  • Set GroupVar = Units owned by Neutral Passive matching ((Unit-type of (Matching Unit)) Equal to Dummy)
Something like that. :p Just change "Neutral Passive" to whatever player you are making the dummies for and change "Dummy" to your dummies' unit type.

In my spellpack, The Sense of Souls spell, simply is a passive, whenever a unit dies, whoever has this passive will create a dummy unit on death, and it will fly towards the caster, after it has reached within 200 of the caster, it will rotate around him. The other spell, Send Soul, is supposed to take a random dummy unit from the CASTERS dummy units (Or souls), and send it towards the targeted unit, until it reaches it, when it does it will deal X damage, then it's essence will be removed. Therefore I can't take a random unit of type or owned by player.

This won't work either, after I'm done with this spellpack, I plan on uploading here, therefore it needs to be MUI (At least in my mind) and when I pick a random unit of that type, it could be any dummy unit owned by any player, I use custom value as a way to "Attach" the units to the caster.

My only other option would be to find a way to choose a random unit from the group.
 
You need hashtables for that. Upon creation of your hero, if it's a trained one, use:
  • Tr
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Hashtable - Create a Hashtable
    • Set Hash = (Last created hashtable)
Trained hero:
  • Trigger
  • Events
    • Unit - A unit finishes training a unit
  • Condition
    • (Unit-type of (Triggering unit)) Equal to <Your hero>
  • Actions
    • Custom script: local group g = CreateGroup()
    • Custom script: call SaveGroupHandle (udg_Hash, GetHandleId (GetTrainedUnit()), StringHash("dummygroup"), g)
Created hero (with Unit - Create unit action):
  • t
  • Events
    • ...
  • Conditions
    • ...
  • Actions
    • Custom script: local group g = CreateGroup()
    • Set Point1 = (your hero's creation point, e.g. (Center of (Hero Region <gen>)))
    • Unit - Create 1 Soulhound for (your player) at Point1 facing Default building facing degrees
    • Set Hero1 = (Last created unit)
    • Custom script: call SaveGroupHandle (udg_Hash, GetHandleId (udg_Hero1), StringHash("dummygroup"), g)
    • Custom script: call RemoveLocation (udg_Point1)
Then, whenever you are going to take some dummy away from the caster's group:
  • Tr
  • Events
    • Unit - A unit starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Send Soul
  • Actions
    • Set Unit1 = (Random unit from (Load Key(dummygroup) of (Key(Triggering unit)) from Hash))
    • Unit Group - Remove Unit1 from (Load Key(dummygroup) of (Key(Triggering unit)) from Hash)
    • ///Now, you can add it to a new unit group, which will be running via a periodic event, moving it towards the target enemy. You also need to save the enemy, like:
    • Custom script: call SaveUnitHandle (udg_Hash, GetHandleId (udg_Unit1), StringHash("target"), GetSpellTargetUnit())
and you will load the target back, exactly like the way I loaded the "dummygroup".
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
Like we said, the locust ability makes the unit be ignored from area group enums. It will only be choosen with all units of player group enums.

Hashtables do work, if they do not work for you you eithor have not updated to the lattest patch or are using them incorrectly.
 
Status
Not open for further replies.
Top