Page 1 of 1

How to make units follow ME

Posted: Thu Sep 02, 2010 10:25 pm
by genaral_mitch
What do I need to do to make units AI follow me? I'm doing an RC style map and... you get the picture. I don't want to Commandos going around and doing what they want.

Re: How to make units follow ME

Posted: Thu Sep 02, 2010 10:36 pm
by sim-al2

Re: How to make units follow ME

Posted: Thu Sep 02, 2010 10:42 pm
by genaral_mitch
Where in my lua does this line go?

Code: Select all

AddAIGoal( team, "Follow", weight, gameObjectPtr);

Re: How to make units follow ME

Posted: Fri Sep 03, 2010 5:23 am
by sim-al2
It's either:
Hidden/Spoiler:
[quote]function ScriptPostLoad()...

...conquest:Start()

EnableSPHeroRules()


AddAIGoal(3, "Deathmatch", 101)
end
[/quote]
OR
Hidden/Spoiler:
[quote]SetTeamName(3, "Acklays")
AddUnitClass(3, "geo_inf_acklay",3)
SetUnitCount(3, 1)
AddAIGoal(3,"Deathmatch",100)
SetTeamAsFriend(ATT,3)
SetTeamAsFriend(3,ATT)
SetTeamAsFriend(DEF,3)
SetTeamAsFriend(3,DEF)


[/quote]
I seem to have set it up in two different places :roll: but I guess try both. I set up a death match goal for my local team because an acklay keep trying to capture cps.

Re: How to make units follow ME

Posted: Fri Sep 03, 2010 10:15 am
by lucasfart
You should have a look in some of the stock lua's, but i think it goes in scriptpostload.

Re: How to make units follow ME

Posted: Fri Sep 03, 2010 10:27 am
by skelltor
is there a way to make them just follow one unit type like a new commander unit?

Re: How to make units follow ME

Posted: Sat Sep 04, 2010 12:43 am
by sim-al2
genaral_mitch wrote:

Code: Select all

AddAIGoal( team, "Follow", weight, gameObjectPtr);

Re: How to make units follow ME

Posted: Sat Sep 04, 2010 4:37 am
by lucasfart
sim-al2 wrote:
genaral_mitch wrote:

Code: Select all

AddAIGoal( team, "Follow", weight, gameObjectPtr);
I'm quite sure skelltor noticed that before posting. I'm not sure exactly what you'd put into the field, but you define who they follow in the last field, gameObjectPtr. As i said, I'm not sure whether you just type in the units name, or if its a bit more complicated then that....

Re: How to make units follow ME

Posted: Sat Sep 04, 2010 8:59 am
by DarthD.U.C.K.
lucasfart wrote:I'm quite sure skelltor noticed that before posting. I'm not sure exactly what you'd put into the field, but you define who they follow in the last field, gameObjectPtr. As i said, I'm not sure whether you just type in the units name, or if its a bit more complicated then that....
Psych0fred's AINotes wrote:Destroy and Defend can specify GameObjects or Character indices:

ClearAIGoals( 1 )
AddAIGoal( 1, "Defend", 100, 0 )
ClearAIGoals( 2 )
AddAIGoal( 2, "Destroy", 50, 0 )
AddAIGoal( 2, "Destroy", 50, atatPtr )

This sets up all of team 1 to defend Character(0), which is the player. Here you could also
put the index of a special character (ie Leia or anyone) you spawn in somewhere. Team 2 is
set to kill Character(0) (the player again) and also destroy the ATAT specified by atatPtr.

Re: How to make units follow ME

Posted: Sat Sep 04, 2010 9:14 am
by skelltor
ahh ok thx (sorry if that might have been some form of thread highjacking)
by index does he just mean the units name or is there some index code that i have never sean before?