HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Moving unit group fails

02-27-2009, 11:12 AM#1
Saxe
Hi guys.

Working on a spawning system, everything is working fine except for one thing. The group of units does not move to the location I want them to! Only one of the units go there, and as soon as the region (TowerNorthHuman) is reached, it returns to the other units of the group. I should say that the units are first spawned, then loaded onto a ship, then moved into the map visible to the player where they are unloaded. As soon as they are unloaded they all go as close to the ship as they can, so I suppose they are trying to board it again - I guess I could try recording a video if it's unclear to you what is happening.

Here are my three triggers:

SpawnHuman
Trigger:
SpawnHuman
Collapse Events
Time - Every 24.00 seconds of game time
Conditions
Collapse Actions
Unit - Create 1 Frigate for Player 1 (Red) at (Center of LoadHuman <gen>) facing Default building facing degrees
Set SpawnShipHuman = (Last created unit)
Unit - Create 3 Human Soldier for Player 1 (Red) at (Center of LoadHuman <gen>) facing Default building facing degrees
Unit - Create 1 Human Caster for Player 1 (Red) at (Center of LoadHuman <gen>) facing Default building facing degrees
Set SpawnGroupNorthHuman = (Units owned by Player 1 (Red) matching (((LoadHuman <gen> contains (Matching unit)) Equal to True) and (((Unit-type of (Matching unit)) Equal to Human Soldier) or ((Unit-type of (Matching unit)) Equal to Human Caster))))
Wait 2.00 seconds
Collapse Unit Group - Pick every unit in SpawnGroupNorthHuman and do (Actions)
Collapse Loop - Actions
Unit - Order (Picked unit) to Board SpawnShipHuman
Wait 2.00 seconds
Unit - Create 3 Human Soldier for Player 1 (Red) at (Center of LoadHuman <gen>) facing Default building facing degrees
Unit - Create 1 Human Caster for Player 1 (Red) at (Center of LoadHuman <gen>) facing Default building facing degrees
Set SpawnGroupSouthHuman = (Units owned by Player 1 (Red) matching (((LoadHuman <gen> contains (Matching unit)) Equal to True) and (((Unit-type of (Matching unit)) Equal to Human Soldier) or ((Unit-type of (Matching unit)) Equal to Human Caster))))
Collapse Unit Group - Pick every unit in SpawnGroupSouthHuman and do (Actions)
Collapse Loop - Actions
Unit - Order (Picked unit) to Board SpawnShipHuman
Trigger - Turn on UnloadUnitsHuman <gen>
Wait 2.00 seconds
Unit - Order SpawnShipHuman to Move To (Center of UnloadHuman <gen>)

UnloadUnitsHuman
Trigger:
UnloadUnitsHuman
Collapse Events
Unit - A unit enters UnloadHuman <gen>
Collapse Conditions
(Entering unit) Equal to SpawnShipHuman
Collapse Actions
Trigger - Turn on MoveUnitsHuman <gen>
Collapse Unit Group - Pick every unit in SpawnGroupNorthHuman and do (Actions)
Collapse Loop - Actions
Unit - Order SpawnShipHuman to Unload (Picked unit)
Collapse Unit Group - Pick every unit in SpawnGroupSouthHuman and do (Actions)
Collapse Loop - Actions
Unit - Order SpawnShipHuman to Unload (Picked unit)
Wait 10.00 seconds
Unit - Remove SpawnShipHuman from the game
Trigger - Turn off (This trigger)

MoveUnitsHuman
Trigger:
MoveUnitsHuman
Collapse Events
Unit - A unit enters UnloadHuman <gen>
Collapse Conditions
(((Entering unit) is in SpawnGroupNorthHuman) Equal to True) or (((Entering unit) is in SpawnGroupSouthHuman) Equal to True)
Collapse Actions
Unit Group - Pick every unit in SpawnGroupNorthHuman and do (Unit - Order (Picked unit) to Move To (Center of TowerNorthHuman <gen>))
Trigger - Turn off (This trigger)
02-27-2009, 12:27 PM#2
snowtiger
That only one unit moves is probably because you unload one by one, and when the first one is unloaded. you turn of the trigger, so the rest isn't getting ordered to move.

The unit running back probably has something to do with the "guard position"
use this action:
AI - Ignore (Picked unit)'s guard position

I hope this helps you :)
02-27-2009, 05:42 PM#3
ShadowWolf
Also, for unexplainable reasons, having wait commands in loops will constantly mess things up. Try to avoid at all costs having waits in triggers with periodic timer events.
Instead of picking units you could create a seperate trigger with conditions that has the event of "A unit enters (spawn region)" and then order them to move in that trigger. That will make them move without question.
02-27-2009, 06:26 PM#4
snowtiger
Quote:
Originally Posted by ShadowWolf
Also, for unexplainable reasons, having wait commands in loops will constantly mess things up. Try to avoid at all costs having waits in triggers with periodic timer events.

There are no waits inside loops that I see in that code.
02-27-2009, 06:35 PM#5
xombie
They should have some sort of warning on the 'Wait' interface like "CAUSES BULLSHIT 85% OF THE TIME, ALL THE TIME."
02-27-2009, 07:15 PM#6
ShadowWolf
Quote:
Originally Posted by snowtiger
There are no waits inside loops that I see in that code.
Sorry, I meant the periodic event as a loop. Waits have been the source of many problems for me. Damn things are so useful sometimes though.
02-27-2009, 10:28 PM#7
Saxe
Hi, thanks for the tip with the AI's guard position, that seems to have worked. I also got the moving fixed, however new problems have showed up, most likely because of my waits as mentioned :P

I'll try to see if I can fix them myself before asking here :)

Thanks again
02-27-2009, 11:42 PM#8
ShadowWolf
You also might want to start cleaning up your memory leaks. It's not detrimental, but it can sometimes be the difference between good quality and a laggy map plagued with server splits. There's a couple tutorials on removing them, just look them up in the tutorial section. I counted at least 6 location leaks in the code you posted.