Inside3D tutorials.

Inside3D
 • Front Page
 • Articles
 • Downloads
 • Forums
 • Hosting
 • Help Wanted
 • Interviews
 • Reviews
 • Staff

 
Allied Sites
 - AI Cafe
 - Bot Epidemic
 - Dark Places
 - Flat Earth
 - FrikBot
 - Ghoulish Art
 - Kilbert3D
 - Quake Info Pool
 - QSG: Quake Standards
 - Rusted Fork
 - Stroggs Gone Mad
 - More...
 
Quake
 - Getting Started
 - QuakeC Specs v1.0
 - QuakeC Tutorials
 - Quake Mod Index
 
Quake II
 - Getting Started
 - dll Sourcecode
 - Coding Tutorials
 
.dll Central
 - Getting Started
 - Learning
 - dll Primer
 - dll in C
 - dll in Delphi
 - Compilers
 
Jedi Knight
 - Getting Started
 - COG Specs
 - Sound Specs
 - Tutorials
 
Level Editing
 - Tutorials/Tips
 
 
Telefragged!!!
Created By: QuakeGod
eMail: quakegod@telefragged.com
Difficulty Scale: Easy


Step 1
This is the first part of a two part tutorial on making and defining classes. This first chapter will be the simplest and will just allow you to choose 2 different classes but the classes won't do anything different, that's being saved until the next chapter. Here are two simple things to remember when looking at the code :
Add the code in blue.
Delete the code in red.
Leave the code alone in white.

Step 2
The first thing you will want to do if open up the weapons.qc file. Scroll down to where you see the ImpulseCommands function. This is where you will add the code to change classes and to show what class you have.
void () ImpulseCommands =
{
	if (self.impulse >= 1 && self.impulse = 8)
		W_ChangeWeapon ();

	if (self.impulse == 9)
		CheatCommand ();
	if (self.impulse == 10)
		CycleWeaponCommand ();
	if (self.impulse == 11)
		ServerflagsCommand ();
	if (self.impulse == 12)
		CycleWeaponReverseCommand ();

	if (self.impulse == 100)
		classpick();        //calls the function that changes the class
	if (self.impulse == 200)
		showclass();        //calls the function that shows you what class you have


	if (self.impulse == 255)
		QuadCheat ();
		
	self.impulse = 0;
};



Step 3
Ok, now right after the ImpulseCommands function, you will want to add the classtype function and the showclass function. This function will allow you to choose between two classes and it also will set you up so it automatically calls the showclass function. The showclass function will actually show you what class you have.
	if (self.impulse == 100)
		classtype();

	if (self.impulse == 255)
		QuadCheat ();
		
	self.impulse = 0;
};    //end of the ImpulseCommands function


void() classpick =
{

	if (self.classtype == 0)
		{	
		self.classtype = 1;    //the variable is now set to the old guy class
		showclass();
		}

	
	else if (self.classtype == 1)
		{
		self.classtype = 0;    //the variable is now set to the Quake guy class
		showclass();
		}
		
};

void() showclass =
{

	if (self.classtype == 0)
		{
		centerprint(self, "You are the Quake Soldier");	
		}
 
	else if (self.classtype == 1)
		{
		centerprint(self, "You are an old soldier");
		}

};




Step 4
Now all you have to do is add the variables and functions to the defs.qc. First open the defs.qc file. Then add the variables and functions as shown here.
//================================================
void		end_sys_fields;			// flag for structure dumping
//================================================

//put the new variables after this


.float classtype;
void() classpick;
void() showclass;



Step 5
Wow! We're done with lesson 1! Well, compile this code now and run it. Impulse 100 will switch between classes and impulse 200 will show you what class you currently are, not like it matters what class you are though. Tune in next time to find out how to actually make the classes different.






The Inside3D content and design is copyrighted by the Inside3D team, and may not be re-produced or copied without proper consent. All rights reserved. Any work credited to any author not part of InsideQC is copyrighted by that author. If you have any feedback, suggestions or flames please send it in to the author. Inside3D is hosted by telefragged and the design was originated by project-9.