Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 77 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

Tutorials

»
CoD Mapping
ratings:
Awful Rating
Poor Rating
Average Rating
Good Rating
Excellent Rating
AI Scripting Basic Training: Enemy Scripting Tutorial
Versions: You must be logged in to view history.
Scripting enemy AI for SP maps
 

Introduction:

So, you got past the first stage, eh? Hopefully you played around and got used to moving your squad around cause I am now assuming you know how. That is why these tutorials are not the longest. I take it one small step at a time, like you all should! SP is not hard to learn, although it can get quite confusing! So unless you have a good sound knowledge, you won't get very hard. Plain and simple. There are a lot of things to learn so be patient. After this tutorial we move on to Advanced AI scripting, where you will learn all sorts of neat, advanced stuff! So press on and don't give up. SP mapping is so self-rewarding!

Disclaimer:

A few notes... First, don't use the quotations when entering in names and values. The compiler doesn't like it! Second, the files that I made and used can be found for download at the bottom of the page. If you really need some help please visit the .MAP CoD forums found here. I would love to answer and help everyone but the military keeps me busy and I simply don't have the time. If you do PM me, I will try hard to help though.
Finally, don't forget to add this line to your SP shortcut: +set g_connectpaths 1.

First Step:

Firstly, you need to setup a map. The one used in this tutorial is a large rectangle with a prefab house of mine on one end and a bunch of walls. On your map you should go ahead and start with the Allies scripting and node-work. Lay them all out! I find getting the path of the Allies first gives you a good idea of how the enemies should be paved. The image below depicts just that, the basic groundwork for the map, your team! See... Now you know why we went over the basics! Every map you make will start off with this process.

So instead of taking forever on this tutorial, I will let you map what you want since you already know how to get your team moving!

Step Two:

Now that it is like 45 minutes later, we can move on! So you got the basic layout of own you want your team to move. Great! Now, we want to add some Germans to this map! Luckily, it is almost the same as paving the allies! The biggest difference is that instead of using the "AI Trigger" and "friendly_chains", you are simply going to use a trigger that connects to the soldier, who in turn connects to his node! See, simple!
Check out this shot:

What I did here is right-clicked and chose "Actors". From here you can choose the Soldier of your choice just like the allied soldiers. Now press the "n" key to open the entity editor. You will see a bunch of check boxes but the one important to use (here in basic scripting) is the "Spawner" box. If you leave this unchecked, when the map loads he will load as well. If it is checked, the game will wait till you pass through a trigger to spawn him. Pretty straight forward, huh? So now that you have that checked (cause we don't want him running around till we later) we can move one...

Step Three:

Like I said earlier, we need to use a regular trigger to spawn him. So we will make a brush and apply the trigger texture (under "Common") then press "n". Just like before in my first  tutorial, we need to scroll down to the "trigger_once" option and double click it. Now we have a real trigger! Now, with it selected go ahead and select the German soldier. With both of them selected press "Ctrl+k". This will automatically targetname the soldier and have the trigger target him. This trick will save a lot time in your map making adventures! Now, let me explain something here... When you want multiple soldiers to spawn off one trigger, you can name all the soldiers one common name. The game will not get confused and nothing will break. Later, in the advanced lessons, this can affect the behavior of all of them since they all do have the same name. Bottom line: Don't worry. As you can see in the picture I have three soldiers, all targeted by the trigger and all of them with the same name. Just be sure to use the "Ctrl+k" trick one at a time. Radiant will not auto link more than one entity.

Now we got some soldiers ready to fight! Well... Let's get them to have contact with the Allies!

Step Five:

Wow, we are just breezing through this! I told you SP mapping wasn't hard! Well, the basics aren't hard at least. We have quite a few challenges later ahead of us... Anyway, on to mapping again! So we have the trigger linking the soldiers telling the game, "Yo, when these Yanks cross this line, let 'em have it!" but nodes. Simple! Go ahead and make a node just like before. No special needs here! Make any node you wish and deselect it. Select the soldier, then the node again and press "Ctrl+k". Jackpot! Now when you cross the trigger the German soldier will pop out and run toward that node! One problem I have not seem to resolve is that is you have a node that your allies use and a German soldier passes by, the German will try to use it. Sometimes they will just linger there crouching or whatever you made there. What I do is make them a good distance apart, that way the German soldiers have less of a chance finding allied nodes.

Hopefully this is so easy for you that you are breezing on by. Like I said before, of you paid attention to the first tutorial, this should be cake!

Step Five:

If you ran your map (with the .GSC file) now, you should see that when you indeed pass that trigger, the soldier emerges. Remember that AI is one basic equation:

Trigger + AI Actor + Node = A working map!

All your map will mostly consist of is this equation. You must somehow trigger the AI and have the AI do something. Step Five is actually repeating this process for the remainder of your map, how ever many times you need! Be careful though! the map can get confusing with tons of nodes so remember what you are doing!

All I did here was make another set of trigger + AI + node. What an easy way to remember!

Step Six:

Now all you have to do is populate your map with models and all that other fancy mapping stuff. For all you MP mappers crossing over, this should be quite easy for you! As you can see below, I added all the pathnodes I needed (Remember!! Pathnodes define were the AI can go, you don't need as many as I have by any means!) and then I compiled. Simple! Now you can start making practice missions until the next tutorial goes live!

*Whew* You survived it! Now go compile and see how it goes!

The GSC File:

Go ahead and make this your GSC file, just like before, and save it as the name of you map (ex. "mapname.gsc"):

// This script was made by Seeded[USAF] on December 26th, 2003.

main()
{
//Loads all the global scripts... Just use it!
maps\_load::main();

// This little bit equips you with some weaponry. You need specifiy which items to equip your character.
level.player takeallweapons();
level.player giveWeapon("m1carbine");
level.player giveWeapon("thompson");
level.player giveWeapon("colt");
level.player giveWeapon("fraggrenade");
level.player switchToWeapon("thompson");

}

Tips and Tricks:

If you were lost at any point, which you shouldn't, check back to my first tutorial. It tells you how to manually target and target name instead of the easier, faster "Ctrl+k" shortcut.

If you find certain enemy soldiers aren't spawning, check to make sure the "Spawner" box is checked and the trigger is targeting it.

 

Files:

For the essential files, click here.

Written by Seeded[USAF]

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»