Page 1 of 1

Unit "Battallions"

Posted: Tue Apr 22, 2008 7:48 pm
by Blade
I'm kinda thinking about making a more "Tactical" type map, and I'm wondering something.
I know there are ways to make units follow you during battle, but I've never found these methods to be very useful in the heat of battle. Is there any way to make it so that a certain group of units follows you, but not necessarily right on your tale... just sort of a common connection, but they stick around you instead of simply charging into battle? If there is, could someone tell me how it would be done? I'd kinda like to make something like a Shuttle crash, and you being the only survivors, or something like that :mrgreen:

Thanks
-Blade

Re: Unit "Battallions"

Posted: Tue Apr 22, 2008 7:56 pm
by Maveritchell
You can script AI to sort've do that, but it's never going to be much more than what you see when you administer the AI command. To do it you'd set AI behavior to "follow" or "defend" and set your unit as the target. It would look something like this (this may or may not be entirely correct, I haven't tested it.):

Code: Select all

unitgroup = OnCharacterSpawn(
	function(player)
		if IsCharacterHuman(player) then
			ClearAIGoals(1)
			AddAIGoal(1, "follow", GetCharacterUnit(player))
		end
	end
)