Page 1 of 1

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

Posted: Sat May 09, 2009 6:51 pm
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!

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

Posted: Sat May 09, 2009 7:36 pm
by Frisbeetarian
Psych0fred's extra docs cover this:
http://www.secretsociety.com/forum/down ... IGoals.txt

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

Posted: Mon May 11, 2009 2:58 pm
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)

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

Posted: Mon May 11, 2009 3:42 pm
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!