Using AddAIGoal("Defend") to make locals follow you around?

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
User avatar
Superm9
Second Lance Corporal
Second Lance Corporal
Posts: 104
Joined: Thu Aug 23, 2007 8:41 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Using AddAIGoal("Defend") to make locals follow you around?

Post by Superm9 »

The question is in the title: can you use AddAIGoal(), more specifically, the "defend" type, to make all of the units from another team, not ATT or DEF, but a local team (that team being friendly to you), follow you around, attack enemies nearby, etc... essentially, make YOU, the human, be the defense object.

Essentially, what I am asking is how you would reference yourself (or your team, it doesn't matter to me, as you are the only one on your team) in the following code:
Hidden/Spoiler:
local_goal = AddAIGoal(6 (the local team), "Defend", 100, "theHuman" (this is obviously NOT how you would reference yourself, but you get the idea))
What code would I put in place of "theHuman" in the preceding code? :cpu:

Thanks!
User avatar
Frisbeetarian
Jedi
Jedi
Posts: 1233
Joined: Wed Sep 12, 2007 3:13 pm

Re: Using AddAIGoal("Defend") to make locals follow you around?

Post by Frisbeetarian »

Psych0fred's extra docs cover this:
http://www.secretsociety.com/forum/down ... IGoals.txt
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: Using AddAIGoal("Defend") to make locals follow you around?

Post by [RDH]Zerted »

"Defend" - defend the target (a gameobject pointer, or a character index)
AddAIGoal( team, "Defend", weight, gameObjectPtr );
AddAIGoal( team, "Defend", weight, integerChrIdx );
gameObjectPtr - game object pointer. Like a character's unit
integerChrIdx - integer character index. The character Id you get from events such as OnCharacterSpawn(function(characterId) end)
User avatar
Superm9
Second Lance Corporal
Second Lance Corporal
Posts: 104
Joined: Thu Aug 23, 2007 8:41 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set

Re: Using AddAIGoal("Defend") to make locals follow you around?

Post by Superm9 »

Yep, I got the AI follow working (using the "Follow" command that I didn't even know existed! :) ) And it works great!

Thanks!
Post Reply