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

How do i make unit go through other units?

Status
Not open for further replies.
Level 11
Joined
Dec 5, 2009
Messages
846
Hello im making a spell Stone wall. And i want it at lvl 3 that allies can go through the wall but not enemys. I can't remove collision when a ally comes near. Then it will be path bugs and if a enemy unit is just behind the ally unit the enemy unit can go through aswell and i don't want that xP

Well thanks if you guys help me!

Regards Chewii.
 
Level 11
Joined
Dec 5, 2009
Messages
846
Okay but the wall composed by units and how can i save the last created unit when he does the spell? cuase if the unit uses this wall spell then somone else uses another dummy spell what should i do then i can do pick every enemy units in 120 range from last created unit blah blah you know. And the save should last atleast 20 seconds. If you can help me with that it would be awesome!

Regards Chewii
 
Level 11
Joined
Dec 5, 2009
Messages
846
Well i already posted them :p i did the spell its a rock wall spell that creates a wall of rock pieces. And if a piece of the wall is destroyed it deals dmg but allies can't go through the wall at lvl 1 and 2 but they can go through the wall at lvl 3. Well i could as maker said that pick near units the wall that's compsed by units. But when he casts the spell the units spawn. Then they're last created unit. But if someone else does the any other dummy spell they're not last created units then i can't pick nearby enemy units the wall dummies. So i want to save the last created unit in someway :p
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Add the last created unit(s) to a unit group, and then loop through the group, like this:

  • Untitled Trigger 005
    • Actions
      • Unit Group - Add (Last created unit) to Wall_Group
  • Untitled Trigger 006
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Wall_Group and do (Actions)
        • Loop - Actions
 
When you add the unit and pick it from what Maker suggested, just set a point to check its position and set a unit group that checks every unit within 130.00 range of your picked unit. If the Picked unit is an enemy (Boolean Comparison), set its position and set an additional point with offset towards (facing of (Picked unit) - 180) [To move it backwards] and Unit - Move (Picked unit) to your point offset.
 
  • Actions
    • Unit Group - Add (your unit) to TempGroup
    • Trigger - Turn on Trigger2 <gen>
  • Trigger2
  • Events
    • Time - Every 0.03 seconds of game-time
  • Conditions
  • Actions
    • If (All conditions are true) then do (Actions) else do (Actions)
      • If - conditions
        • (TempGroup is empty) Equal to True
      • Then - Actions
        • Trigger - Turn off (This trigger)
      • Else - Actions
        • Unit Group - Pick every unit in (TempGroup) and do (Actions)
          • Loop - Actions
            • Set Points[1] = (Position of (Picked unit))
            • Set Group = (Units within 130.00 of (Points[1]))
            • Set Unit1 = (Picked unit) //Unit1is a "Unit" variable
            • Unit Group - Pick every unit in Group and do (Actions)
              • Loop - Actions
                • If (All conditions are true) then do (Actions) else do (Actions)
                  • If - Conditions
                    • ((Picked unit) belongs to an enemy of (Owner of (Unit1))) Equal to True
                  • Then - Actions
                    • Set Points[2] = (Position of (Picked unit))
                    • If (All conditions are true) then do (Actions) else do (Actions)
                      • If - Conditions
                        • (Distance between Points[1] and Points[2]) Less than 130.00
                      • Then - Actions
                        • Set Points[3] = (Points[1] offset by 140.00 towards (Angle from Points[1] to Points[2])
                        • Custom script: call SetUnitX (GetEnumUnit(), GetLocationX(udg_Points[3])
                        • Custom script: call SetUnitY (GetEnumUnit(), GetLocationY(udg_Points[3])
                        • Custom script: call RemoveLocation (udg_Points[3])
                    • Custom script: call RemoveLocation (udg_Points[2])
            • Custom script: call DestroyGroup (udg_Group)
            • Custom script: call RemoveLocation (udg_Points[1])
 
Last edited:
Level 11
Joined
Dec 5, 2009
Messages
846
But the two custom scripts doesn't work i did like this

  • Custom script: call SetUnitX (GetEnumUnit(), GetLocationX(udg_SW_SavePoint[3])
and

  • Custom script: call SetUnitY (GetEnumUnit(), GetLocationY(udg_SW_SavePoint[3])
I got syntax error :( please help.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
Why would you want any units to walk through a wall? Have you not heard of a gate?

Anyway, I seriously do not advise the perodic trigger Pharaoh_ gave. It will most certainly lag your map if there are many walls (20 will probably start to kill weaker computers).
 
Level 13
Joined
Mar 4, 2009
Messages
1,156
sorry because this post is big and not well described but i think people will know the idea
1.)


something like this could be made ( i think ....)


create 2 units (unit A and unit B)

A and B (units) are walls´s endings (from beginning to end)

A------------------------------------------B



so if enemy is ordered to go trough "---------------"

-order unit to move to nearest ending of wall (it can be A or B) and after he comes to (A or B) he must be ordered to go to "real" ordered location
-i think that with real ordered location could be a bit of a problem,but if it is just ordered by computer (creep),u can use rally as dummy rally that will save the real ordered location so that unit will know where to move when he comes to A or B (the ending of wall)


-this is what should happen
-if unit is enemy
than if he is ordered to go trough wall,trigger will ordered him to go to the end of wall (A or B) and when he comes to ending than he goes to ordered location


2.)
- i think this cant be made nice

make a lot of portals ... ( "O" is portal , "----" is wall) visible to allies (add invisibility to them)

OOOOOOOOO
-------------
OOOOOOOOO

So when allied unit is ordered to go trough wall he will automatically go trough portal to pass it

3.)
make dummy enemy units in walls´s line (under the wall)

"O" is dummy, (where is O there is wall)

OOOOOOOOOO

now if enemy unit comes near wall he must be attacked by dummy units

each attack needs to turn off collusion for 1 second and collusion needs to be turned on when 1 second passed ( i think this is hard to do xD )
 
Last edited:
Status
Not open for further replies.
Top