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

Members Online

»
0 Active | 7 Guests
Online:

LATEST FORUM THREADS

»
Rainbow HELP....
CoD4 MP Mapping
water
CoD4 MP Mapping
ugw2gold
Starcraft 2

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
Category: CoD Mapping
CoD mapping and level design.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, supersword
Latest Posts
Subscribed Posts
Search
Restricted Access Restricted Access
Page
Previous Page
subscribe
Author Topic: beginners guide to CoD1 Mod Scripting?
Duckster22
General Member
Since: Aug 21, 2011
Posts: 6
Last: Aug 23, 2011
[view latest posts]
Level 0
Category: CoD Mapping
Posted: Tuesday, Aug. 23, 2011 11:18 am
So does anybody happen toknow how to explain what this means?

level.mrc_firstaid = cvardef("mrc_firstaid",0,0,1,"int")

Ok so we are setting a global variable I figure but what is the array of values mean?

mrc_firstaid is the name right?
but whats 0
then 0
then 1
Ok type is int I get that.
Please if someone could explain this would be awesome!
Share |
BrainStorm
General Member
Since: Aug 26, 2009
Posts: 10
Last: Apr 16, 2013
[view latest posts]
Level 0
Category: CoD Mapping
Posted: Tuesday, Aug. 23, 2011 11:27 am
check in one of the .gsc. you'll find what the cvardef(.....) handles

yes mrc_firstaid is the name of the cvar being set

default
min
max
type

If I remember correctly.
Share |
Tally
General Member
Since: Apr 21, 2005
Posts: 819
Last: Oct 26, 2012
[view latest posts]
Level 7
Category: CoD Mapping
Posted: Tuesday, Aug. 23, 2011 11:36 am
Duckster22 writes...
Quote:
So does anybody happen toknow how to explain what this means?

level.mrc_firstaid = cvardef("mrc_firstaid",0,0,1,"int")

Ok so we are setting a global variable I figure but what is the array of values mean?

mrc_firstaid is the name right?
but whats 0
then 0
then 1
Ok type is int I get that.
Please if someone could explain this would be awesome!


cvardef() is a custom function invented by a modder by the name of Ravir (Clifton Cline), who created Demolition gametype/mod for COD1. It's purpose is to parse a cvar according to its type (sting, int, or float), according to how it is to be executed for a map, or a gametype, or both. It sets a minimum, a maximum, and a default value:

Code:
cvardef( varname, vardefault, min, max, type )
{
	mapname = getcvar( "mapname" );

	gametype = getcvar( "g_gametype" );

	tempvar = varname + "_" + gametype;
	if( getcvar( tempvar ) != "" ) 
		varname = tempvar; 	

	tempvar = varname + "_" + mapname;
	if( getcvar( tempvar ) != "" )
		varname = tempvar;

	switch( type )
	{
		case "int":
			if( getcvar( varname ) == "" )
				definition = vardefault;
			else
				definition = getcvarint( varname );
			break;
		case "float":
			if( getcvar( varname ) == "" )
				definition = vardefault;
			else
				definition = getcvarfloat( varname );
			break;
		case "string":
		default:
			if( getcvar( varname ) == "" )
				definition = vardefault;
			else
				definition = getcvar( varname );
			break;
	}

	if( ( type == "int" || type == "float" ) && definition < min )
		definition = min;

	if( ( type == "int" || type == "float" ) && definition > max )
		definition = max;

	return definition;
}


edited on Aug. 23, 2011 02:36 pm by Tally
Share |
Duckster22
General Member
Since: Aug 21, 2011
Posts: 6
Last: Aug 23, 2011
[view latest posts]
Level 0
Category: CoD Mapping
Posted: Tuesday, Aug. 23, 2011 11:54 am
Awesome guys thanks for the help. I actually had basically just figured it out on my own when I checked and saw your replies so it awesome to have confirmed my suspicions.
Share |
Restricted Access Restricted Access
Page
Previous Page
subscribe
MODSonline.com Forums : Call of Duty : CoD Mapping

Latest Syndicated News

»
Why console gaming is dying
Quote:Consider this: Dedicated gaming sales — including living-room consoles...
Devs: Games are being dumb...
Click 'read more' to view the contents of this post.
Loadout
Gun Crafting to the Max. edited on Sep. 25, 2012 06:57 pm by Morp...
Introducing the Source Fil...
Surprised this wasn't made a long time ago. Sounds like a nice little feature.
Introducing the Source Fil...
The Source Filmmaker (SFM) is the movie-making tool built and used by us he...

Partners & Friends

»