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

Members Online

»
0 Active | 79 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

»
CoD2 Mapping
ratings:
Awful Rating
Poor Rating
Average Rating
Good Rating
Excellent Rating
Basic enemy AI
Versions: You must be logged in to view history.
In this tutorial I’m going to explain you the basics of enemy AI.
Preparation:
First you need to download my example map. It can be found here.

Oke lets get started. Open up my map and place an info_player_start at the begin of the map (see screenshot). To find the info_player_start just right click on you’re 2d-grid and select info>playerstart.



Now we place the enemy where it needs to be spawned. In this example were going to set it behind the wall. Now this is what you need to remember: Never place an actor (the enemy) in sight of the player itself. To get an enemy right click on you’re 2d grid and select actor>axis_nrmdy_wehr_reg_mp44 (it can be any actor, just pick on that you want) and place it behind the wall. Do the same for the other actor.



Now select the actors and press ‘’N’’ and a new window will pop-up. Now check the spawner box and press ‘’N’’ again.



Now we need to make the path of the enemy and what it will do when its reaches his point. In this example were making the enemy staying behind the wall. So first we need to lay down a path for the enemy where it can walk. To do this right click on you’re 2d-grid and select: node> pathnode , now place the pathnode in front of the actor, now place another one like 30 units further than the previous one. Do the same with the other one.



Now were only had make a path so the enemy can move but that’s a little bit boring so were going to make it shoot on you. To make an AI actor do something you need to make a kind of node, cover_stand, cover_prone etc. There all self explaining. So one actor gets a cover left and the other actor gets a cover right. Just place it where you want that the enemy needs to take shoot from. In this example the sides of the wall, and remember to turn the action nodes ( cover_stand etc.) the way it need to do its action otherwise they will turn you’re back to you. But still the actor isn’t doing anything. You need to link the actor to the cover node to make it actually run to the cover node and start shooting. To do this select the actor and then select the cover node and press ‘’W’’ and you see that a yellow line connects the actor to the node. Do the same with the other one. If it all was a bit to confusing just look to the screen below.



Now we need to choose at what certain point the enemy AI needs to spawn and then needs to do its thing what me make before. So we are going to place a trigger. What the trigger does is really simple. When you walk trough it you’re enemy will spawn and do it thing. So we are going to place a trigger between the two walls. To make a trigger you first need to find the trigger texture, that can be found in the usage>tools. Now drag a brush between the two walls. Right click on it in the 2d grid and select: trigger>multiple. Now the last thing we need to do is link the trigger to the AI. So link in this order: Select the trigger, select enemy 1 and press ‘’W’’, you’ll see that a yellow line is linking the two together. Now do the same for the second actor. Look on the screen and see if you did it right.



Now you’re almost finished. You only need to make a really easy script. Most tutorials say you don’t need a script but trust me, you need it. So make a text file and put this code in it:


#include maps\_utility;
main() {
maps\_load::main();
level.player takeallweapons();
level.player giveWeapon ("thompson");
level.player giveWeapon ("colt");
level.player giveWeapon ("fraggrenade");
level.player switchToWeapon ("thompson");
}


Now save it as youremapname.gsc (in this tutorial I named my map aimapenemy) you need to have the .bsp file and the .gsc file the same name, otherwise it wont work.

The last thing you need to do know is add a line to you’re shortcut on the desktop. Otherwise you’re AI don’t move. So right click on you’re shortcut and select the tab ‘’shortcut’’ and then by target you have this line "C:Program FilesActivisionCall of Duty 2CoD2SP_s.exe" and you need to change it to this: "C:Program FilesActivisionCall of Duty 2CoD2SP_s.exe" + set g_connectpaths 1

Now you have finished your own first Single Player map with AI in it. Well done! If you get stuck at one point just open the .map. You can download it here. To run you’re map open CoD2SP and type in console /map youremapname (for my example /map aimapenemy).

-----------------------------------------------------------------------------------------------------------------------------

I made this tutorial because there wasn't really a good tutorial how to make AI in your map. There are some tutorials but most of them are so short you cant get any information out it. So im hoping some people can use it. If there are any suggestions what can be better just tell me. And i read on a topic that foyleman it can put it under the tutorial list so please do that!

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

»