How to make units follow ME

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
genaral_mitch
Jedi
Jedi
Posts: 1056
Joined: Fri Aug 14, 2009 12:32 am

How to make units follow ME

Post 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.
User avatar
sim-al2
2nd Lieutenant
2nd Lieutenant
Posts: 412
Joined: Mon Jul 06, 2009 10:26 pm
Projects :: Mapping on occasion
Games I'm Playing :: SWBFII + MW4 + SC4
Location: In the cockpit of some vehicle...

Re: How to make units follow ME

Post by sim-al2 »

genaral_mitch
Jedi
Jedi
Posts: 1056
Joined: Fri Aug 14, 2009 12:32 am

Re: How to make units follow ME

Post by genaral_mitch »

Where in my lua does this line go?

Code: Select all

AddAIGoal( team, "Follow", weight, gameObjectPtr);
User avatar
sim-al2
2nd Lieutenant
2nd Lieutenant
Posts: 412
Joined: Mon Jul 06, 2009 10:26 pm
Projects :: Mapping on occasion
Games I'm Playing :: SWBFII + MW4 + SC4
Location: In the cockpit of some vehicle...

Re: How to make units follow ME

Post 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.
User avatar
lucasfart
Sith
Sith
Posts: 1440
Joined: Tue Feb 24, 2009 5:32 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Australia

Re: How to make units follow ME

Post by lucasfart »

You should have a look in some of the stock lua's, but i think it goes in scriptpostload.
User avatar
skelltor
Sith
Sith
Posts: 1431
Joined: Fri Dec 11, 2009 6:24 pm
Projects :: BFSM
Games I'm Playing :: SWBFII
xbox live or psn: skelltor95
Location: minisnowta
Contact:

Re: How to make units follow ME

Post by skelltor »

is there a way to make them just follow one unit type like a new commander unit?
User avatar
sim-al2
2nd Lieutenant
2nd Lieutenant
Posts: 412
Joined: Mon Jul 06, 2009 10:26 pm
Projects :: Mapping on occasion
Games I'm Playing :: SWBFII + MW4 + SC4
Location: In the cockpit of some vehicle...

Re: How to make units follow ME

Post by sim-al2 »

genaral_mitch wrote:

Code: Select all

AddAIGoal( team, "Follow", weight, gameObjectPtr);
User avatar
lucasfart
Sith
Sith
Posts: 1440
Joined: Tue Feb 24, 2009 5:32 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Australia

Re: How to make units follow ME

Post 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....
User avatar
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: How to make units follow ME

Post 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.
User avatar
skelltor
Sith
Sith
Posts: 1431
Joined: Fri Dec 11, 2009 6:24 pm
Projects :: BFSM
Games I'm Playing :: SWBFII
xbox live or psn: skelltor95
Location: minisnowta
Contact:

Re: How to make units follow ME

Post 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?
Post Reply