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

Members Online

»
0 Active | 80 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] COD 4 and COD 5 Color Groups
Bloodlust
General Member
Since: Apr 7, 2004
Posts: 101
Last: Jan 14, 2015
[view latest posts]
Level 4
Category: CoD4 SP Mapping
Posted: Saturday, Jan. 26, 2008 11:06 am
Friendly Chains are obsolete!

Cod 4 (and 5) includes a new way of moving your friendly AI which is very simple to setup, and infinitely more flexible...

its called color groups.

to use this:

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 eachother. 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. just choose Red for now. then under that 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.

sounds alot like friendly chains, doesn't it?
why should you bother with this new way of moving your AI, you may ask...
I'll tell you why!

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:

script_color_allies
r0

now hold Shift and press G, and select Green for your color, then click Add, then 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.

now 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)

or you can just grab a group of AI and assign them to a color group manually through script as explained below.

lets take it another step:

say you just assigned everyone to the red color group in Radiant to start off with, but there's a crossroads you want to split your squad at, and have the two seperate groups move independantly of eachother, now using both the red AND the green color groups.

in Radiant you will have to already have your cover nodes setup where you want them, assigned to the two seperate colors as described above. at the place you want to split the squad you can do this either way, assuming it took 12 movements to get to the crossroads:

1. have one trigger_multiple with a key of script_color_allies and a value of r12 g12

2. have two seperate triggers one with script_color_allies / r12 and one with script_color_allies / g12

number 1 would be the easiest way to do it.
you can also make it to where the trigger lays in a choke point that will definetly be triggered or you can just trigger it manually through script, the choice is yours.

now at this point, all of your squad is still set to the red color group, even though you've just activated the green color group. so now you have to manually assign the guys you want to split off and get on the green group:

split_squad()
{
// assuming you do it manually and have given the split point trigger a targetname of "split_squad"
trigger = getEnt("split_squad", "targetname");
trigger notify("trigger");

// get all of your Allies in the squad
guys = getAiArray("allies");

// get the total number of guys and half it
split = (guys.size / 2);
count = 0;

// now split them up
for(i = 0; i < guys.size; i++)
{
if(count > split)
{
break;
}

if(isAlive(guys[ i ])) // make sure the guy is still alive first!
{
guys[ i ].script_forceColor = "g"; // set them to green
}

count ++; // increment the counter
}
}


now half of your AI will be set to red and continue on the red color group nodes, and the other half will start to follow the green color group nodes.

just a little bit more info, then we're done!

lets say the purpose of splitting the squad was to intentionally kill off a few of them. if you are using reinforcements, you will need to stop the AI's reinforcements BEFORE you kill them, otherwise their reinforcement will take their place after they are dead, and when that reinforcement dies, another reinforcement will take their place, and so on. so just before you would want to kill, say, the green guys, do this:


// you are now at this point in your level's script
guys = getAiArray("allies");

for(i = 0; i < guys.size; i++)
{
if(isDefined(guys[ i ].script_forceColor) && (guys.script_forceColor == "g"))
{
guys[ i ] disable_ai_color();
guys[ i ] disable_replace_on_death();
}

waittillframeend; // be sure he completes the functions
}

now lets say you have an AI you placed in your level to do a vignette, like opening a gate or something. if you dont want to just kill this guy off, but would rather he join the squad on whatever color group you want, all you have to do is this, assuming you gave him a targetname of "gate_keeper":

guy = getEnt("gate_keeper", "targetname");

if(isSentient(guy)) // make sure you didnt grab the spawner instead of the guy
{
guy enable_ai_color();
guy.script_forceColor = "r"; // set them to red
}

be sure to include maps/_utilty.gsc to your script for all this to work. add this to the very top of your script:

#include maps\_utility;

thats about all I can think of.
I forgot offhand how to setup color reinforcements, but I'll have a look at my level when I get back to work Monday and post here how to set it up.

[cool][cool][cool]

edited on Jan. 26, 2008 06:20 am by Bloodlust

edited on Jan. 26, 2008 08:17 am by foyleman
Share |
Bloodlust
General Member
Since: Apr 7, 2004
Posts: 101
Last: Jan 14, 2015
[view latest posts]
Level 4
Category: CoD4 SP Mapping
Posted: Saturday, Jan. 26, 2008 11:26 am
hmmm cant edit more than once, thats kinda lame...

anyway, forgot to add what color group to assign your "gate_keeper" guy to.

here is the correction:


now lets say you have an AI you placed in your level to do a vignette, like opening a gate or something. if you dont want to just kill this guy off, but would rather he join the squad on whatever color group you want, all you have to do is this, assuming you gave him a targetname of "gate_keeper":

guy = getEnt("gate_keeper", "targetname");

if(isSentient(guy)) // make sure you didnt grab the spawner instead of the guy
{
guy enable_ai_color();
guy.script_forceColor = "r"; // set them to red
}
Share |
novemberdobby
General Member
Since: Sep 17, 2006
Posts: 1965
Last: Oct 13, 2013
[view latest posts]
Level 8
Forum Moderator
Category: CoD4 SP Mapping
Posted: Saturday, Jan. 26, 2008 11:28 am
You can edit as many times as you want, it just has to be within 10 minutes [sad]

Good tut tho, a mod will probably add the second post to the first and put it up in tuts
Share |
foyleman
Preferred PLUS Member
Since: Nov 7, 2001
Posts: 95765
Last: Apr 9, 2024
[view latest posts]
Level 10
Admin
Forum Moderator
Im a fan of MODSonair
Im a HOST of MODSonair
Category: CoD4 SP Mapping
Posted: Saturday, Jan. 26, 2008 01:22 pm
Thanks. It's posted.
The 10 minute time limit is necessary. We had several posters who would ask a question, get a response and then delete their question due to embarrassment (I guess). That just makes the post useless to anyone else with the same problem.

I updated your original post with the edit and posted it to the tutorials section. (good call NovermberDobby)
Go ahead... You Play I Mod : Support Modsonline by becoming a PREFERRED MEMBER today!
Have you heard the MODSonair Podcast?:
MODSonair is a weekly podcast bringing you the news from a modders perspective.
Tune in every Sunday at 12pm EST to listen LIVE.
Quake 4 Mods for Dummies - Half-Life 2 Mods for Dummies
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

»