A Community discussion forum for Halo Custom Edition, Halo 2 Vista, Portal and Halo Machinima

Home  Search Register  Login Member ListRecent Posts
  
 
»Forums Index »Halo Custom Edition (Bungie/Gearbox) »Halo CE Technical / Map Design »Wanting to script (ai_follow_target_players ) but confused

Author Topic: Wanting to script (ai_follow_target_players ) but confused (11 messages, Page 1 of 1)
Moderators: Dennis

Dusinator
Joined: Mar 23, 2008

Abuser of dots and parenthesis.


Posted: Sep 1, 2008 12:32 PM    Msg. 1 of 11       
Hey all, I'm getting back into halo mapping after a few months off from my beginning attempts. I've been watching the forums anonymously (specifically stalking the semi-official WIP page...). Since I absolutely stink at making my own original maps (I suspect I should try learning with 3dsmax instead of gmax...), I am modding some of the original Halo maps for personal use (at this time).

I understand that I asked this question some months ago, but the thread is long buried by now. I have the scripting tutorial and the .txt with the scripts in it, but I am a little confused about how to type the script. Here's what I am specifically trying to do:

Make allied AI follow a player.
Scenario:
Marines, a team index of 0 (red team). They are called "marine_armored assault rifle".

I have the following script to use, but don't know what exactly to type into it.

(ai_follow_target_players )

Since it is folly to play AI online, only one person will be playing this map, if that makes a difference (I think it might).

What goes where? Once I receive and understand this example, I'm sure that I can apply it to the second type of marines and for the elites on the team index 1 (blue) team. The tutorial seems pretty clear on how to add a script to a map, so hopefully I won't need any help doing that. Thanks!


Me KS
Joined: Feb 2, 2008

Desire is Reality. Xfire: jetmaster23


Posted: Sep 1, 2008 01:36 PM    Msg. 2 of 11       
I figured this out a while ago myself. The scripting part is actually the easy part. Just add this line to a startup script for each AI encounter that you want to follow the player:

(ai_follow_target_players <encounter name>)

But, you also have to do a lot of specific things with each encounter's firing positions and squads.

What you do is make small groups of firing positions in the areas where you want the encounter to follow the player to. Each of these groups is then set to a unique firing position group letter, e.g. the first group of firing positions set to 'A', the group nearby set to 'B', the group near 'B' set to 'C', etc. You can make up to 26 of these groups per encounter, since you have letters A-Z to work with. It's best to have the groups linearly arranged from A to Z where possible, so that it's easier to remember which is which.

Then, you make what I call "empty squads" for each letter: each of these squads has no actor type specified, as well as no spawn points, move positions, or spawn settings. All that is specified in these squads is the initial state, return state, and "automatic migration", which HAS to be checked. Automatic migration gives the encounter's actors the freedom to switch from one squad to another at will. This is what lets them follow the player, since now they can move (migrate) to the firing position group's squad that is closest to the player.

Finally, the most important part is to specify the corresponding firing position group letter for each empty squad for each AI state (attacking, attacking guard, defending, etc.) You should name the squads by which firing position group they belong to, e.g. "squad_a" for the A group.

After you finish this, don't forget to create a normal squad or squads to actually spawn your actors in. In these squads, "automatic migration" has to be checked as well, and the firing position group letters should be set ONLY to the firing position group closest to the squad's spawn points.

Once all of this is done, you're ready to simply script in (ai_follow_target_players ) and that's it. It should work.

So, basically, AI following is actually just automatic migrations to the squad that the player is closest to.
Edited by Me KS on Sep 1, 2008 at 01:37 PM


Dusinator
Joined: Mar 23, 2008

Abuser of dots and parenthesis.


Posted: Sep 1, 2008 08:23 PM    Msg. 3 of 11       
Ok... so what I basically understand is that I go into Sapien, and in my humans AI instance I make 26 empty squads according to your specifications.

But what I don't understand is how I group firing positions... eh, I'll mess around in Sapien a little. I think I know what to do. I'll redo my firing positions first...

I'll try it. Probably will get irritating going through the long tool and Halo CE load again and again if I fail though. =P

UPDATE:
Ok... I'm not sure what I did incorrectly. At all. :-\

Here's what I get, in Sapien and in tool:

recompiling scripts after scenarios were merged.
i expected "script" or "global".: ai_follow_target_players>---<

I put the .hsc file into data\levels\test\bloodgulch and named it bloodgulch_squad.hsc (name of the modded map I'm working on). Still can't figure it out. Argh, why am I always unable to get things right the first time? Help!
Edited by Dusinator on Sep 2, 2008 at 09:20 AM


Ermac
Joined: Nov 24, 2006

Pops up from time to time


Posted: Sep 2, 2008 06:39 PM    Msg. 4 of 11       
You don't have to make 26 empty squads - just enough squads to cover the distance from their original position to wherever you want them to follow you to.

Post your script. You forgot to specify something, and it was most likely what is bolded in my example below:

(script startup
(ai_follow_target_players )
)

To set up the firing positions, when you create the encounter, you go to the firing position setup. There is a field there, with a colored box and a letter next to it. You will select the letter you wish to use. Remember this letter - you will use it when you get to the squads. Then, you will right-click the positions at the exact coordinates you want them to be in the level. In order for the follow script to work correctly, you MUST use a different letter for each squad's firing positions - or the AI will not follow. The reason behind this is that they automatically migrate to the squad closest to you, thus following you. If you reuse the same letter, they will think that they are close to you when in fact they are all the way across the level!

To set up the squads, you create them, and check off automatic migration. Don't mess with anything else but the firing position setup. You will scroll down to it. There are seven fields. Three of them have to do with attacking, three with defending, and one with pursuit. You'll know them when you see them. Fill them in with whatever letter(s) that represents the firing positions you want that squad to cover. You may use more than one letter per squad - but remember the warning I posted above.

If you are confused, ask questions. Setting up the squads and firing positions is the most complicated part of getting them to follow you, but once you get it, you'll find that it's only tedious, not actually all that confusing.
Edited by drillinstructor on Sep 2, 2008 at 06:53 PM


Dusinator
Joined: Mar 23, 2008

Abuser of dots and parenthesis.


Posted: Sep 5, 2008 06:50 AM    Msg. 5 of 11       
I am still getting errors. I copied and pasted the suggested script into my .hsc:

(script startup
(ai_follow_target_players )
)

And here is the debug text:
Quote:
09.04.08 21:56:30 [bloogulch_squad line 1] i expected (script ): (script startup
09.04.08 21:56:30 recompiling scripts after scenarios were merged.
09.04.08 21:56:30 this left parenthesis is unmatched.: (script startup


Still unsure of what I'm doing wrong... I messed around with the script dozens of times but still kept getting errors. I've figured out the placements of firing positions and giving each letter squad, well, a letter... but the actual scripting is giving me problems now. The hs_doc has in it, and it seems that the debug.txt wants me to put in an encounter. What do I type there? Do I put in the AI name, or the firing position(s)? (Please post the example as it would go in the script.)

Heh, I just know that I'm missing something very simple...

Less important questions. 1) Can I have move positions for the AI or would that mess it up?
2) Would I need to change the script if I did this for team index 1 and team index 0 AI?

(What I'm trying to do for starters is a basic setup in blood gulch for personal use and experimentation... humans at red base, elites at blue base. I want to take my human squad over to the elites or I can switch teams and march on the humans with my elite squad... but I want the other team to be moving around naturally when I'm not on their team with them following me.)


H Guru
Joined: Oct 15, 2006

EHSv3 Coming Soon!


Posted: Sep 5, 2008 07:54 AM    Msg. 6 of 11       
Quote: (ai_follow_target_players )
sets the follow target for an encounter to be the closest player


That is quoted from the Halo Script Bible, What your script should look like is;

(script startup 
(ai_follow_target_players ENCOUNTERNAME)
)


Place the encounter name the same as you named the encounter in sapien.


Dusinator
Joined: Mar 23, 2008

Abuser of dots and parenthesis.


Posted: Sep 5, 2008 09:27 AM    Msg. 7 of 11       
For the AI encounter humans, here's what the script looks like now...

(script startup
(ai_follow_target_players humans)
)

I still get the error... :-\


H Guru
Joined: Oct 15, 2006

EHSv3 Coming Soon!


Posted: Sep 5, 2008 10:08 AM    Msg. 8 of 11       
Oops missed a vital thing, you need to define the block with a name

(script startup 
(ai_follow_target_players humans)
)


should be something like;

(script startup h_f_p
(ai_follow_target_players humans)
)


h_f_p is just an abbreviation I made for humans follow players, you can name it anything it doesn't matter(if you want spaces replace them with _).


Dusinator
Joined: Mar 23, 2008

Abuser of dots and parenthesis.


Posted: Sep 5, 2008 12:29 PM    Msg. 9 of 11       
"scripts successfully compiled"
=D

Just another question. Do I need to add anything to the script if I want to do the same for my other encounter, elites?


H Guru
Joined: Oct 15, 2006

EHSv3 Coming Soon!


Posted: Sep 5, 2008 12:32 PM    Msg. 10 of 11       
You could just add

(script startup h_f_p
(ai_follow_target_players humans)
(ai_follow_target_players elites)
)


That is if the other encounter is called elites, if not then just rename it to what is needed.


Dusinator
Joined: Mar 23, 2008

Abuser of dots and parenthesis.


Posted: Sep 5, 2008 02:44 PM    Msg. 11 of 11       
Sweet thanks.

Been tinkering around... realized that I have to have X firing positions in a spot (for each letter), where X is how many AI I want to follow me... I was surprised to see only several marines tag along at first. Right now I'm playing around with different firing positions on the map, or maybe I'll just go to a different map with this new technique in mind. Ah, to be happily tinkering without frustrating roadblocks! :)

Oddly, the main problem with my map now is that my marine AI seem to be multiplying like rabbits. I've gotten up to a hundred of them (specified 20, max) when they're not following me to the other base to be slaughtered. o_O Simple to look into... lol at least I never run out! =P

EDIT: That problem with my marine AI mysteriously multiplying? Seems that when they multiply, they stop caring about following me and fighting the elites. (Seems that the elites are happy to stop caring to fight the marines also.) Sapien tells me nothing of ordering an army of a hundred (I set the max marine count to 20...), so I don't know if it is a problem related to scripting or what. Now it's really irritating. -_-

Edited by Dusinator on Sep 5, 2008 at 04:43 PM

 

 
Previous Older Thread    Next newer Thread







Time: Thu January 19, 2023 7:20 AM 157 ms.
A Halo Maps Website