• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Force units to stay in a region?

Status
Not open for further replies.
Level 28
Joined
Mar 25, 2008
Messages
2,955
Hi everyone ^^
I have a little problem.
As many of you know, a TD consists mainly of towers. Now i made a race which can run around freely.
Works fine unit the point that they should have an area to walk which is define by a tower.
Like:
Code:
________________________
|           o           |
|                       |
|               X       |
|  o o                  |
|                       |
|                    o  |
|_______________________|
x is the tower and o are the units

The thing is, the position of the tower should center the region (at persent a rect with size 2000x2000). If they leave the region, they are moved back 50 wcunits so they can't go further. That works well for one player but as i have 9 possible players playing that race, the regions get mashed up and in the end the units can move where they want -.-
I also tried it via an aura with a certain aoe and if a unit leaves that aoe it's forced to move back but that didn't work fine -.-
So, any solutions for me ? ^^
 
Level 9
Joined
May 30, 2008
Messages
430
try to make
Untitled Trigger 001
Events
Unit - A unit leaves Region 000 <gen>
Conditions
(Unit-type of (Triggering unit)) Equal to Footman
Actions
Unit - Order (Matching unit) to Move To (Center of (Playable map area))

i don't know if this work but must work i think
 
Level 3
Joined
Feb 24, 2008
Messages
67
try to make
Untitled Trigger 001
Events
Unit - A unit leaves Region 000 <gen>
Conditions
(Unit-type of (Triggering unit)) Equal to Footman
Actions
Unit - Order (Matching unit) to Move To (Center of (Playable map area))

i don't know if this work but must work i think

This won't work. The (matching unit) is wrong. Instead use:

  • Events
    • Unit - A unit leaves <your region here>
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to <your unit here>
  • Actions
    • Unit - Order (Triggering unit) to Move To (Center of (<your region here))
You can also order the triggering unit to move to random point in <your region here>.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
That will not do it quite well neither :D
The conditions should be(the correct condition from this):
Player(owner of unit(triggering unit)) equal to Player(owner of the creeps)
 
Level 3
Joined
Feb 24, 2008
Messages
67
That will not do it quite well neither :D
The conditions should be(the correct condition from this):
Player(owner of unit(triggering unit)) equal to Player(owner of the creeps)

The conditions is up to the threadstarter to decide which units can get out from the region and what units cannot. I'm just helping with the actions and telling him what to do to prevent units from escaping a certain region.
 
Level 28
Joined
Mar 25, 2008
Messages
2,955
ok, let me explain a bit more.
When a tower is built, this tower defines the center of a (new) region.
The units built by this tower may only move within this region, not any further.
I tested it in SinglePlayer and it worked.
But when it comes to multiplayer, it seems that the regions get fucked up and the units move where they want.
The problem is that the region isn't predefined.
And sry. i don't know how to set up multiple regions for different players.
I tried checking how much players chose this race via an IntegerLooo but it didn't work -.-
 
Level 3
Joined
Jun 23, 2007
Messages
32
you can set a region for multiple players by making the region created a variable of type region array.

the index of the array will be the player number.

but if this tower can be created multiple times, i dont know how you would do that.
 
Level 3
Joined
Jun 23, 2007
Messages
32
i am having a similar problem too.

i'm using variable arrays and trying to use player numbers as indices, but it doesn't always work.

does anyone know how to do that?

i think sometimes, even if you put say, (player number) of owner of (triggering unit), it just returns 1.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
The conditions is up to the threadstarter to decide which units can get out from the region and what units cannot. I'm just helping with the actions and telling him what to do to prevent units from escaping a certain region.
Yes, the tread starter (or anyone that finds a tread useful) decides for himself, but are by no means forbidden to suggest him ... that is the point
But anyway I was wrong as I did not understand what Squiggy wanted.
ok, let me explain a bit more.
When a tower is built, this tower defines the center of a (new) region.
The units built by this tower may only move within this region, not any further.
I tested it in SinglePlayer and it worked.
But when it comes to multiplayer, it seems that the regions get fucked up and the units move where they want.
The problem is that the region isn't predefined.
And sry. i don't know how to set up multiple regions for different players.
I tried checking how much players chose this race via an IntegerLooo but it didn't work -.-
How are these units created?
Will you use something like Local Handle Variables?
 
Status
Not open for further replies.
Top