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

Members Online

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

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 4
Category: CoD4 SP Mapping
CoD 4 mapping and level design for single player.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: Tutorial: AI getting in vehicle
sam_fisher3000
General Member
Since: Apr 18, 2007
Posts: 816
Last: Jul 16, 2016
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD4 SP Mapping
Posted: Monday, Aug. 29, 2011 10:15 pm
attachment: application(5.0Kb)
I finally got the AI to get in vehicles to work. It's actually quite simple. It can be more than one AI getting in the vehicle. However, it is limited to the number of seats. So if the vehicle has 4 seats, 4 AI can get in. AI getting in vehicle is merely just an animation. No mapname_anim is needed, which is good.

Now this tutorial is more for advance scripters or someone who wants a challenge. Well, intermediate scripters can understand this too. This definitely is a great addition to any maps.

Radiant:

Create as many AI as you want. Create a vehicle as well. In my case, it is a jeep/uaz.

It helps to understand the basic vehicle tutorials.
http://modsonline.com/Tutorials-read-540.html

Be sure to give the AI a script_startingposition. First AI, script_startingposition/1, next AI, script_startingposition/2, etc. The AI and vehicle need to have the same script_vehicleride. Be sure to give the AI a targetname. You need it for scripting. The same for the vehicle. There is no need to make the AI a spawner. You can but that would require more work. More work as in, you need to define your actor after it spawns. Shouldn't be hard.

For the vehicle, create a trigger to spawn the vehicle. Give it a targetname as well.

It is best to spawn the vehicle but stop it after it spawns. So create several vehicle nodes. Make the first 3 close to each other. On the third vehicle node, select it and create a trigger. Give the vehicle node and the trigger a key/value. script_gatetrigger/ 1. So when the trigger is touched, the vehicle will move again. I guess you know for the first vehicle node, it needs a checkmark in the start_node.

Now on to scripting. The main script is maps\_vehicle_aianim. All the required animation is in there. The main line is thread guy_runtovehicle( actor, car). I will explain what they are in script.

Code:

#include maps\_utility;

#include maps\_vehicle;

#include maps\_helicopter_globals;

#include common_scripts\utility;

#include maps\_anim;

#include maps\_utility_code;

#include maps\_vehicle_aianim; //everything is here. 

main()
{

precachevehicle("uaz");

maps\_uaz::main("vehicle_uaz_open");
maps\_load::main();

thread jeepin();

}

jeepin()
{
actorin = getent("actorin","targetname"); //trigger to spawn the vehicle
actorin waittill("trigger"); 

wait 1; //wait till the vehicle spawns. 

level.actor = getent("actor","targetname"); //get the AI
level.car = getent("car","targetname"); //get the vehicle. 
level.actor2 = getent("actor2","targetname"); //get the 2nd AI if you intend to have more than one. 

wait 1; //no need but separate above from below to make things run smoothly

//level.car thread guy_handle(level.actor, 0); this handles the //vehicles animation events( stand, attack, duck, turn, unload ) - ai 1
//level.car thread guy_handle(level.actor2, 1); //ai 2

//the 0 in guy_handle(level.actor, 0) is the vehicle position or the startingposition. The level.actor is what you define the actor as in script. Make sure it is the vehicle that thread the function. Like you see above, level.car (which is the car that I defined.) 
NOTE: This isn't necessary. Unless you want some animations.

wait 1.5;

level.car thread guy_runtovehicle( level.actor, level.car); //AI 1 run to vehicle and get in as driver. Make sure the vehicle threads the function as well. 
level.car thread guy_runtovehicle( level.actor2, level.car); //AI 2 run to vehicle and get in as rider. 

//guy_runtovehicle(level.actor, level.car) - level.actor is what you defined AI 1 in script. level.car is what you defined the car in script. 

}


That's it! It is very simple. I wanted to speed up this tutorial b/c you should know the basics already and I don't have to tell everything.

I will upload a source file (attached to this topic) and a video.

video link Here

The source file will consist of a helicopter attacking a tank and there are extra scripts. I didn't want to upload a standalone tutorial. I don't have the time. I will just upload one that I worked on. Play around with the map and script but don't steal.

Hope this tutorial helps you!


Share |
9837265498
General Member
Since: Nov 6, 2009
Posts: 193
Last: Jan 23, 2012
[view latest posts]
Level 4
Category: CoD4 SP Mapping
Posted: Monday, Aug. 29, 2011 11:11 pm
TY TY TY TY TY TY TY TY TY!!!!!


You are Ownage!

I can finally do my map the right way! I my car park out of view people run out of view car and people delete, new car with them in it spawn and drive in view.... major hassle, ugly, and quite simply way to complex. I am glad someone has finally found a way to do this!

TY once again!
Share |
sam_fisher3000
General Member
Since: Apr 18, 2007
Posts: 816
Last: Jul 16, 2016
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD4 SP Mapping
Posted: Monday, Aug. 29, 2011 11:36 pm
No problem. Glad it help. :D
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 SP Mapping

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

»