

<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.zeroy.com/index.php?action=history&amp;feed=atom&amp;title=Call_of_Duty_5%3A_SP_-_Objectives</id>
	<title>Call of Duty 5: SP - Objectives - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.zeroy.com/index.php?action=history&amp;feed=atom&amp;title=Call_of_Duty_5%3A_SP_-_Objectives"/>
	<link rel="alternate" type="text/html" href="https://wiki.zeroy.com/index.php?title=Call_of_Duty_5:_SP_-_Objectives&amp;action=history"/>
	<updated>2026-05-05T21:54:08Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://wiki.zeroy.com/index.php?title=Call_of_Duty_5:_SP_-_Objectives&amp;diff=15478&amp;oldid=prev</id>
		<title>Zeroy: Created page with &quot;{{note|World at War SP Objective can be achieved in a variety of ways but the easiest is to add the objective to the list, set it as the current objective and then have a conditi...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.zeroy.com/index.php?title=Call_of_Duty_5:_SP_-_Objectives&amp;diff=15478&amp;oldid=prev"/>
		<updated>2011-01-13T13:07:57Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{note|World at War SP Objective can be achieved in a variety of ways but the easiest is to add the objective to the list, set it as the current objective and then have a conditi...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{note|World at War SP Objective can be achieved in a variety of ways but the easiest is to add the objective to the list, set it as the current objective and then have a condition that waits until it&amp;#039;s complete.}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example below shows a &amp;quot;clearing a building&amp;quot; type Objective&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
&lt;br /&gt;
Lets sort out our utilities first&lt;br /&gt;
&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
#include maps\_music;&lt;br /&gt;
#include maps\_utility;&lt;br /&gt;
#include maps\_anim;&lt;br /&gt;
#include common_scripts\utility;&lt;br /&gt;
#using_animtree (&amp;quot;generic_human&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
main()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
	maps\_load::main();&lt;br /&gt;
&lt;br /&gt;
	// maps\yourmapname_anim::main();&lt;br /&gt;
	// maps\yourmapname_fx::main();&lt;br /&gt;
&lt;br /&gt;
	// precache any models used in your objectives here&lt;br /&gt;
	// precacheModel(&amp;quot;weapon_explosives&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	// FLAGS - set any flags you might want to use&lt;br /&gt;
	// flag_init(&amp;quot;example_flag&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	// best way to spawn 4 players, just get 4 script structs in your map with targetname initial_spawn_points&lt;br /&gt;
&lt;br /&gt;
	structs = getstructarray( &amp;quot;initial_spawn_points&amp;quot;, &amp;quot;targetname&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	flag_wait( &amp;quot;all_players_connected&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
	players = get_players();&lt;br /&gt;
&lt;br /&gt;
	for( i = 0; i &amp;lt; players.size; i++ )&lt;br /&gt;
	{&lt;br /&gt;
		players[i] setorigin( structs[i].origin );&lt;br /&gt;
		players[i] setplayerangles( structs[i].angles );&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	// the players are in the level, now we can thread to our first objective&lt;br /&gt;
&lt;br /&gt;
	thread 1st_objective();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
1st_objective()&lt;br /&gt;
{&lt;br /&gt;
   // Lets add an objective for the players, this is our first, so 1, it&amp;#039;s the current objective and&lt;br /&gt;
   // YOURMAPNAME_OPENDOOR will call on a string reference in raw\english\localizedstrings\yourlevelname.str&lt;br /&gt;
   // the last part, marker.origin is where our objective marker will be displayed in reference to the compass&lt;br /&gt;
   // simply place an entity like a script_origin at the objectives location, give it a targetname and call it before our objective line&lt;br /&gt;
&lt;br /&gt;
    marker = getent(&amp;quot;yourobjectivemarker&amp;quot;, &amp;quot;targetname&amp;quot;);&lt;br /&gt;
	objective_add( 1, &amp;quot;current&amp;quot;, &amp;amp;&amp;quot;YOURMAPNAME_OPENDOOR&amp;quot;, marker.origin );&lt;br /&gt;
&lt;br /&gt;
	// get_closest( level.players[0], marker.origin ) );&lt;br /&gt;
&lt;br /&gt;
	objective_current(1); //current objective&lt;br /&gt;
&lt;br /&gt;
    // Now we need to have a condition for our objective, let&amp;#039;s say the player needs to open a door, we&amp;#039;d simply get the trigger&lt;br /&gt;
    // on the door and wait for the player to use it&lt;br /&gt;
&lt;br /&gt;
	trig = getent(&amp;quot;doortrig&amp;quot;, &amp;quot;targetname&amp;quot;);&lt;br /&gt;
    trig waittill (&amp;quot;trigger&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    objective_state(1, &amp;quot;done&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    thread next_objective();&lt;br /&gt;
    thread officer();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
next_objective()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
  // so once objective 1 is done we can set the next one - this will be clearing enemies&lt;br /&gt;
  // First of all lets spawn the enemies, we can rely on a trigger for now, otherwise spawn the enemies in the script. But either way&lt;br /&gt;
  // Always wait for the enemies to spawn before using any funcs on them&lt;br /&gt;
   // example of using coords as the marker&lt;br /&gt;
&lt;br /&gt;
    objective_add( 2, &amp;quot;current&amp;quot;, &amp;amp;&amp;quot;YOURMAPNAME_KILLGUYS&amp;quot;, (264, -497, -36) );&lt;br /&gt;
    objective_current(2); //current objective&lt;br /&gt;
&lt;br /&gt;
    // our trigger&lt;br /&gt;
&lt;br /&gt;
    obj2trig = getent(&amp;quot;objective_2&amp;quot;, &amp;quot;targetname&amp;quot;);&lt;br /&gt;
    obj2trig waittill (&amp;quot;trigger&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    wait(1);&lt;br /&gt;
&lt;br /&gt;
	enemy_spawners = getentarray(&amp;quot;your_enemies&amp;quot;, &amp;quot;targetname&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	wait(1);&lt;br /&gt;
&lt;br /&gt;
	// If your enemies have a count on them, so they spawn multiple times, deplete the count in script first or make sure there&amp;#039;s&lt;br /&gt;
    // a killspawner trigger before the player can get in sight of/kill the last enemy so that no more enemy respawn after the&lt;br /&gt;
    // objective is complete - this will wait for the enemy + their officer to be killed&lt;br /&gt;
&lt;br /&gt;
    waittill_dead(your_enemies);&lt;br /&gt;
&lt;br /&gt;
    flag_wait(&amp;quot;example_flag&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    objective_state(2, &amp;quot;done&amp;quot;);&lt;br /&gt;
    thread 3rd_objective();&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
officer()&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
	// example flag usage with objective 2&lt;br /&gt;
&lt;br /&gt;
	officer = getent(&amp;quot;officer&amp;quot;, &amp;quot;targetname&amp;quot;);&lt;br /&gt;
	officer Dospawn();&lt;br /&gt;
	waittil_dead(officer);&lt;br /&gt;
&lt;br /&gt;
	flag_set(example_flag);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;By Techno2SL&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
[http://www.mappersunited.com/forum/index.php?threads/sp-co-op-objectives.57/ Sources]&lt;br /&gt;
&lt;br /&gt;
[[Category:AI]]&lt;br /&gt;
[[Category:Call of Duty 5]]&lt;br /&gt;
[[Category:Scripting]]&lt;br /&gt;
[[Category:Objectives]]&lt;/div&gt;</summary>
		<author><name>Zeroy</name></author>
	</entry>
</feed>