MODSon[line.com] Wiki - Beta 1.0
Call of Duty 4: Single Player AI
From MODSonline Wiki
List of everything involving AI with CoD4
Contents |
[edit] Moving AI using color groups
- In Radiant, make a trigger_multiple. then lay down a line of cover nodes where you want them. you dont have to connect the cover nodes to each other. now select all the cover nodes and the trigger_multiple and press Shift + G.
- A box will appear with 7 colors: red, orange, yellow, green, teal, blue, and purple.
- Select a color for your group and click Add.
- Where it says Name: script_color_allies click OK.
- You have just setup your very first color group, keep repeating this step till you have your AI movement setup the way you want it.
[edit] Split your AI squads
- Go back to your first group of color nodes that you made. Make a new line of cover nodes, but dont make a new trigger, now select the new line of cover nodes and the first trigger_multiple that you made. If you look at the Enities properties for the trigger, you will see it has a key/value pair of:
Key: script_color_allies
Value: r0
- Hold Shift and press G, and select Green for your color, then click Add,
- Click OK by the Name box.
- Deselect everything, then select only the trigger. you will see in the Entities box that its key of script_color_allies now has a value of r0 g0. What this does is when this trigger is triggered, it will send any AI with a script_forceColor value of "r" to the red color group and any AI with a script_forceColor value of "g" to the green color group.
you can effectively have two seperate squads of AI use this one trigger to go to two seperate areas in your map and take cover. or you could just have two seperate triggers, one red and one green do the same thing.
[edit] Adding your AI to a color group
To make this work, you have to assign these values to your AI in Radiant:
script_forceColor r (to use the red nodes)
---OR---
script_forceColor g (to use the green nodes)
[edit] Setting up your AI entity
You can assign your AI many different values, some of the most common are, for this example i have used captain price (level.price) though this can be anything you assign. These are script value and therefore do not require you to add them whilst in radiant
Grab the actor from radiant to use in scripting (must assign the actor a key/value of 'targetname' 'actor)'
level.price = getent( "actor", "targetname" );
Make the actor a hero
level.price make_hero();
Allow the actor to push the player ( alternative (false); )
level.price pushPlayer(true);
Set the actors animation name
level.price.animname = "price";
Make the actor immune to bullets
level.price thread magic_bullet_shield();
Set the actor accuracy
level.price.accuracy = 1000;
Allows the actor to move to nodes not assigned to him
level.price.fixednode = false;
Set the actors script_noteworthy value
level.price.script_noteworthy = "price";
Set the actor granade ammo count
level.price.grenadeammo = 3;
Make the actor ignore enemy suppression fire
level.price.ignoresuppression = true;
Make the actor immune to flashbang effects
level.price setFlashBangImmunity( true );
[edit] Making AI Talk
coming soon!
[edit] Adding objectives
coming soon!
[edit] Adding player values
Take the player existing weapons
level.player takeallweapons();
Give the player a weapon
level.player giveWeapon( "mp5_silencer" );
Give the player ammo for his primary weapon
level.player giveMaxAmmo( "mp5_silencer" );
Give the player a grenade
level.player giveWeapon( "flash_grenade" );
Equip the player primary weapon
level.player switchtoWeapon( "mp5_silencer" );
Set grenade as player off hand weapon
level.player setOffhandSecondaryClass( "flash" );
--Rasta 10:43, 4 July 2008 (UTC)
