HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Attack-Move To. How to get it right?

05-12-2007, 08:46 AM#1
dagees
I just started experimenting with making maps and doing some basic triggering inside the World Editor. I do it with v1.21 of Reigns of Chaos. But I am having some trouble with basic stuff:

I just want to spawn a group of units and make them attack a point.

I spawn like 5 footman, and then tell them to attack move to some region on the map. So, I see those footman, and they start to walk. But after walking a bit, they turn around and return to the place I spawned them, and just keep standing there doing nothing.

So I red that I should set the aquisition range to a higher value... I experimented with this and for example set that range to 100.000. Or I set the range with scripting to the width of the entire map.

That makes a little difference. The units seem to walk a little further, but still keep returning to the spawn spot.

--------------------------------------

So, I also red that I should create several regions between the spawning point and the attack point. Then, by using triggers, I should control the attack.

For example, I create 3 regions between the spawn point and the final attack point. Then, I create triggers for those 3 regions. Something like this:

Trigger:
Region0
Collapse Events
Unit - A unit enters Region 000 <gen>
Collapse Conditions
((Triggering unit) is in grpUnits) Equal to True
Collapse Actions
Unit Group - Order grpUnits to Attack-Move To (Random point in Region 001 <gen>)

Ok. This works a little better. I place those regions between the point where the spawned units normally would return to the spawn point. But it still isn't working very good. Often the units enter for example region 2, do some fighting there and then walk back to region 1, instead of walking to region 3. At region 1 they are triggered to attack move to region 2. With some luck they make it to region 2 and then are triggered to attack move to region 3. However, it something goes wrong, it just doesn't work.

--------------------------------------

Finally, I just made this dirty solution:

Trigger:
MoveIT
Collapse Events
Time - Every 3.00 seconds of game time
Conditions
Collapse Actions
Unit Group - Order varGroup to Attack-Move To (Random point in Region 001 <gen>)
Game - Display to (All players) the text: Attacking...

And it works. But it seems like a very bad solution. Beside that, the units walk less realistic, and when at some moment the are attacked between the final point they often just ignore the attack and just keep on walking.

So now I am out of clues. How to get this right? It seems simple enough?

--------------------------------------

Further question:
Is it possible to get heroes with higher levels then level 10 in Reigns of Chaos? I red that you can do the easily in The Frozen Throne, but it doesn't seem to work with Reigns of Chaos.

Is it possible to set the computer difficulty (easy, normal, insane) with the trigger editor? I found out that it is possible to detect that difficulty, but didn't found a way to set it.

Responses will be greatly appreciated....
05-12-2007, 01:23 PM#2
Vexorian
In the first trigger you should only order triggering unit to move to that region, also remove that location else that map is going to die out of memory leaks.

Computer difficulty just works for melee maps when you run ai scripts.
05-12-2007, 04:43 PM#3
dagees
Thank you for your reply. I also thought about your suggestion (order triggering unit instead of the unit group) myself, and it is better.

However, it still isn't working perfectly that way. I spend the whole day trying stuff. Now I found a solution.

When I spawn my units, I call : Melee Game - Run melee AI scripts (for computer players)

And voila! They are computer controlled and run like they should ;) The unit are given to a computer player when I spawn them

Quote:
Computer difficulty just works for melee maps when you run ai scripts.

Ok... It is a melee map, with several computer players. I just want to make the map more difficult, so I occasionally spawn those extra units. However, I still don't know how to set the difficulty to insane?

And.. Is it possible to get heroes beyond level 10 in Reigns of Chaos?

Btw, this is the code I am using now:

Trigger:
PurpleSpawn
Collapse Events
Time - Elapsed game time is 1.00 seconds
Conditions
Collapse Actions
Unit - Create 1 Paladin for Player 4 (Purple) at (Center of Purple1 <gen>) facing Default building facing degrees
Unit Group - Add (Last created unit) to grpUnits
Unit - Create 1 Archmage for Player 4 (Purple) at (Center of Purple1 <gen>) facing Default building facing degrees
Unit Group - Add (Last created unit) to grpUnits
Unit - Create 1 Mountain King for Player 4 (Purple) at (Center of Purple1 <gen>) facing Default building facing degrees
Unit Group - Add (Last created unit) to grpUnits
Unit - Create 1 Arthas (wielding Frostmourne) for Player 4 (Purple) at (Center of Purple1 <gen>) facing Default building facing degrees
Unit Group - Add (Last created unit) to grpUnits
Unit - Create 1 Jaina for Player 4 (Purple) at (Center of Purple1 <gen>) facing Default building facing degrees
Unit Group - Add (Last created unit) to grpUnits
Unit - Create 1 Sylvanas Windrunner for Player 4 (Purple) at (Center of Purple1 <gen>) facing Default building facing degrees
Unit Group - Add (Last created unit) to grpUnits
Melee Game - Run melee AI scripts (for computer players)
Wait 1.00 seconds
Unit Group - Pick every unit in grpUnits and do (Unit - Kill (Picked unit))
Wait 1.00 seconds
If (blnDebug Equal to True) then do (Game - Display to (All players) the text: PurpleSpawn Fired) else do (Do nothing)

Trigger:
PurpleSpawnLoop
Collapse Events
Time - Every 10.00 seconds of game time
Collapse Conditions
(All units of grpUnits are dead) Equal to True
Collapse Actions
Set varCount = (varCount + 1)
If ((HardTower 0101 <gen> is alive) Equal to False) then do (Game - Display to (All players) the text: First Wave Tower is...) else do (Do nothing)
If ((HardTower 0101 <gen> is alive) Equal to False) then do (Trigger - Turn off (This trigger)) else do (Do nothing)
Unit Group - Pick every unit in grpUnits and do (Hero - Instantly revive (Picked unit) at (Center of Purple1 <gen>), Show revival graphics)
Unit Group - Pick every unit in grpUnits and do (Unit - Set (Picked unit) acquisition range to (Width of (Entire map)))
Item - Create Potion of Speed at (Random point in (Playable map area))
Hero - Give (Last created item) to (Random unit from grpUnits)
Item - Create Potion of Healing at (Random point in (Playable map area))
Hero - Give (Last created item) to (Random unit from grpUnits)
Item - Create Potion of Mana at (Random point in (Playable map area))
Hero - Give (Last created item) to (Random unit from grpUnits)
Item - Create Scroll of Protection at (Random point in (Playable map area))
Hero - Give (Last created item) to (Random unit from grpUnits)
Item - Create Scroll of Healing at (Random point in (Playable map area))
Hero - Give (Last created item) to (Random unit from grpUnits)
Wait 1.00 seconds
Unit Group - Order grpUnits to Attack-Move To (Random point in PurpleBase <gen>)
Trigger - Turn on Keepattacking <gen>
Game - Display to (All players) the text: (A new wave of heroes is emerging... Destroy towers in purple base to stop these waves. Level = + (String(intLevel)))
05-12-2007, 05:38 PM#4
dagees
Ok, I THOUGHT I had it... But I was wrong. The below code only works 1 one or 2 times. Then the heroes just walk a bit and return in the base near the region where i spawned them. Why? I am completely clueless. Reviving, or completely creating the heroes again; it just doesn't make any difference. Please, anybody knows how to do this right?

Trigger:
PurpleSpawn
Collapse Events
Time - Every 15.00 seconds of game time
Collapse Conditions
(All units of grpUnits are dead) Equal to True
Collapse Actions
Unit Group - Pick every unit in grpUnits and do (Unit - Kill (Picked unit))
Unit Group - Remove (Picked unit) from grpUnits
Unit Group - Remove all units from grpUnits
Unit - Create 1 Paladin for Player 4 (Purple) at (Center of Purple1 <gen>) facing Default building facing degrees
Unit Group - Add (Last created unit) to grpUnits
Unit - Create 1 Archmage for Player 4 (Purple) at (Center of Purple1 <gen>) facing Default building facing degrees
Unit Group - Add (Last created unit) to grpUnits
Unit - Create 1 Mountain King for Player 4 (Purple) at (Center of Purple1 <gen>) facing Default building facing degrees
Unit Group - Add (Last created unit) to grpUnits
Unit - Create 1 Arthas (wielding Frostmourne) for Player 4 (Purple) at (Center of Purple1 <gen>) facing Default building facing degrees
Unit Group - Add (Last created unit) to grpUnits
Unit - Create 1 Jaina for Player 4 (Purple) at (Center of Purple1 <gen>) facing Default building facing degrees
Unit Group - Add (Last created unit) to grpUnits
Unit - Create 1 Sylvanas Windrunner for Player 4 (Purple) at (Center of Purple1 <gen>) facing Default building facing degrees
Unit Group - Add (Last created unit) to grpUnits
Wait 1.00 seconds
Unit Group - Pick every unit in grpUnits and do (Hero - Set (Picked unit) Hero-level to intLevel, Show level-up graphics)
Unit Group - Pick every unit in grpUnits and do (Unit - Set (Picked unit) acquisition range to (Width of (Entire map)))
Melee Game - Run melee AI scripts (for computer players)
Wait 1.00 seconds
If (blnDebug Equal to True) then do (Game - Display to (All players) the text: PurpleSpawn Fired) else do (Do nothing)
Trigger - Run PurpleSpawnLoop <gen> (ignoring conditions)
Trigger:
PurpleSpawnLoop
Events
Conditions
Collapse Actions
If (varCount Equal to 3) then do (Set varCount = 1) else do (Set varCount = (varCount + 1))
If (varCount Equal to 1) then do (Set intLevel = (intLevel + 1)) else do (Do nothing)
Item - Create Potion of Speed at (Random point in (Playable map area))
Hero - Give (Last created item) to (Random unit from grpUnits)
Item - Create Potion of Healing at (Random point in (Playable map area))
Hero - Give (Last created item) to (Random unit from grpUnits)
Item - Create Potion of Mana at (Random point in (Playable map area))
Hero - Give (Last created item) to (Random unit from grpUnits)
Item - Create Scroll of Protection at (Random point in (Playable map area))
Hero - Give (Last created item) to (Random unit from grpUnits)
Item - Create Scroll of Healing at (Random point in (Playable map area))
Hero - Give (Last created item) to (Random unit from grpUnits)
Wait 1.00 seconds
Unit Group - Pick every unit in grpUnits and do (Unit - Order (Picked unit) to Attack-Move To (Random point in Purple9 <gen>))
Game - Display to (All players) the text: (A new wave of heroes is emerging... Destroy towers in purple base to stop these waves. Level = + (String(intLevel)))
05-13-2007, 04:01 AM#6
Tide-Arc Ephemera
Couldn't you do something like create X units and then use "Unit Group - All units in group (Last created units)"... that WOULD really shorten things down, and possibly reduce a possible lag spike.
05-13-2007, 04:38 AM#7
darkwulfv
I had the same issue, with units walking to a region (attack-moving), then attack-moving right back. I never really figured out how to fix it... Someone mentioned an action involving ignoring unit guard points or something, but it didn't seem to work for me.
05-13-2007, 04:53 AM#8
Tide-Arc Ephemera
They only retract if the area they attack-move to has no targets to attack. I figured that out in my map after I noticed that every time they got to their destination, they'd kill the unit, then walk back home.
05-13-2007, 12:25 PM#9
dagees
Quote:
Couldn't you do something like create X units and then use "Unit Group - All units in group (Last created units)"... that WOULD really shorten things down

I know. But for some reason that didn't work. Only the last created unit would end up in the group. But like I mentioned, these are my first steps into making maps, and I probably did something wrong ;)

Quote:
They only retract if the area they attack-move to has no targets to attack.

No, there should be plenty of units to attack. And I also tested this using a very basic map. I thought that it maybe had to do something with pathing, but I couldn't get it right with even a very basic map.

I gave up, and now fire a trigger every 4 seconds telling the computer to attack. That does it, although it isn't pretty... However, if anybody knows the solution, I'll be happy to know!

Now.. can one of you map gurus tell me if it is possible to set:

- AI difficulty for computer players (easy, normal, hard) in Reigns of Chaos?
- Get heroes beyond level 10 in Reigns of Chaos?

Thanks for the response so far.

Oh, and about that lagging.. I guess that is a multiplayer issue? This one is a singleplayer melee map vs computer.