# How to make neutrals run away from units that run close

Status
Not open for further replies.

#### BlackEnvyX

Level 14
Basically I need to figure out a trigger that makes it so when any unit nears (gets within 250 distance) a unit (this unit is a deer in my map), the deer will run 1000 distance in a random direction away from the nearing unit. How would I go about doing that?

Level 21
• Run Away Deer!
• Events
• Unit - A unit comes within 250 range of Deer
• Conditions
• Actions
• Order Deer to Move To ((Position of (Deer)) offset by 1000 towards (Random real number between 0.00 and 360.00) degrees)
If you need help to make the triggers, I'll tell you how to do them.
Use variables for the position, I am just too lazy to put them.

#### BlackEnvyX

Level 14
• Run Away Deer!
• Events
• Unit - A unit comes within 250 range of Deer
• Conditions
• Actions
• Order Deer to Move To ((Position of (Deer)) offset by 1000 towards (Random real number between 0.00 and 360.00) degrees)
If you need help to make the triggers, I'll tell you how to do them.
Use variables for the position, I am just too lazy to put them.

What exactly do you mean use variables for the position? Do I have to make a "Real" variable?

Level 21
Create a Point variable and call it, for example, DeerPosition. Then, do this:

• Set DeerPosition = (Position of Deer)
Replace then ((Position of Deer)) in the trigger above with DeerPosition variable

#### BlackEnvyX

Level 14
Create a Point variable and call it, for example, DeerPosition. Then, do this:

• Set DeerPosition = (Position of Deer)
Replace then ((Position of Deer)) in the trigger above with DeerPosition variable

Thank you so much for this! I'd give additional rep to you but it won't let me right now.

Level 21
Thank you so much for this! I'd give additional rep to you but it won't let me right now.

It doesn't matter. The most important thing is that you benefited. Good luck with your projects.

#### BlackEnvyX

Level 14
It doesn't matter. The most important thing is that you benefited. Good luck with your projects.

Thanks dude! I've got my one project that I'm working on that I can hopefully have a beta up within a week or two.

#### blancfaye7

Level 9
Don't forget to get rid of leaks.

Status
Not open for further replies.

Replies
9
Views
537
Replies
4
Views
802
Replies
8
Views
1K
Replies
16
Views
1K
Replies
8
Views
423