# Replaced Unit won't Attack-Move

#### Widescreen

##### Member
Hello, I have a wave of minions that as soon at it appears it will Attack-Move to one of two enemy tower lines, but once it reaches the middle it will be replaced by another minion. Everything good so far. My problem is that the replaced minion will stay still once it is converted, this is the code I have which is wrong:

(The spirit tower is the Final tower or "Nexus")

I would like for the minions, once they have converted, to attack-move to a random 1 of two enemy lines. the waves consist of 6 minions and the ideal will be for 3 to go to one enemy line and the other 3 to the other(once they are replaced).

#### AceHart

Well, splitting 6 minions into 3 and 3 is not "random 1 of ..."

For a perfect split, something like this might do:

On Map Init, prepare a point array with the positions of those towers:
Set Towers[1] = Position of pre-placed-tower-1
Set Towers[2] = Position of pre-placed-tower-2

And some integer variable that starts at 1 (I called it CurrentTower below)

The sending them off part could then be:
Unit - Order (Last replaced unit) to ... to Towers[CurrentTower]
Set CurrentTower = 3 - CurrentTower

#### Widescreen

##### Member
I didn't understand can you be more specific, please? The target of the replaced minion are 3 towers (three on one side and 3 on the other) not 1, and there should be something for when the first tower or second and even the last one is destroyed to move on to the next one (if the last one is not destroyed).

#### AceHart

Oh, really?
THEN WHY THE DAMN CRAP WAS THAT INFO NOT IN POST #1???
Do you really think that anyone would just randomly guess what the problem is?
Are people really that out of sync with reality?

Basically, posts #1 and #3 and mutually exclusive... wtf

#### AceHart

Well, that of course changes everything... you should have started there.

This just needs a bit of fine-tuning then.
As in, you need to keep track of what tower is currently the "first" in each line, and adjust as needed.
Then use the splitting system from above as long as there are towers in both lines, and ... as needed if one line is empty.

I have attached a demo-map here.
You can kill towers, and footman, by clicking them, so it's easy to test it out in all variations.
Note: only ever kill the towers in order!

#### Attachments

• 43 KB Views: 400

#### Widescreen

##### Member

Oh, really?
THEN WHY THE DAMN CRAP WAS THAT INFO NOT IN POST #1???
Do you really think that anyone would just randomly guess what the problem is?
Are people really that out of sync with reality?

Basically, posts #1 and #3 and mutually exclusive... wtf
Dude! Chill out for the love of sake! I mention that it was a tower line so that means more than 1 tower. Your post was really useful and I am thankful but I can't get them to go to one of the two lines, would you mind giving the code a quick glimpse?

#### Attachments

• 411 KB Views: 381

#### AceHart

"It doesn't work" is not a very good problem description...

What are we looking at here?
When does the problem show?
How does it show?
Can I make it happen, or do I need to wait for... some magical moment?

What is sort of obvious from a look at the triggers:
- HasTowersUp and friends need to start at true, so either in some init trigger or directly in the variable editor
- UpOrDown should be initialized to 1 and there really needs to be one such variable per trigger, not one for all three
- Splitting Green probably wants to work with ...Right and ...Down rather than ...Up and ...Down

Random notes:
- Summon Roderal costs 125 mana, on a Hero that starts with 105
- Zyla can not be selected

#### Widescreen

##### Member
"It doesn't work" is not a very good problem description...

What are we looking at here?
When does the problem show?
How does it show?
Can I make it happen, or do I need to wait for... some magical moment?

What is sort of obvious from a look at the triggers:
- HasTowersUp and friends need to start at true, so either in some init trigger or directly in the variable editor
- UpOrDown should be initialized to 1 and there really needs to be one such variable per trigger, not one for all three
- Splitting Green probably wants to work with ...Right and ...Down rather than ...Up and ...Down

Random notes:
- Summon Roderal costs 125 mana, on a Hero that starts with 105
- Zyla can not be selected
Thank you very much. Yes, the game is on early stage it has become a problem that the hero will not be selected when first entering and I don't know why, maybe by duplicating the trigger?

#### AceHart

Well, some more looking:
> (Owner of (Entering unit)) Equal to (Random player from (All allies of Player 10 (Light Blue)))

Replace with:
((Triggering unit) belongs to an ally of Player 10 (Light Blue)) Equal to True

Same for the other conditions and teams

#### 3ICE

##### Cool Member
I bet "Replace" does not trigger the "unit enters region" event again. That's your problem. Edit: Elaborating: The minions being replaced with enchanted minions in the middle are already inside the region "center" when they are replaced, so technically the new units never entered center - the whole UpOrDown thing never fires. Here's a far simpler solution:
Event - Unit enters center
Condition: Unit type is Minion
Actions:
Replace unit with Enchanted Minion
If UpOrDown
Order unit to attack up
Else
Order unit to attack down

p.s.: I've seen you create "else" actions that Do nothing. Allow me to convince you to not do that: http://www.3ice.hu/blog/do-nothing-is-evil/

Last edited:
General chit-chat
Help Users
• No one is chatting at the moment.
• jonas:
It would suck to spend 400\$ on a system that doesn't have the capability you need
• jonas:
and it will probably take a couple of tries to get the settings right
• Varine:
It would but I can also just make sure I can return them. The system I have works, it's pretty straightforward and I tested it with a camera I have. All it really is is a little cartridge that holds the transparency film and a white light source behind it that projects the image into the lens
• Varine:
I'll have to fuck with the light a bit and try some different lighting methods to get color accuracy, but I have IT8 targets for that
+1
• The Helper:
get that color accuracy
• Varine:
They're really helpful for calibrating things because I'm really colorblind, so I'm not great at doing it by eye
+2
• Varine:
Well the long, slow slog of winter has officially begun here
• Varine:
I have a bunch of community service I have to do, and I have a feeling there will be a lot of snow shoveling involved now
• The Helper:
don't know why people choose to live in that kind of weather
• Varine:
Well
• Varine:
My job is here
• Varine:
I was born here man I didn't choose shit
• Varine:
And also, I keep moving away and it doesn't get any better. I moved to San Antonio and shit froze there AND we had blackouts
• tom_mai78101:
I'm back, suffering from severe jet lag.
• The Helper:
Cold is following your ass around Varine - I just dont think I could handle a snowy winter.
• The Helper:
Welcome Back Tom!
• The Helper:
I hear that taking a Melatonin around your normal bedtime can really fix jet lag
• tom_mai78101:
Yeah, I also heard about that as well. I think I'm good. I'm just lucky it's the weekend so I have some time to readjust.
+1
• Varine:
It was a fucking blizzard today, shoveling was an effort in futility.
• Varine:
Melatonin gives me nightmares
• Varine:
They had me shoveling out the parking lot for the jail. Fucking pointless, they need a blow.
• Varine:
Well they gave me a snow blower but it was too wet to do much with with other than compact everything. Oh well, the cop cars can get into there now when they arrest people I guess
+1

### Members online

No members online now.