• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

How can you make a unit with locust stop when...

Status
Not open for further replies.
Level 8
Joined
Aug 1, 2008
Messages
420
What i want is, a unit with Locust to walk over to an enemy unit and stop infront of them. Will i have to use regions to acknowledge when their next to the unit? Because if i use
  • Order unit to move to CasterTarget
(CasterTarget being the point where i aimed, aka the target), he will just walk right through him because he has locust. Is there also any way to make a unit unselectable and unattackable (by patrolling and stuff) but also make them have collision size?
 
  • Trigger
  • Events
    • Time - Every 0.05 seconds of game-time
  • Conditions
    • ((TargetUnit1) is alive) Equal to True
  • Actions
    • Set Point1 = (Position of (DummyUnit1))
    • Set Point3 = (Position of (TargetUnit1))
    • Set Point2Offset = ((Point1) offset by 10.00 towards (Angle from Point1 to Point3))
    • Unit - Move DummyUnit1 instantly to (Point2Offset)
    • If/ Then/ Else
      • If (Conditions)
        • (Distance between Point1 and Point3) Less than or Equal 55.00
      • Then (Actions)
        • Trigger - Turn off (This trigger)
        • Now, you can do anything you want with the DummyUnit1 and the TargetUnit1
      • Else (Actions)
    • Custom script: call RemoveLocation (udg_Point1)
    • Custom script: call RemoveLocation (udg_Point3)
    • Custom script: call RemoveLocation (udg_Point2Offset)
Notice that this trigger should be not initially enabled and that the "TargetUnit1" and the "DummyUnit1" refer to the units stored within "Unit" variables in the previous trigger, the one you used to turn THIS trigger on.

Locust doesn't affect collision size, so, you can have Locust and Collision size at the same time, as you wish.
 
Level 16
Joined
Jul 21, 2008
Messages
1,121
This is a simple "moving" function and it is good because you don't have to mess with location leaks.

  • Custom Script: call IssuePointOrder(YourDummy, "move", GetUnitX(YourTarget), GetUnitY(YourTarget))
Your trigger could go like this:
  • Spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
    • Actions
      • -------- Put whatever condition you want --------
      • Set TempPoint = (Position of (Triggering unit))
      • Unit - Create 1 DummyUnit for (Owner of (Triggering unit)) at TempPoint facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_TempPoint)
      • -------- Set the target in the variable --------
      • Set Target = (Target unit of ability being cast)
      • -------- And don't change function below --------
      • Custom script: call IssuePointOrder(bj_lastCreatedUnit, "move", GetUnitX(udg_Target), GetUnitY(udg_Target))
 
Level 8
Joined
Aug 1, 2008
Messages
420
And how would i make it stop infront of the unit with that trigger? Or is it already done. Because im making a spell and ill copy/paste the triggers when i get on my normal computer so you can see what ive done. (on laptop atm)

@Pharoah_ And for some reason i put collision size to 50.00, but he still walks right through the unit. and i put him to Walk aswell, not float or anything
 
Level 8
Joined
Nov 9, 2008
Messages
502
Giving a unit Locust will remove collisions.

What you want is to use an offset as stated before but a better version would be a polar offset...

  • Actions
    • Set TempPoint[1] = (Position of (MovingUnit))
    • Set TempPoint[2] = (Position of (TargetUnit))
    • Set TempPoint[3] = (TempPoint[2] offset by 256.00 towards (Angle from TempPoint[2] to TempPoint[1]) degrees)
    • Unit - Order (MovingUnit) to Move To TempPoint[3]
    • Custom script: call RemoveLocation(udg_TempPoint[1])
    • Custom script: call RemoveLocation(udg_TempPoint[2])
    • Custom script: call RemoveLocation(udg_TempPoint[3])
You could do it without the variables but it will leak ;)
 
Level 8
Joined
Aug 1, 2008
Messages
420
Whats the difference between offset/polar offset?
And ill post the triggers i have already (when i posted this thread, havnt made any changes since) :/ (ill take out the special effects so its not so big)

  • Death call
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Death Call
    • Actions
      • Set Caster = (Casting unit)
      • Set CasterLocation = (Position of Caster)
      • Set TargetLoc[1] = (Target point of ability being cast)
      • Set CasterTarget = (Target unit of ability being cast)
      • Set SummonPoint = (CasterLocation offset by 256.00 towards (Angle from CasterLocation to TargetLoc[1]) degrees)
      • Unit - Pause Caster
      • Unit - Pause CasterTarget
      • Wait 1.90 seconds
      • Trigger - Run Special Effects <gen> (ignoring conditions)
      • Wait 1.80 seconds
      • Unit - Create 1 Dummy for (Owner of Caster) at SummonPoint facing TargetLocation
      • Set Dummy = (Last created unit)
      • Wait 1.50 seconds
      • Unit - Order Dummy to Move To TargetLocation
What edits do i need to make to this then?

And the offset, im thinking if i set it, then the unit wouldnt stop infront of the unit every time in every direction (meaning if i cast and the unit is to the right, then he stops infront of it. but then i cast again on a unit above me wouldnt he move to a different position? Or am i just stupid? :O)
 
Level 8
Joined
Nov 9, 2008
Messages
502
Using polar offset like I showed means a unit moving from the right will stop to the right of the targer whilst a unit moving from the north will stop north of the unit.
 
Level 8
Joined
Aug 1, 2008
Messages
420
Ah ok.. So my theory is wrong?
And will your trigger stop the dummy exactly right infront of the target, like melee range? Or will i have to play around with the "256"
 
Level 8
Joined
Aug 1, 2008
Messages
420
Is there any way to take locust off of it, but still not have it selectable? and untargetable of course (even with patrol)
 
Level 8
Joined
Aug 1, 2008
Messages
420
I can still select it with -1.00, also with the grid-circle selection thing (click and drag box)
this is weird... is there anything else to make it un-selectable?
nvm, solved. Dont worry about it :p
 
Last edited:
Level 8
Joined
Nov 9, 2008
Messages
502
Hold on a minute. You are telling me that the ability that is widely used on units to make them dummies does not actualy remove collisions?

So why is it my Paladin is walking through the Footman I just gave locust to??
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
and FASTER than others
You used GUI so speed already is not really a factor.

Locust removes collision, makes the unit unattackable, makes it ignored by some unit group selection natives and prevents selection however still lets the unit collide with terrain. As far as I know.

your dummy will just move to units position and stop.
Is that not simlar to what the person was requesting?
What i want is, a unit with Locust to walk over to an enemy unit and stop infront of them
 
Status
Not open for further replies.
Top