Call of Duty 4: SP - Objective Basics: Difference between revisions

From COD Modding & Mapping Wiki
Jump to navigation Jump to search
mNo edit summary
 
mNo edit summary
 
(3 intermediate revisions by one other user not shown)
Line 14: Line 14:
Now is the time for scripting. It's fairly simple. Copy and paste this in your gsc file.  
Now is the time for scripting. It's fairly simple. Copy and paste this in your gsc file.  
   
   
<pre>
<syntaxhighlight lang="cpp">
main()
main()
{
{
Line 37: Line 37:
objective_state(1, "done");
objective_state(1, "done");
obj1 delete(); //deletes it
obj1 delete(); //deletes it
 
wait(2); //fill in however long you like (in seconds)
wait 2; //fill in however long you like (in seconds)
thread obj2(); //thread next objectives.
thread obj2(); //thread next objectives.
}
}
Line 52: Line 52:
obj2 delete();
obj2 delete();


wait(2);
wait 2;
thread obj3();
thread obj3();
}
}
Line 66: Line 66:
obj3 delete();
obj3 delete();


wait(2);
wait 2;
iprintlnbold (&"mapname_OBJ_COMPLETED"); //tells player obj finished
iprintlnbold (&"mapname_OBJ_COMPLETED"); //tells player obj finished
missionSuccess ("fun",false); //the mission ends
missionSuccess ("fun",false); //the mission ends
}
}
</pre>
</syntaxhighlight>


The script above is for trigger objectives. For actors replace
The script above is for trigger objectives. For actors replace
Line 83: Line 83:
*Copy this:
*Copy this:


<pre>
<syntaxhighlight lang="cpp">
VERSION            "1"
VERSION            "1"
CONFIG              "F:projectsmkbinStringEdStringEd.cfg"
CONFIG              "F:\projects\mk\bin\StringEd\StringEd.cfg"
FILENOTES          ""
FILENOTES          ""


Line 101: Line 101:


REFERENCE          OBJECTIVES
REFERENCE          OBJECTIVES
LANG_ENGLISH        "Press the |Tab| key to check your Objectives" //reminder
LANG_ENGLISH        "Press ^3[{+scores}]^7 to check your Objectives" //reminder


ENDMARKER
ENDMARKER
</pre>  
</syntaxhighlight>


You can add more references for more objectives. Just add OBJ4, OBJ5, etc.
You can add more references for more objectives. Just add OBJ4, OBJ5, etc.
Line 120: Line 120:
I can't call the script from another gsc file because I don't know how to get it to work. Just copy and paste into your main gsc file.  
I can't call the script from another gsc file because I don't know how to get it to work. Just copy and paste into your main gsc file.  


<pre>
<syntaxhighlight lang="cpp">
thread ally_nodamage(); //whatever value you like for thread
thread ally_nodamage(); //whatever value you like for thread
ally_nodamage() //whatever you called above
ally_nodamage() //whatever you called above
{
{
allyteam = getentarray ("ally", "targetname"); //what you named
allyteam = getentarray ("ally", "targetname"); //what you named
for(i=0; i<allyteam.size; i++)
for(i=0; i<allyteam.size; i++)
{
allyteam[i] thread maps\_utility::magic_bullet_shield(); //infinite health
allyteam[i] thread maps_utility::magic_bullet_shield(); //infinite health
}
}
}
</pre>
</syntaxhighlight>


You're done! The infinite health works great for heroes or any regular actors, but not you, the player, unfortunately. Also thanx to [http://www.modsonline.com/Forums-top-68372-30.html#59375 this post] and everyone who helped me on this topic.
You're done! The infinite health works great for heroes or any regular actors, but not you, the player, unfortunately. Also thanx to [http://www.modsonline.com/Forums-top-68372-30.html#59375 this post] and everyone who helped me on this topic.
Line 137: Line 136:
Combine both tutorials together you get this. My map as an example.
Combine both tutorials together you get this. My map as an example.
   
   
<pre>
<syntaxhighlight lang="cpp">
main()
main()
{
{
Line 146: Line 145:
level.weaponClipModels[3] = "weapon_mp5_clip";
level.weaponClipModels[3] = "weapon_mp5_clip";


maps_load::main();
maps\_load::main();


level.player takeallweapons();
level.player takeallweapons();
Line 160: Line 159:
ally_nodamage()
ally_nodamage()
{
{
allyteam =getentarray ("ally", "targetname");
allyteam = getentarray ("ally", "targetname");
 
for(i=0; i<allyteam.size; i++)
for(i=0; i<allyteam.size; i++)
{
allyteam[i] thread maps\_utility::magic_bullet_shield();
allyteam[i] thread maps_utility::magic_bullet_shield();
}
}
}


Line 178: Line 175:
obj1 delete();
obj1 delete();


wait(2);
wait 2;
thread obj2();
thread obj2();
}
}
Line 192: Line 189:
obj2 delete();
obj2 delete();


wait(2);
wait 2;
thread obj3();
thread obj3();
}
}
Line 206: Line 203:
obj3 delete();
obj3 delete();


wait(2);
wait 2;
iprintlnbold (&"streetclearing2_OBJ_COMPLETED"); //Let player know he is done
iprintlnbold (&"streetclearing2_OBJ_COMPLETED"); //Let player know he is done
missionSuccess ("dawnville",false);
missionSuccess ("dawnville",false);
}  
}  
</pre>  
</syntaxhighlight>  


Thanx for reading, hope you make great Single Player maps!
Thanx for reading, hope you make great Single Player maps!
Line 223: Line 220:


==Related Links:==
==Related Links:==
* [http://www.anabolic.ca'''bodybuilding''']
* [http://www.fitness-questions.com'''fitness questions''']
* [http://www.supplementreview.ca'''supplement reviews''']


Sources: [http://www.modsonline.com/Tutorials-read-616.html Modsonline.com]
Sources: [http://www.modsonline.com/Tutorials-read-616.html Modsonline.com]

Latest revision as of 15:25, 23 February 2012

This guide will tell you how to create objectives in COD4 easily as well as infinite health for your teammates.
  • First create your world in radiant. Then create a trigger brush anywhere you like. This is where you would have to go to complete the objective. Make sure the trigger brush is trigger_multiple.
  • Then fill in this:
Key: targetname
value: obj1
  • If you want more objectives, create more triggers. Replace the value with obj2, obj3 and so on.
  • To make an actor an objective, create the actor and give him the key of targetname and value of obj#.
  • After you're done, finish your map and save!
  • Complie your map!

Now is the time for scripting. It's fairly simple. Copy and paste this in your gsc file.

main()
{
	maps\_load::main();

	level.player takeallweapons();
	level.player giveWeapon ("m16_basic"); //use whatever gun you want
	level.player giveWeapon ("g36c"); //same
	level.player switchToWeapon ("g36c"); //pick the gun you want to hold
	level.player giveWeapon ("fraggrenade");
	level.player giveWeapon ("flash_grenade");
	thread obj1(); //call your objectives
}

obj1()
{
	obj1 = getent("obj1", "targetname"); //the game finds the trigger
	objective_add(1, "active", &"mapname_OBJ1",getent("obj1","targetname").origin); //add obj.
	objective_current(1); //current objective

	obj1 waittill("trigger"); //wait till the trigger is triggered
	objective_state(1, "done");
	obj1 delete(); //deletes it

	wait 2; //fill in however long you like (in seconds)
	thread obj2(); //thread next objectives.
}

obj2()
{
	obj2 = getent("obj2", "targetname");
	objective_add(2, "active", &"mapname_OBJ2",getent("obj2","targetname").origin);
	objective_current(2);

	obj2 waittill("trigger");
	objective_state(2, "done");
	obj2 delete();

	wait 2;
	thread obj3();
}

obj3()
{
	obj3 = getent("obj3", "targetname");
	objective_add(3, "active", &"mapname_OBJ3",getent("obj3","targetname").origin);
	objective_current(3);

	obj3 waittill("trigger");
	objective_state(3, "done");
	obj3 delete();

	wait 2;
	iprintlnbold (&"mapname_OBJ_COMPLETED"); //tells player obj finished
	missionSuccess ("fun",false); //the mission ends
}

The script above is for trigger objectives. For actors replace

obj# waittill("trigger");

with

obj# waittill("death");
  • You can add more objectives if you like. Just repeat.
  • You're done the gsc file but scripting is not done yet!
  • create a mapname.str in your main/localizedstrings folder.
  • Copy this:
VERSION             "1"
CONFIG              "F:\projects\mk\bin\StringEd\StringEd.cfg"
FILENOTES           ""

REFERENCE           OBJ1
LANG_ENGLISH        "Get to the centre of the road. Clear out the road block." //change to whatever you want for your objective.

REFERENCE           OBJ2
LANG_ENGLISH        "Get to your teammates!" //same

REFERENCE           OBJ3
LANG_ENGLISH        "Get on the truck." //same

REFERENCE           OBJ_COMPLETED
LANG_ENGLISH        "All Objective Completed!"  //same

REFERENCE           OBJECTIVES
LANG_ENGLISH        "Press ^3[{+scores}]^7 to check your Objectives" //reminder

ENDMARKER

You can add more references for more objectives. Just add OBJ4, OBJ5, etc.


That's it you're done!


Time for infinite health. This is very simple.

  • In radiant, create some actors or just one. Give them a targetname of ally or whatever. You're done in radiant!

Script time!

I can't call the script from another gsc file because I don't know how to get it to work. Just copy and paste into your main gsc file.

thread ally_nodamage(); //whatever value you like for thread

ally_nodamage() //whatever you called above
{
	allyteam = getentarray ("ally", "targetname"); //what you named
	for(i=0; i<allyteam.size; i++)
		allyteam[i] thread maps\_utility::magic_bullet_shield(); //infinite health
}

You're done! The infinite health works great for heroes or any regular actors, but not you, the player, unfortunately. Also thanx to this post and everyone who helped me on this topic.


Combine both tutorials together you get this. My map as an example.

main()
{
	level.weaponClipModels = [];
	level.weaponClipModels[0] = "weapon_m16_clip";
	level.weaponClipModels[1] = "weapon_ak47_clip";
	level.weaponClipModels[2] = "weapon_g36_clip";
	level.weaponClipModels[3] = "weapon_mp5_clip";

	maps\_load::main();

	level.player takeallweapons();
	level.player giveWeapon ("m16_basic");
	level.player giveWeapon ("g36c");
	level.player switchToWeapon ("g36c");
	level.player giveWeapon ("fraggrenade");
	level.player giveWeapon ("flash_grenade");
	thread ally_nodamage();   //  executes ally_nodamage() function
	thread obj1();
}

ally_nodamage()
{
	allyteam = getentarray ("ally", "targetname");

	for(i=0; i<allyteam.size; i++)
		allyteam[i] thread maps\_utility::magic_bullet_shield();
}

obj1()
{
	obj1 = getent("obj1", "targetname");
	objective_add(1, "active", &"streetclearing2_OBJ1",getent("obj1","targetname").origin);
	objective_current(1);

	obj1 waittill("trigger");
	objective_state(1, "done");
	obj1 delete();

	wait 2;
	thread obj2();
}

obj2()
{
	obj2 = getent("obj2", "targetname");
	objective_add(2, "active", &"streetclearing2_OBJ2",getent("obj2","targetname").origin);
	objective_current(2);

	obj2 waittill("trigger");
	objective_state(2, "done");
	obj2 delete();

	wait 2;
	thread obj3();
}

obj3()
{
	obj3 = getent("obj3", "targetname");
	objective_add(3, "active", &"streetclearing2_OBJ3",getent("obj3","targetname").origin);
	objective_current(3);

	obj3 waittill("trigger");
	objective_state(3, "done");
	obj3 delete();

	wait 2;
	iprintlnbold (&"streetclearing2_OBJ_COMPLETED"); //Let player know he is done
	missionSuccess ("dawnville",false);
}

Thanx for reading, hope you make great Single Player maps!

Source files.


P.S. This Tutorial can be used for all COD games.

By sam_fisher3000


Related Links:

Sources: Modsonline.com

--CoDEmanX 02:43, 29 July 2009 (UTC)